2010-06-17 61 views

回答

1

據我所知,contextMenuStrips沒有「位置」字段。甲位置被設置一旦它示出像這樣:

Dim thePoint As Point = (New System.Drawing.Point(someXValue, someYValue)) 
ContextMenuStrip1.Show(PictureBox1.PointToScreen(thePoint)) 

上述代碼建立一個點,並且如被示出的的ContextMenuStrip,其分配的位置向右然後。如果您想要在調用show()後檢索contextMenuStrip的位置,則可以投射對象並像這樣檢索位置

MessageBox.Show(DirectCast(ContextMenuStrip1, ToolStrip).Location.Y)