Hello,
just a simple sample, to show you my topic. I have a canvas around which a frame is drawn and on the right side, with a width of 20 pixels, a “button”.
Now I want a popup menu to appear just below the button when you click on the drawn “button”. This code, however, makes the menu appear in the wrong place. How do I calculate the coordinates correctly?
[h]Canvas1.MouseDown[/h]
Return True
[h]Canvas1.MouseUp[/h]
[code]If X >= Me.Width - 20 And X <= Me.Width Then
Dim base As New MenuItem
base.Append(New MenuItem(“Import”))
base.Append(New MenuItem(“Export”))
base.Append(New MenuItem(MenuItem.TextSeparator))
base.Append(New MenuItem(“Cut”))
base.Append(New MenuItem(“Copy”))
base.Append(New MenuItem(“Paste”))
Dim popup As MenuItem = base.PopUp(x, y) // Calculation
End If[/code]
[h]Canvas1.Paint[/h]
g.DrawRect(0, 0, g.Width, g.Height)
g.FillRect(g.Width - 20, 0, 20, g.Height)