diff --git a/MCPixelArtCrafter/Controls/PictureBoxPAZ.vb b/MCPixelArtCrafter/Controls/PictureBoxPAZ.vb
index 3f26971..10a1618 100644
--- a/MCPixelArtCrafter/Controls/PictureBoxPAZ.vb
+++ b/MCPixelArtCrafter/Controls/PictureBoxPAZ.vb
@@ -61,7 +61,7 @@ Public Class PictureBoxPAZ
End Set
End Property
- Protected ReadOnly Property ImageSize() As Size
+ Protected ReadOnly Property ImageSize As Size
Get
Return New Size(CInt(Math.Round(Image.Size.Width * _zoomScale)), CInt(Math.Round(Image.Size.Height * _zoomScale)))
End Get
@@ -80,7 +80,11 @@ Public Class PictureBoxPAZ
''' Grid spacing (0-No grid)
'''
Public Property GridSpacing As Integer = 0
-
+ Public ReadOnly Property OriginPos As Point
+ Get
+ Return New Point(tX, tY)
+ End Get
+ End Property
Public ReadOnly Property MousePos As Point
Get
Dim CP = PointToClient(MousePosition)
@@ -217,11 +221,11 @@ Public Class PictureBoxPAZ
If Image IsNot Nothing AndAlso _zoomScale <> newZoom Then
'fixPoint.X = Math.Min(fixPoint.X, CInt((Me.Image.Size.Width * _zoomScale)))
'fixPoint.Y = Math.Min(fixPoint.Y, CInt((Me.Image.Size.Height * _zoomScale)))
- Dim shiftX As Integer = (fixPoint.X * (newZoom - _zoomScale) / newZoom / _zoomScale)
- Dim shiftY As Integer = (fixPoint.Y * (newZoom - _zoomScale) / newZoom / _zoomScale)
+ Dim shiftX As Integer = -((fixPoint.X - tX) / _zoomScale * (newZoom - _zoomScale))
+ Dim shiftY As Integer = -((fixPoint.Y - tY) / _zoomScale * (newZoom - _zoomScale))
_zoomScale = newZoom
- tX += -shiftX
- tY += -shiftY
+ tX += shiftX
+ tY += shiftY
CheckT()
Invalidate()
End If
diff --git a/MCPixelArtCrafter/Forms/MapPreview.Designer.vb b/MCPixelArtCrafter/Forms/MapPreview.Designer.vb
index 38a0517..bfa6c18 100644
--- a/MCPixelArtCrafter/Forms/MapPreview.Designer.vb
+++ b/MCPixelArtCrafter/Forms/MapPreview.Designer.vb
@@ -30,11 +30,14 @@ Partial Class MapPreview
Me.B_Save = New System.Windows.Forms.Button()
Me.SFD = New System.Windows.Forms.SaveFileDialog()
Me.CB_Grid = New System.Windows.Forms.CheckBox()
+ Me.StatusStrip1 = New System.Windows.Forms.StatusStrip()
+ Me.TS_MousePos = New System.Windows.Forms.ToolStripStatusLabel()
CType(Me.SplitContainer1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SplitContainer1.Panel1.SuspendLayout()
Me.SplitContainer1.Panel2.SuspendLayout()
Me.SplitContainer1.SuspendLayout()
CType(Me.PB, System.ComponentModel.ISupportInitialize).BeginInit()
+ Me.StatusStrip1.SuspendLayout()
Me.SuspendLayout()
'
'FLP_UsedColors
@@ -65,8 +68,8 @@ Partial Class MapPreview
'SplitContainer1.Panel2
'
Me.SplitContainer1.Panel2.Controls.Add(Me.FLP_UsedColors)
- Me.SplitContainer1.Size = New System.Drawing.Size(848, 453)
- Me.SplitContainer1.SplitterDistance = 353
+ Me.SplitContainer1.Size = New System.Drawing.Size(848, 450)
+ Me.SplitContainer1.SplitterDistance = 350
Me.SplitContainer1.SplitterWidth = 6
Me.SplitContainer1.TabIndex = 0
'
@@ -80,7 +83,7 @@ Partial Class MapPreview
Me.PB.Location = New System.Drawing.Point(0, 0)
Me.PB.Name = "PB"
Me.PB.ShowGrid = False
- Me.PB.Size = New System.Drawing.Size(846, 351)
+ Me.PB.Size = New System.Drawing.Size(846, 348)
Me.PB.TabIndex = 0
Me.PB.TabStop = False
'
@@ -91,7 +94,7 @@ Partial Class MapPreview
'B_Save
'
Me.B_Save.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
- Me.B_Save.Location = New System.Drawing.Point(782, 478)
+ Me.B_Save.Location = New System.Drawing.Point(781, 475)
Me.B_Save.Name = "B_Save"
Me.B_Save.Size = New System.Drawing.Size(78, 23)
Me.B_Save.TabIndex = 1
@@ -106,19 +109,35 @@ Partial Class MapPreview
'
Me.CB_Grid.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.CB_Grid.AutoSize = True
- Me.CB_Grid.Location = New System.Drawing.Point(13, 484)
+ Me.CB_Grid.Location = New System.Drawing.Point(13, 481)
Me.CB_Grid.Name = "CB_Grid"
Me.CB_Grid.Size = New System.Drawing.Size(75, 17)
Me.CB_Grid.TabIndex = 2
Me.CB_Grid.Text = "Show Grid"
Me.CB_Grid.UseVisualStyleBackColor = True
'
+ 'StatusStrip1
+ '
+ Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.TS_MousePos})
+ Me.StatusStrip1.Location = New System.Drawing.Point(0, 501)
+ Me.StatusStrip1.Name = "StatusStrip1"
+ Me.StatusStrip1.Size = New System.Drawing.Size(872, 22)
+ Me.StatusStrip1.TabIndex = 3
+ Me.StatusStrip1.Text = "StatusStrip1"
+ '
+ 'TS_MousePos
+ '
+ Me.TS_MousePos.Name = "TS_MousePos"
+ Me.TS_MousePos.Size = New System.Drawing.Size(33, 17)
+ Me.TS_MousePos.Text = "X: |Y:"
+ '
'MapPreview
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.BackColor = System.Drawing.SystemColors.Window
- Me.ClientSize = New System.Drawing.Size(872, 513)
+ Me.ClientSize = New System.Drawing.Size(872, 523)
+ Me.Controls.Add(Me.StatusStrip1)
Me.Controls.Add(Me.CB_Grid)
Me.Controls.Add(Me.B_Save)
Me.Controls.Add(Me.SplitContainer1)
@@ -130,6 +149,8 @@ Partial Class MapPreview
CType(Me.SplitContainer1, System.ComponentModel.ISupportInitialize).EndInit()
Me.SplitContainer1.ResumeLayout(False)
CType(Me.PB, System.ComponentModel.ISupportInitialize).EndInit()
+ Me.StatusStrip1.ResumeLayout(False)
+ Me.StatusStrip1.PerformLayout()
Me.ResumeLayout(False)
Me.PerformLayout()
@@ -142,4 +163,6 @@ Partial Class MapPreview
Friend WithEvents B_Save As Button
Friend WithEvents SFD As SaveFileDialog
Friend WithEvents CB_Grid As CheckBox
+ Friend WithEvents StatusStrip1 As StatusStrip
+ Friend WithEvents TS_MousePos As ToolStripStatusLabel
End Class
diff --git a/MCPixelArtCrafter/Forms/MapPreview.resx b/MCPixelArtCrafter/Forms/MapPreview.resx
index 0e80f9d..6ce39e9 100644
--- a/MCPixelArtCrafter/Forms/MapPreview.resx
+++ b/MCPixelArtCrafter/Forms/MapPreview.resx
@@ -123,4 +123,7 @@
116, 17
+
+ 189, 17
+
\ No newline at end of file
diff --git a/MCPixelArtCrafter/Forms/MapPreview.vb b/MCPixelArtCrafter/Forms/MapPreview.vb
index a29fe73..b4e3088 100644
--- a/MCPixelArtCrafter/Forms/MapPreview.vb
+++ b/MCPixelArtCrafter/Forms/MapPreview.vb
@@ -33,4 +33,8 @@ Public Class MapPreview
Private Sub PB_Click(sender As Object, e As EventArgs) Handles PB.Click
Console.WriteLine(PB.MousePos.ToString)
End Sub
+
+ Private Sub PB_MouseMove(sender As Object, e As MouseEventArgs) Handles PB.MouseMove
+ TS_MousePos.Text = String.Format("X:{0}|Y:{1}", PB.MousePos.X, PB.MousePos.Y)
+ End Sub
End Class
\ No newline at end of file