|
-
Feb 17th, 2001, 09:15 AM
#1
Thread Starter
Lively Member
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...

-
Feb 17th, 2001, 01:38 PM
#2
Fanatic Member
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}
-
Feb 17th, 2001, 11:25 PM
#3
Thread Starter
Lively Member
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...

-
Feb 18th, 2001, 02:27 AM
#4
Fanatic Member
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}
-
Feb 19th, 2001, 10:50 AM
#5
Thread Starter
Lively Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|