Results 1 to 3 of 3

Thread: [RESOLVED] [2005] Paint event not triggering

  1. #1

    Thread Starter
    Fanatic Member uniquegodwin's Avatar
    Join Date
    Jul 2005
    Location
    Chennai,India
    Posts
    694

    Resolved [RESOLVED] [2005] Paint event not triggering

    Hello everyone,
    I am using GDI+ to paint the form,its labels and its groupboxes with a gradient color.
    But the problem Im facing is that the paint event doesnt trigger sometimes for the groupboxes and labels as it does for the form.
    What could be the problem for this?
    Please help,
    Thanks so much,
    Godwin

    Help someone else with what someone helped you!

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] Paint event not triggering

    The Paint event is raised every time the control requires repainting, period. If the control doesn't require repainting then its Paint event is not raised. .NET tries to do as little painting as possible because it is very time consuming. I haven't tested it but it is quite plausible that the forms Paint event will be raised because the form itself has changed but the region occupied by a particular control has not changed so that control's Paint event is not raised. If you want to force a control to be repainted at any time then you can call its Refresh or Invalidate method. Again, you should avoid any unnecessary repainting, so it is preferable to call the Inavlidate method and specify the area that has changed. It takes much less time to calculate that area than it does to repaint the are athat hasn't changed.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Fanatic Member uniquegodwin's Avatar
    Join Date
    Jul 2005
    Location
    Chennai,India
    Posts
    694

    Re: [2005] Paint event not triggering

    Thanks Jm,Ill try the invalidate method.... []
    This problem was occuring inside a Tab control which contains a couple of group boxes...
    Sometimes,the groupboxes didnt paint themselves as coded...but then i found a custom tab control and used it and removed all the groupboxes for now..
    But I have to use the same in different places..Ill try it soon..
    Thanks []
    Godwin

    Help someone else with what someone helped you!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width