Could you tell me, if I may ask, what kind of control in the planning stage did you use?
I used a panel that sends the x and y position to the manager, and works great.
In my project I have 3 panel then, one who sends it to the manager the x and y position (X Pos and Y Pos) and this works fine.
Then I have 2 other panel to the position of one X and one Y.
In widget can individually set the position of X and Y in the respective XYPanel.
But in vb.net how can I set the x and y position of the relevant panel by moving the panel that handles the x and y?
I have been clear enough? ehhhhhh
Thank you, Alberto
My code:
- Code: Select all
Private Sub Panel1_MouseMove(sender As Object, e As MouseEventArgs) Handles Panel1.MouseMove
Dim deltaX As Double, deltaY As Double
Dim larghezza As Double = CDbl(XMin.Text) * 2
Dim altezza As Double = CDbl(YMin.Text) * 2
deltaX = (larghezza / CDbl(Panel1.Width))
deltaY = (altezza / CDbl(Panel1.Height))
Dim point As Point = Panel1.PointToClient(Cursor.Position)
If CheckInfo.Checked = True Then
lblPanelData.Visible = True
Else
lblPanelData.Visible = False
End If
If chkMouseOver.Checked = True Then
AutoSetParamDouble(numDev1.Value, numDev2.Value, "X Pos", Math.Round((point.X * deltaX), 3) - CDbl(XMin.Text))
AutoSetParamDouble(numDev1.Value, numDev2.Value, "Y Pos", -Math.Round((point.Y * deltaY), 3) + CDbl(YMin.Text))
Else
If e.Button = Windows.Forms.MouseButtons.Left Then
AutoSetParamDouble(numDev1.Value, numDev2.Value, "X Pos", Math.Round((point.X * deltaX), 3) - CDbl(XMin.Text))
AutoSetParamDouble(numDev1.Value, numDev2.Value, "Y Pos", -Math.Round((point.Y * deltaY), 3) + CDbl(YMin.Text))
End If
End If
lblPanelData.Text = "Mousepoint: " & point.X & "," & point.Y & vbCrLf &
"Mousepointdelta: " & Math.Round((point.X * deltaX), 0) & "," & Math.Round((point.Y * deltaY), 0) & vbCrLf &
"XPos: " & Math.Round((point.X * deltaX), 3) - CDbl(XMin.Text) & vbCrLf &
"YPos: " & -Math.Round((point.Y * deltaY), 3) + CDbl(YMin.Text) & vbCrLf &
"Panel: " & Panel1.Width & "," & Panel1.Height
End Sub