11-10-2008 09:20 AM - edited 11-10-2008 09:24 AM
Hi,
I am using C# .net. I want to use the mouse to select a region from the source image for mask. How can I get the Left, Top, Width, Height values by mouse selected on the source image.
axCWIMAQViewer.Regions.RemoveAll();
axCWIMAQViewer.Region.GetRegionData(); //????
Greetings.
Solved! Go to Solution.
11-11-2008 03:44 AM
Look in google and search for mouse coordinate - you find something like that
http://www.mycsharp.de/wbb2/thread.php?threadid=61761
Private Sub Form2_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
Dim x, y As Integer
x = Me.MousePosition.X - (Me.Location.X + 4) '+4 wegen den rändern der form
y = Me.MousePosition.Y - (Me.Location.Y + 30) '+30 wegen der titelleiste und dem unteren rahmen
Form1.PictureBox1.Location = New System.Drawing.Point(x, y)
End Sub
Or use this:
Control.PointToScreen und Control.PointToClient
When i create a mouse event in my Visual Studion 2005 C# project i can work with x and y values:
private void axCWIMAQViewer1_MouseDownEvent(object sender, AxNationalInstruments.CWIMAQControls._DCWIMAQViewerEvents_MouseDownEvent e)
{
e.x //x coordinates
}
Please give me feedback if the help suggestions help you to work with mouse coordinates
11-12-2008 10:28 AM
hi there,
I use axCWIMAQViewer1_MouseDownEvent, axCWIMAQViewer1_MouseMoveEvent, axCWIMAQViewer1_MouseUpEvent to get the ROI by mouse selected.
It works fine.
Thanks for the info.
Greetings.