我有一个包含价差的用户控件,并且我有此方法
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
,但如何在点差上单击双击。
答案 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