|
-
Nov 9th, 2015, 04:20 PM
#4
Re: Overlapping Pictureboxes when turning
I can't really take time to look at it right now as I'm at work, but I can tell obviously that it is using the "plgblt" type call to DrawImage in order to do the rotation.
Using the Graphics built in transform matrix would actually make this code a lot simpler, but it will take a bit of analysis to map the coordinates you're using for the parallelogram paradigm, to a single coordinate that you can center and rotate the Mover on.
As a quick fix for the existing code without changing the paradigm completely,
I would try setting all the picturebox's Visible property to false, and draw the image on the form myself in the Paint Event.
Are these pictureboxes in a panel, or on a form?
Assuming a Form, If you call Invalidate() or Me.Invalidate() at the end of each sub, the form should refresh by triggering the Paint Event handler.
In the paint event handler, you should be able to use the position of all the pictureboxes you are moving invisibly around, and DrawImage to draw the image yourself on your form. The advantage, is that you're not using the false transparency of the picturebox, you will be drawing with the true transparancy that is in your image.
Code:
Private Sub Form1_Paint(sender As Object, e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Dim g As Graphics = e.Graphics
g.DrawImage(PbAs6.Image, PbAs6.Location)
g.DrawImage(PbAs7.Image, PbAs7.Location)
g.DrawImage(PbAs8.Image, PbAs8.Location)
End Sub
Last edited by passel; Nov 9th, 2015 at 04:25 PM.
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
|