|
-
May 9th, 2003, 02:37 PM
#1
Thread Starter
Junior Member
simple question on rectangles
I have a Rectangle with R.X,R.Y,R.Width,R.Height .
My question If it always adds the R.Width and R.Height in only one direction.How can I get Four rectangles that have the same Dimensions with and the Same start point ? What I am looking for is a PLUS sign made of the 4 rectangles....so How can this be done using the same R.X and R.Y ? It obviously doesn't let me put negative values for R.Width and R.Height...
Thank you.
-
May 9th, 2003, 08:46 PM
#2
Fanatic Member
You could multiply a value by -1... Whoops I can't read, you tried that. Hmm.
-
May 9th, 2003, 09:09 PM
#3
Fanatic Member
Okay how's this:
Code:
Dim R As New Rectangle()
R.X = 140
R.Y = 70
R.Height = 20
R.Width = 34
Dim myPen As New Pen(Color.Black, 3)
Dim g As Graphics
g = Me.CreateGraphics
'Draw rect 1
g.DrawRectangle(myPen, R.X, R.Y, R.Width, R.Height)
'Draw rect 2
g.DrawRectangle(myPen, R.X - R.Width, R.Y, R.Width, R.Height)
'Draw rect 3
g.DrawRectangle(myPen, R.X, R.Y - R.Height, R.Width, R.Height)
'Draw rect 4
g.DrawRectangle(myPen, R.X - R.Width, R.Y - R.Height, R.Width, R.Height)
For rect 1 I could have used the rect structure I defined but I decided to use the same overload as the other three. Does it make sense why this works?
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
|