|
-
Aug 9th, 2011, 06:57 PM
#1
Thread Starter
Hyperactive Member
Flip Rectangle
Hi,
Could anyone tell me how to flip rectangles in picturebox?
Thanks
-
Aug 9th, 2011, 07:19 PM
#2
Re: Flip Rectangle
I'm pretty sure the Graphics class has the ability to Transform images.
-
Aug 10th, 2011, 02:17 AM
#3
Re: Flip Rectangle
 Originally Posted by shersu
Hi,
Could anyone tell me how to flip rectangles in picturebox?
Thanks
Use Image.RotateFlip. For example,
Code:
PictureBox1.Image.RotateFlip(RotateFlipType.RotateNoneFlipX)
PictureBox1.Invalidate()
Edit: Maybe I misread your question. If you are drawing the rectangles in the Paint event rather than setting the PictureBox.Image, then you need to go the way FormlessTree suggested. You can use a Matrix object with values (-1, -0, 0, 1, 0, 0) to flip the graphics horizontally or (1, 0, 0, -1, 0, 0) to do it vertically. See my reply in this thread post #9 for an example of using the matrix. BB
BB
Last edited by boops boops; Aug 10th, 2011 at 04:48 AM.
-
Aug 18th, 2011, 09:29 AM
#4
Thread Starter
Hyperactive Member
Re: Flip Rectangle
Here's my code so far:
Dim g As Graphics = pb.CreateGraphics()
Dim x As Integer = CInt(CurrentRecord(4))
Dim y As Integer = CInt(CurrentRecord(6))
Dim width As Integer = CInt(CurrentRecord(5))
Dim height As Integer = CInt(CurrentRecord(7))
Dim rect As New Rectangle(x, y, width, height)
Dim redPen As New Pen(Color.Black, 2)
g.DrawRectangle(redPen, rect)
Dim mtx As New Matrix
redPen.Dispose()
g.Dispose()
I want to flip the rectangle upside down.
Thanks
-
Aug 18th, 2011, 11:06 AM
#5
Re: Flip Rectangle
Flip the rectangle upside down? Rectangles have bilateral symmetry, a solid rectangle flipped upside down looks exactly the same as it did before the flip. You could rotate your rectangle by some degree, but flipping it upside down wouldn't do anything.
My usual boring signature: Nothing
 
-
Aug 18th, 2011, 05:51 PM
#6
Thread Starter
Hyperactive Member
Re: Flip Rectangle
Well, it's a cluster of rectangles placed in a particular order. That looks upside down. That's why I want to flip it.
Thanks
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
|