Results 1 to 5 of 5

Thread: Does anyone have any idea why this won't work?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Posts
    124

    Unhappy

    I have the following code behind a command button:

    Dim OldBrush As Long
    Dim OldPen As Long
    Dim NewBrush As Long
    Dim NewPen As Long
    Dim Color As Long

    Color = RGB(0, 0, 255)
    NewPen = CreatePen(PS_SOLID, 3, Color)
    OldPen = SelectObject(Form1.hdc, NewPen)
    NewBrush = CreateSolidBrush(Color)
    OldBrush = SelectObject(Form1.hdc, NewBrush)
    Rectangle Form1.hdc, 50, 50, 100, 50
    SelectObject Form1.hdc, OldBrush
    SelectObject Form1.hdc, OldPen

    DeleteObject NewPen

    When I click the button, nothing happens at all.

    P.S. I do have all the necessary declerations.
    On Error Resume Screaming...

  2. #2
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Bethel, North Carolina, USA
    Posts
    987
    If you haven't done it already set the Autoredraw property on the form to True.
    {Insert random techno-babble here}

    {Insert quote from some long gone mofo here}

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Posts
    124

    Unhappy Thanks, but...

    that isn't working. It still doesn't do anything and now this circle method I also have on that form doesn't show up.

    none of the graphics APIs I try are doing a thing. i just tried to make a DC using createcompatibledc, draw a circle onto my form, bitblt it to the new DC, use the CLS method on my form, and then bitblt it back. everything worked except for the last step. and the circle wasn't even an API, it was just the form's circle method.

    it's really frustrating, because I don't even get errors or anything. it's just that nothing happens
    Last edited by DarkJedi9; Feb 17th, 2001 at 11:36 PM.
    On Error Resume Screaming...

  4. #4
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Bethel, North Carolina, USA
    Posts
    987
    I can't believe that I overlooked this, the rectangle is drawing correctly because both y values are the same therefore there is no height in your rectangle, change this line to ...

    Code:
    Rectangle Form1.hdc, 50, 50, 100, 50
    to this....

    Code:
    Rectangle Form1.hdc, 50, 50, 100, 51
    and (as I stated above) make sure you have Autoredraw set to True and you will finally see the beautiful blue rectangle, enjoy!
    {Insert random techno-babble here}

    {Insert quote from some long gone mofo here}

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Posts
    124

    Cool Doh!

    My bad. Thanks.
    On Error Resume Screaming...

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