Hi,
Could anyone tell me how to flip rectangles in picturebox?
Thanks
Printable View
Hi,
Could anyone tell me how to flip rectangles in picturebox?
Thanks
This might be of help to you :
http://www.codeguru.com/vb/gen/vb_gr...le.php/c14007/
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
You would have to know the SCALE of the view
Scaling is all fine. I only have to turn it upside down.
Thanks
Didn't you read the link I sent you Shers? In there I cover Rotation and Flipping
I went through the link and found that it's only for image rotation. My problem is rectangle flip vertical.
I'm attaching an image. If I change the y in
Dim rect As New Rectangle(x, y, width, height) to
Dim rect As New Rectangle(x, -y, width, height), I still see no change in the image. I drew a line to see how it works, and it still is below the line
Thanks
Firstly a recatangle no mater flipped which way will always look the same ... However if your trying to flip the image inside the rectangle the section titled Rotation on page two of Hanne's article is what your looking for... and you can use any of these options
It is nothing concerning image. I'm only drawing rectangles. A looping through results in a cluster of small and big rectangles which looks in an orderly manner. I want the final result to be flipped vertical as a whole, or flip each rectangle while looping through. That's what I tried, but looks like there's no change, as I drew a line to see where it is placed, but how much ever change I do, it still is below the line.
Thanks
Ahhh .... http://forums.codeguru.com/images/ie.../2011/08/1.gif
You not Flipping anything.... All you want to do is shift the position of the rectangle ..
Now you can change Ycenter to where you want the 'Illusion' of the flip to take place...Code:Dim Ycenter as integer = 0
Dim rect As New Rectangle(x, Ycenter- (y + height), width, height)
This why questions should be asked properly upfront, to avoid confusion ;)