Board index » delphi » Drawing lines on top of everything
Mike Mormando
![]() Delphi Developer |
Sat, 04 Aug 2001 03:00:00 GMT
|
Mike Mormando
![]() Delphi Developer |
Sat, 04 Aug 2001 03:00:00 GMT
Drawing lines on top of everything
I've got an app that I where people assign relationships between
objects. These objects currently reside in different panels, and they want to draw lines between the objects. I'm able to accomplish this by converting everything to screen coordinates, and using a canvas to draw to the screen dc. Everything works fine until part of the form is either hidden, or I resize it, the lines are redrawn right where I want them to be. Once I do either of the things above though, the lines are redrawn directly on the desktop. Any able to enlighten me? TIA Mike |
Kirk Wo
![]() Delphi Developer |
Sat, 04 Aug 2001 03:00:00 GMT
Re:Drawing lines on top of everythingYou might want to try to just draw on the Form's canvas, since that's all you really need to do anyway. Kirk QuoteOn Tue, 16 Feb 1999 13:43:30 -0700, Mike Mormando <m...@mormando.com> wrote: |
Mike Mormand
![]() Delphi Developer |
Sat, 04 Aug 2001 03:00:00 GMT
Re:Drawing lines on top of everythingNot that I'm able to see, if I try to draw a line with the forms canvas, and the form has a couple of panels on top of it, I never see the line, or am I doing something else wrong? Mike QuoteKirk Woll wrote: |
David Boudrea
![]() Delphi Developer |
Sat, 04 Aug 2001 03:00:00 GMT
Re:Drawing lines on top of everythingAre the Panels directly adjacent, or is there some of the form showing between them? The Paint that happens when uncovering or resizing will probably paint the form, then the panels. If the drawing of the connector is part of the Form's Paint handler, as it ought to be, then it might be being drawn and then overdrawn by the panels. Or is it possible that you are just drawing the connector once and not each time the Paint event fires? |
Samson F
![]() Delphi Developer |
Sun, 05 Aug 2001 03:00:00 GMT
Re:Drawing lines on top of everythingMike Mormando ???g??31 <36C9DF50.67A4D...@mormando.com>... Quote>Not that I'm able to see, if I try to draw a line with the forms canvas, Quote>of panels on top of it, I never see the line, or am I doing something else TForm1 = class(TForm) procedure FormMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure FormShow(Sender: TObject); procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure FormMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); private { Private declarations } MD: Boolean; DP: TPoint; public { Public declarations } Procedure BoundMouse(const isLimit: Boolean); Procedure OverDraw(const isOver: Boolean); end; ...... Procedure TForm1.BoundMouse(const isLimit: Boolean); Procedure TForm1.OverDraw(const isOver: Boolean); SetWindowLong(Handle, GWl_Style, Style); procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton; MD:= True; {1 Canvas.Pen.Mode:= pmXor;//pmNotXor; Canvas.Rectangle(X-50, Y-50, X+50, Y+50); procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X, procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton; |
Davie Ree
![]() Delphi Developer |
Tue, 07 Aug 2001 03:00:00 GMT
Re:Drawing lines on top of everythingMaybe you could put a paintbox ON the panel and then draw on the paintbox? Davie QuoteDavid Boudreau wrote: |
Mike Mormand
![]() Delphi Developer |
Tue, 07 Aug 2001 03:00:00 GMT
Re:Drawing lines on top of everythingIf it were a single panel, I could do it. but I've got a multitude of panels, some of which are nested inside other panels, and lets say I've got panels A, B, and C, then within panel A, I've got d,e,f, B I've got g,h, and C I've got j,k,and l. Then I want to show a line from a component parented in panel l that the other end is in a panel parented in panel d. That's my problem. As to the question of redrawing the lines, I'm keeping track of the form relative points in a TList, and I draw them in an overridden Paint method, so I think it should be re-painted every time. As a matter of fact, it appears that it is, it's just that instead of showing on my form, it looks like it's now being painted on the Desktop! Ah well, I've gotten a few other ideas here that I haven't tried out yet, I'll give those a go and let everybody know the outcome. Thx for everyones help! Mike QuoteDavie Reed wrote: |
Davie Ree
![]() Delphi Developer |
Tue, 07 Aug 2001 03:00:00 GMT
Re:Drawing lines on top of everythingSend me your code for painting and I will look at it for you. Davie QuoteMike Mormando wrote: |
Mike Mormand
![]() Delphi Developer |
Thu, 09 Aug 2001 03:00:00 GMT
Re:Drawing lines on top of everythingI've tried your code, and it seems to work fine, until it comes time to repaint, it looks like the form repaints, then the panels repaint on top of my lines, obscuring them. Any other ideas? Mike QuoteSamson Fu wrote in message <7advfr$8i...@forums.borland.com>... |
Mike Mormand
![]() Delphi Developer |
Fri, 10 Aug 2001 03:00:00 GMT
Re:Drawing lines on top of everythingThanks, I'll do that this evening.(No smtp access at work) Mike QuoteDavie Reed wrote: |
John Langle
![]() Delphi Developer |
Fri, 10 Aug 2001 03:00:00 GMT
Re:Drawing lines on top of everythingMike, If you figure this out, could you post your solution or send it to me. I'm Thanks, John Langley QuoteMike Mormando wrote: |
Michael Ede
![]() Delphi Developer |
Tue, 14 Aug 2001 03:00:00 GMT
Re:Drawing lines on top of everythingQuote>form. (Though I could solve my problem if I knew how to draw between the directly to GetDC(GetDeskTopWindow); |
Samson F
![]() Delphi Developer |
Tue, 14 Aug 2001 03:00:00 GMT
Re:Drawing lines on top of everythingYou can implement the "OnPaint" event of "Form1", and redraw your graphic there. and call "overdraw(True)" at begining, "overdraw(false)" at end. Mike Mormando ???g??31 <7aqjm6$o...@forums.borland.com>... Quote>I've tried your code, and it seems to work fine, until it comes time to |
Danny Thorp
![]() Delphi Developer |
Wed, 22 Aug 2001 03:00:00 GMT
Re:Drawing lines on top of everythingTo draw over all child windows, use the GetDCEx API function. Samson Fu <samso...@hutchcity.com> wrote in article Quote> You can implement the "OnPaint" event of "Form1", and redraw your graphic |
1. Drawing lines on top of JPEG image
2. THintWindow always on top of everything
3. Drawing On Everything Even Windowed Controls
4. Drawing non solid line with line width greater than one
5. Drawing on top of TRichEdit
7. Drawing on top of an application
8. Drawing on top of OCX graphics component