2011/08/31(Wed) 23:32:35 編集(投稿者)
Trans使った例です。
Private dx As Single = 0.0!
Private dy As Single = 0.0!
Private zm As Single = 1.0!
Private Sub PictureBox1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
Dim pos = PictureBox1.PointToClient(Control.MousePosition)
Dim x1 = pos.X
Dim y1 = pos.Y
dx += ((PictureBox1.Width) / 2 - pos.X) / zm
dy += ((PictureBox1.Height) / 2 - pos.Y) / zm
zm = (((zm - 0.75!) * 4) Mod 10) * 0.25! + 1.0!
PictureBox1.Invalidate()
End Sub
Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
Dim grp = e.Graphics
grp.Clear(Color.White)
grp.ScaleTransform(zm, zm)
grp.TranslateTransform((PictureBox1.Width / 2) * (1 - zm) / zm + dx, (PictureBox1.Height / 2) * (1 - zm) / zm + dy)
Using brs = New Drawing2D.LinearGradientBrush(New Point(0, 0), New Point(20, 20), Color.Blue, Color.Green)
grp.FillRectangle(brs, (PictureBox1.Width \ 8) * 3, (PictureBox1.Height \ 8) * 3, PictureBox1.Width \ 4, PictureBox1.Height \ 4)
End Using
grp.ResetTransform()
grp.DrawLine(Pens.Red, 0, PictureBox1.Height \ 2, PictureBox1.Width, PictureBox1.Height \ 2)
grp.DrawLine(Pens.Red, PictureBox1.Width \ 2, 0, PictureBox1.Width \ 2, PictureBox1.Height)
End Sub