| | |
| | | using HalconDotNet; |
| | | using Sunny.UI.Win32; |
| | | using System.Diagnostics; |
| | | using System.Windows.Forms; |
| | | |
| | | namespace LB_VisionControl |
| | | { |
| | | public delegate void Control_MouseDown(object sender, MouseEventArgs e); |
| | | public delegate void Control_MouseDoubleClick(object sender, MouseEventArgs e); |
| | | public partial class UserHSmartWindowControl : UserControl |
| | | { |
| | | public UserHSmartWindowControl() |
| | |
| | | // 设置默认字体为 20号 mono字体加粗 |
| | | set_display_font(this.hWindowControl.HalconWindow, 20, "mono", "true", "false"); |
| | | } |
| | | |
| | | public event Control_MouseDown event_MouseDown; |
| | | public event Control_MouseDoubleClick event_MouseDoubleClick; |
| | | private void event_mouseDown(object sender, MouseEventArgs e) |
| | | { |
| | | if (event_MouseDown != null) |
| | | { |
| | | event_MouseDown(sender, e); |
| | | } |
| | | } |
| | | private void event_mouseDoubleClick(object sender, MouseEventArgs e) |
| | | { |
| | | if (event_MouseDoubleClick != null) |
| | | { |
| | | event_MouseDoubleClick(sender, e); |
| | | } |
| | | } |
| | | private void UserHSmartWindowControl_Load(object sender, EventArgs e) |
| | | { |
| | | // 启用双缓冲减少闪烁 |
| | |
| | | default: |
| | | break; |
| | | } |
| | | MouseEventArgs mouseEventArgs = new MouseEventArgs(e.Button, e.Clicks, (int)e.X, (int)e.Y, e.Delta); |
| | | event_mouseDown(sender, mouseEventArgs); |
| | | } |
| | | catch { } |
| | | } |
| | |
| | | { |
| | | ShowHoImage(hImage); |
| | | } |
| | | |
| | | private void hWindowControl_HMouseDoubleClick(object sender, HMouseEventArgs e) |
| | | { |
| | | MouseEventArgs mouseEventArgs = new MouseEventArgs(e.Button, e.Clicks, (int)e.X, (int)e.Y, e.Delta); |
| | | event_mouseDoubleClick(sender, mouseEventArgs); |
| | | } |
| | | } |
| | | } |