Board index » cppbuilder » Form:OnPaint() drawing on top of other controls

Form:OnPaint() drawing on top of other controls


2004-11-25 03:12:34 AM
cppbuilder53
Hi,
I have a form with a couple of Panels aligned
alTop, alBottom and alClient. Panels completely
covers the form.
If I make some simple drawings in Form::OnPaint()
the graphics is not visible because it's drawn below
Panels.
How can I draw on top of all controls that are on
forms?
I tried with:
// ...
ScreenCanvas->Handle = GetDC(0);
ScreenCanvas->... some methods...
// ...
... bat it somehow doesn't work for me.
To be precise, I made a polyline form that looks
like a balloon, and I just want to make a border
that is surrounding that form. I can solve the problem
if I distancing the Panels of the form edges, but it
complicates some other things.
Best regards,
Vladimir Stefanovic
 
 

Re:Form:OnPaint() drawing on top of other controls

"Vladimir Stefanovic" < XXXX@XXXXX.COM >wrote in message
Quote
I can solve the problem if I distancing the Panels
of the form edges, but it complicates some other things.
Like what exactly? Please be more specific.
Gambit
 

Re:Form:OnPaint() drawing on top of other controls

Hi Vladimir
Maybe you could put the 3 panels inside another panel that is slightly
smaller than your form. Position the container panel so that your form
borders show and anchor all 4 sides to the form.
Aloha
Bill
 

{smallsort}

Re:Form:OnPaint() drawing on top of other controls

Quote
>I can solve the problem if I distancing the Panels
>of the form edges, but it complicates some other things.

Like what exactly? Please be more specific.
Well, my (custom) balloon form can dynanically change
size height/width depending of Text passed to it. With
it's form size all other related controls are also aligned,
like TLabel (autosize=flase, anchors), TBevel, TPanel,
TSpeedButton, and I have nothing to calculate manualy.
I said that I can solve the problem if I at one moment do:
SomePanel->Align = alNone;
and rearange:
SomePanel->Left/Top/Height/Width
to leave the edges of the form with no control that is
covering it. Then the border is visible.
And, I just wondered if I can draw on the top of all other
controls.
Best regards,
Vladimir Stefanovic
 

Re:Form:OnPaint() drawing on top of other controls

It's not so simple (I tried something like that) because
my form is not rectangular. It's a form that has a polyline
definition.
Thanks.
Best regards,
Vladimir Stefanovic
William Charles Nickerson <billATwcnickersonDOTca>wrote in message
Quote
Hi Vladimir

Maybe you could put the 3 panels inside another panel that is
slightly
smaller than your form. Position the container panel so that your
form
borders show and anchor all 4 sides to the form.

Aloha
Bill


 

Re:Form:OnPaint() drawing on top of other controls

"Vladimir Stefanovic" < XXXX@XXXXX.COM >wrote in message
Quote
Well, my (custom) balloon form can dynanically
change size height/width depending of Text passed to it.
TForm has a BorderWidth property. Regardless of the size of the contents,
there will always be a fixed border around the content. Just draw inside
that border area and you will be fine.
Gambit
 

Re:Form:OnPaint() drawing on top of other controls

"Vladimir Stefanovic" < XXXX@XXXXX.COM >wrote in message
Quote
It's not so simple (I tried something like that) because
my form is not rectangular. It's a form that has a polyline
definition.
So? I also have polyline forms (actually, I use TCustomControl instead of
TForm) and drawing borders around it work fine regardless of the content.
If you are having so many problems, then you are probably approaching the
issue all wrong to begin with. Please show your actual code.
Gambit
 

Re:Form:OnPaint() drawing on top of other controls

Remy,
I dropped out almost all auto-aligning controls, and
that manifested fine to me because showing/refreshing
the whole balloon form was overall faster, which I
noticed on slower machines Win98 PII 233.
I have a question about DLL that is related to RichEdit
component. Why my RichEdit behaves differently on
WinXP in comparison to Win98?
For example, I have a code that loops through
the RichEdit stringlist, and this code is supposed
to color & bold specified part of every single
item in the list. The problem is that under XP I
need only the first 4 rows of this code and on
Win98 I need also the additional 4 to assure
that the rest of item it will stay in clBlack color.
void TBalloonForm::Coloring( int Row, int Start, int Length, TColor
Color )
{
RichEdit->SelStart = Start;
RichEdit->SelLength = Length - 1;
RichEdit->SelAttributes->Color = Color;
RichEdit->SelAttributes->Style = TFontStyles() << fsBold;
// This part I do not need on XP
RichEdit->SelStart = Start + Length + 1;
RichEdit->SelLength = RichEdit->Lin
es->Strings[Row].Length()-Length;
RichEdit->SelAttributes->Color = clBlack;
RichEdit->SelAttributes->Style = TFontStyles()>>fsBold;
}
Best regards,
Vladimir Stefanovic
 

Re:Form:OnPaint() drawing on top of other controls

"Vladimir Stefanovic" < XXXX@XXXXX.COM >wrote in message
Quote
I have a question about DLL that is related to RichEdit component.
For future reference, please always start a new discussion thread when you
change the topic of discussion.
Quote
Why my RichEdit behaves differently on WinXP in comparison to Win98?
Because Win98 and XP implement different versions of the API RichEdit
control.
Quote
For example, I have a code that loops through
the RichEdit stringlist, and this code is supposed
to color & bold specified part of every single
item in the list. The problem is that under XP I
need only the first 4 rows of this code and on
Win98 I need also the additional 4 to assure
that the rest of item it will stay in clBlack color.
You should not need the extra code under Win98 to begin with. What exactly
is it supposed to be solving for you?
Gambit
 

Re:Form:OnPaint() drawing on top of other controls

Hi,
I have same question:
How to draw graphics (like line, rectangle,...) ON Controls. I see in vcl
doc that graphics are ALWAYS draws behind Controls.
Extends Paint method, extends WnProc or catching WM_Paint message don't help
us to draw graphics on controls.
I need to outline controls behind my cursor, something like black squares
around controls during the borland studio Form edition. But it seemed to be
impossible to do (I even try to use GDI API SetWindowRgn and
TransparentWindow).
In fact my question is :
Is-it possible to define a control (Selector) which draw box (ellipse or
something) around his Parent control and how to do it?
Thank you
"Vladimir Stefanovic" < XXXX@XXXXX.COM >wrote in message
Quote
Hi,

I have a form with a couple of Panels aligned
alTop, alBottom and alClient. Panels completely
covers the form.

If I make some simple drawings in Form::OnPaint()
the graphics is not visible because it's drawn below
Panels.

How can I draw on top of all controls that are on
forms?

I tried with:
// ...
ScreenCanvas->Handle = GetDC(0);
ScreenCanvas->... some methods...
// ...
... bat it somehow doesn't work for me.

To be precise, I made a polyline form that looks
like a balloon, and I just want to make a border
that is surrounding that form. I can solve the problem
if I distancing the Panels of the form edges, but it
complicates some other things.



Best regards,
Vladimir Stefanovic