usercontrol not always correctly displayed-VBForums
Results 1 to 3 of 3

Thread: usercontrol not always correctly displayed

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2017
    Posts
    20

    usercontrol not always correctly displayed

    Hi everyone,

    I have a "button" usercontrol which, in its Paint event, is drawn by means of the Line and and Circle commands. 9 times out of 10 the button shows up correctly; sometimes however it is not painted at all. Blue rectangles show up in its place, like in this screenshot:

    Name:  Capture.JPG
Views: 91
Size:  27.9 KB

    The usercontrol button in the lower right corner displays correctly, but only after the mouse has been hovering over it (and the other two buttons display the same behavior) which apparently fires the Paint event; initially it is a blue rectangle like the other two.

    How can I make sure usercontrol buttons always display correctly right away (as they do in most of my other forms)?

    Thanks,
    Cooz

  2. #2
    Fanatic Member
    Join Date
    Feb 2017
    Posts
    850

    Re: usercontrol not always correctly displayed

    I suggest to take out the drawing code from the Paint event (to may be the Show event or where it needs to change), and set the AutoRedraw property of the UserControl to True.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    May 2017
    Posts
    20

    Re: usercontrol not always correctly displayed

    Hi Eduardo,

    You've helped me out once more. This looks good now, thank you!

    Cooz

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width