Recent

Author Topic: Drawing form  (Read 1787 times)

jaytolkte

  • Newbie
  • Posts: 1
Drawing form
« on: October 03, 2018, 10:28:25 am »
When I try to draw on form , I've put that simple code on ButtonClick:

Code: Pascal  [Select][+][-]
  1.   with Canvas do
  2.   begin
  3.        Pen.Color:=clGreen;
  4.        Canvas.Rectangle(20,20,100,60);
  5.   end;
  6.  
it works nice, but if I put the GroupBox in the same coordinates(or interleaving coordinates) - GroupBox draws after my Rectangle. So, I put the same code in OnPaint method. Works well - I see my rectangle above GroupBox. But! If now I change the color of GroupBox to any, except clDefault - GroupBox again above my Rectangle.

I need Rectangle above all of components of form. How can I reach it?

wp

  • Hero Member
  • *****
  • Posts: 11855
Re: Drawing form
« Reply #1 on: October 03, 2018, 11:51:50 am »
I don't understand. What do you want to achieve? Paint the border of a groupbox in a different color?

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Drawing form
« Reply #2 on: October 05, 2018, 12:44:41 am »
you should be doing the painting within the Paint Handler of each control and then call the
Repaint of the parent control.
 
 This will force a proper sequence.
The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018