|
-
Nov 25th, 2005, 03:19 AM
#1
Thread Starter
Lively Member
-
Nov 25th, 2005, 03:29 AM
#2
Fanatic Member
Re: problem while drawing rectangles
Empty Box
VB Code:
Picture1.Line(10, 10)-Step(100, 30), RGB(0, 0, 0), B
Filled Box
VB Code:
Picture1.Line(10, 10)-Step(100, 30), RGB(0, 0, 0), BF
Circle
VB Code:
Picture1.Circle(50, 50), 10, RGB(0, 0, 0)
Rounded Rectangle (not filled)
VB Code:
'// Uhm...
Private Function Radians(ByVal deg as single) As single
Dim Pi as single
Pi = 3.14159265358979
Radians = deg * (Pi / 180)
End Funtion
Private Sub Form_Load()
Dim rWidth as integer
Dim rHeight as integer
Dim rCorner as integer
Dim rX as integer
Dim rY as integer
Dim lC as long
rWidth = 100 '// width of the rectangle
rHeight = 50 '// height of the rectangle
rCorner = 5 '// corner radius
rX = 10 '// left position of rectangle
rY = 10 '// top position of rectangle
lC = RGB(126, 0, 0) '// rectangle color
'// top left corner
Picture1.Circle (rX + rCorner, rY + rCorner), rCorner, lC, Radians(90), Radians(180)
'// top right corner
Picture1.Circle (rX + rWidth - rCorner, rY + rCorner), rCorner, lC, Radians(0), Radians(90)
'// bottom left corner
Picture1.Circle (rX + rCorner, rY + rHeight - rCorner), rCorner, lC, Radians(180), Radians(270)
'// bottom right corner
Picture1.Circle (rX + rWidth - rCorner, rY + rHeight - rCorner), rCorner, lC, Radians(270), Radians(360)
'// top line
Picture1.Line (rX + rCorner, rY)-Step(rWidth - (rCorner * 2), 0), lC
'// bottom line
Picture1.Line (rX + rCorner, rY + rHeight)-Step(rWidth - (rCorner * 2), 0), lC
'// left line
Picture1.Line (rX, rY + rCorner)-Step(0, rHeight - (rCorner * 2)), lC
'// right line
Picture1.Line (rX + rWidth, rY + rCorner)-Step(0, rHeight - (rCorner * 2)), lC
End Sub
Last edited by r0ach; Nov 25th, 2005 at 09:53 AM.
r0ach™
Don't forget to rate the post
-
Nov 25th, 2005, 03:45 AM
#3
Thread Starter
Lively Member
Re: problem while drawing rectangles
I tried this method, it give me black colour inside the rectangle. but i want it to be transparent i.e. only outline (only 4 lines)
plz help
harry
-
Nov 25th, 2005, 03:54 AM
#4
Re: problem while drawing rectangles
It gives you filled rect because the Picturebox fillstyle property is set so SOLID (0)
Change to transparent:
You also can do it at design time.
-
Nov 25th, 2005, 09:48 AM
#5
Thread Starter
Lively Member
Re: problem while drawing rectangles
thanx alot friends,
now i'm using gdi APIs for making all the stuffs.
plz tell me 1 thing, if i'm drawing a filled RoundRectangle / ellipse / rectangle then how to allow the user to select his own colour.
plz reply soon
thanx in advance
harry
-
Nov 25th, 2005, 09:51 AM
#6
Fanatic Member
Re: problem while drawing rectangles
If you're using the GDI, there should be a param that specifies the color. Just have the user choose a color, and pass it in as this param. It will be the CreateSolidBrush that's got this param (I think. Too much VB.NET GDI+)
r0ach™
Don't forget to rate the post
-
Dec 2nd, 2005, 06:14 AM
#7
Thread Starter
Lively Member
Re: problem while drawing rectangles
thanx alot friends,
ur replies worked out for me.
thanx alot
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
|