鼠标双击带有电子表格的用户控件上的Windowsformhost

时间:2019-05-03 20:51:54

标签: wpf vb.net user-controls

我有一个包含价差的用户控件,并且我有此方法

Public Event DOBLECLICK()
Public Sub sp1_CellDoubleClick(sender As Object, e As FarPoint.Win.Spread.CellClickEventArgs)
        RaiseEvent DOBLECLICK()
End Sub

以及函数mainwindow.xaml中的MainWindow_Loaded中,我有:

AddHandler host.sp1.CellDoubleClick, AddressOf host.sp1_CellDoubleClick

我的问题是,我该如何使用双击事件,当单击时我隐藏了Windowsformhost,我知道我可以将其隐藏 WinFormsHost.Visibility = Windows.Visibility.Hidden,但如何在点差上单击双击。

1 个答案:

答案 0 :(得分:0)

最终我明白了,

在用户控件中输入以下内容:

Public Event Dobleclick()

Private Sub sp1_CellDoubleClick(sender As Object, e As FarPoint.Win.Spread.CellClickEventArgs) Handles spEmpresas.CellDoubleClick
        RaiseEvent Dobleclick()
End Sub

并在MainWindow.xaml中:

Imports nameofyourprogram.Control
Public Class MainWindow
Dim host As New nameofyourprogram.Control

Public Sub MainWindow_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded


AddHandler host.Dobleclick, AddressOf doubleclick

end sub

Sub doubleclick()
 msgbox("now you can work whit and event in your mainwindow ")
 'after this message i want to hide my windownforhost
 WinFormsHost.Visibility = Windows.Visibility.Hidden
end sub

End Class