This repository has been archived by the owner on Sep 11, 2023. It is now read-only.
/
MyPopupMenu.vb
69 lines (56 loc) · 1.62 KB
/
MyPopupMenu.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports DevExpress.Utils.Menu
Imports DevExpress.XtraEditors
Namespace WindowsApplication1
Public Class MyPopupControl
Implements IDXDropDownControl
Public Sub New(ByVal customControl As Control)
InitPopupForm(customControl)
End Sub
Private Sub InitPopupForm(ByVal customControl As Control)
_Form = New Form()
_Form.FormBorderStyle = FormBorderStyle.None
_Form.BackColor = Color.Black
AddHandler _Form.Deactivate, AddressOf _Form_Deactivate
Dim gc As New GroupControl()
gc.Dock = DockStyle.Fill
gc.Text = "Custom popup window"
_Form.Controls.Add(gc)
customControl.Dock = DockStyle.Fill
gc.Controls.Add(customControl)
End Sub
Private Sub _Form_Deactivate(ByVal sender As Object, ByVal e As EventArgs)
_Form.Hide()
End Sub
Private _Form As Form
Public Property Form() As Form
Get
Return _Form
End Get
Set(ByVal value As Form)
_Form = value
End Set
End Property
#Region "IDXDropDownControl Members"
Private Sub Hide() Implements IDXDropDownControl.Hide
Form.Hide()
End Sub
Private Sub Show(ByVal manager As IDXMenuManager, ByVal control As Control, ByVal pos As Point) Implements IDXDropDownControl.Show
Form.Show()
Form.Location = control.PointToScreen(pos)
End Sub
Private ReadOnly Property Visible() As Boolean Implements IDXDropDownControl.Visible
Get
Return Form.Visible
End Get
End Property
#End Region
End Class
End Namespace