Results 1 to 5 of 5

Thread: Object activation

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2003
    Location
    England
    Posts
    7

    Angry Object activation

    Hello!

    Here's my problem: -

    I've got a Form that has a PictureBox and a gradient drawing subroutine draws the gradient onto the PictureBox at Form_Load. But when the Form appears, the gradient shows but is immediately covered with grey!

    This didn't happen in VB6!!!

    The subroutine works OK, the main problem is why is the gradient getting covered in grey? This is VERY annoying!

    The gradient subroutine simply creates the graphics (using CreateGraphics) which is created from the PictureBox (PictureBox1.CreateGraphics) and the gradient is stored in a bitmap variable and then is drawn onto the PictureBox.

    I thought I could put the subroutine in the Form_Activate section, but it doesn't appear in the list like VB6 had. Do you know what I mean? The "Form" was on the left (along with other controls like buttons and stuff), and the "Activate", "QueryUnload", etc, was on the right.

    Someone, please help me from this nightmare!


    Thanks in advance.

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Look for BaseClass Events on the left and then choose Activate on the right. Although you probably should override the OnPaint event instead since you'll want to redraw everytime the form redraws.

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2003
    Location
    England
    Posts
    7
    Edneeis: Ah! There they are! Thanks alot. However, there isn't a "OnPaint" event but there is a "Paint" event, should I put it in there?

  4. #4
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Yep, that is the one.

  5. #5
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Sorry I guess OnPaint would be if you inherited from the Form or searched in the Override list.

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