要解决这点,VB自身做不到,需要用到API函数
那个边框,其实是窗体样式的一种(WS_BORDER),用SetWindowLong修改GWL_STYLE即可。
Private DeclareFunction SetWindowLong Lib "user32" Alias "SetWindowLongA"(ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private ConstGWL_STYLE = (-16)
然后在窗体加载模块中加入:SetWindowLongMe.hwnd, GWL_STYLE, lStyleAndNotWS_SIZEBOX
这时,你的窗体就如你所愿了。
二,下面是间接达到目的的方法
1.另外做一个窗体form2 ,在form2中设置form1中需要的菜单。然后在form1中调用form2的右键菜单。
PrivateSubForm_MouseDown(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)
If Button=2Then
PopupMenu form2.PopMenu
EndIf
EndSub
2. 做一个用户自定义控件,然后添加到窗体中。靠用户自定义控件来实现你的隐式功能,不过这样就不是右键单击功能了,属于曲线救国的策略了。