|
-
May 29th, 2000, 01:12 PM
#1
Thread Starter
New Member
I am creating an ActiveX control similar to shape control but the one that draws different polygonal shapes. I have created a shapetype property for
diferent shapes: triangle, parallelogram, pentagon, hexagon, etc.
'let' property procedure of shapetype property contains code to draw the corresponding polygon on selection of shape type. I have used the following code to draw:
Public Property Let ShapeType(ByVal New_ShapeType As lbShapeTypes)
Dim hr&, dl&
Dim usew&, useh&
usew& = ScaleWidth / Screen.TwipsPerPixelX
useh& = ScaleHeight / Screen.TwipsPerPixelY
If New_ShapeType = Triangle Then
ReDim poly(1 To 3) As Coord
poly(1).x = usew / 2
poly(1).y = 0
poly(2).x = 0
poly(2).y = useh
poly(3).x = usew
poly(3).y = useh
hRgn& = CreatePolygonRgn(poly(1), 3, ALTERNATE)
dl& = SetWindowRgn(hWnd, hRgn&, True)
ElseIf New_ShapeType = Ellipse Then
hr& = CreateEllipticRgn(0, 0, usew, useh)
dl& = SetWindowRgn(hWnd, hr, True)
End If
m_ShapeType = New_ShapeType
PropertyChanged "ShapeType"
End Property
The ellipse code works fine, but triangle (polygon) does not get drawn with the right co-ordinates (triangle shape gets drawn with random co-ordinates or not at all drawn)
All Windows API declarations are also correctly written. My work environment is VB 6.0 on Windows 95.
Can someone guide me in this one...
My email id is [email protected]
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
|