Do not Repaint ! :-)

D4, W98, Paradox
Hello all,
  How could i tell Windows do not repaint a componant until I want ?
  I am creating a TCalendar component
  My component's ancestor is TPanel and had 350 TButons on it. Buttons size and height are proportionals to TCalendar's ones one. But when 1 change size and height of the TCalendar, the butons are painted once fot changing Height and once again when changing width.
  so question is : How could i tell Windows do not repaint a componant until I want ?

Regards, ans thanks a lot for help.
 
     HelpMe
helpme020897Asked:
Who is Participating?
 
BlackManCommented:
:-)

You can freeze the entire window by using LockWindowUpdate(MyForm.Handle).
Use LockWindowUpdate(0) to release
0
 
helpme020897Author Commented:
read " But when I change" instead of  "But when 1 change".
   Thx.
0
 
MadshiCommented:
Why not using TCalendar.SetBounds(left,top,newWidth,newHeight) instead of changing width and height seperately?

Regards, Madshi.
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
MadshiCommented:
Or you can use
  SendMessage(calendar1.handle, WM_SETREDRAW, 0, 0);
to prevent redrawing and
  SendMessage(calendar1.handle, WM_SETREDRAW, 1, 0);
to allow it again.

Does this help?

Regards, Madshi.
0
 
BlackManCommented:
You can freeze the entire window by using LockWindowUpdate(MyForm.Handle).
Use LockWindowUpdate(0) to release
0
 
williams2Commented:
If I were you I would rather override the components OnPaint procedure instead for handling more customdefined ownerdraw methods.

Regards,
Williams
0
 
helpme020897Author Commented:
Thanks to each of you.

 But i used BlackMan's solution and it works fine :-)
Please BlackMan lock this question and let me give your benefits. :-)

  HelpMe
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.