您的位置:程序门 -> .net技术 -> c#



如何锁定mdi子窗体的位置,为什么用location=new point(0,0)不起作用?


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


如何锁定mdi子窗体的位置,为什么用location=new point(0,0)不起作用?[已结贴,结贴人:clrclr]
发表于:2007-01-12 13:27:34 楼主
如何锁定mdi子窗体的位置,为什么用location=new   point(0,0)不起作用?
请问有什么好的方法?
发表于:2007-01-12 14:29:291楼 得分:5
需要把startposition设置为manual即可...
发表于:2007-01-12 14:48:582楼 得分:5
同上
发表于:2007-01-12 14:53:333楼 得分:20
this.setbounds
发表于:2007-01-12 14:57:204楼 得分:15
要想让窗体显示后不可移动(锁定位置)可以参考下代码来操作(用api):

[dllimport( "user32.dll ")]
public   static   extern   int   getsystemmenu(int   hwnd,   int   brevert);
[dllimport( "user32.dll ")]
public   static   extern   int   removemenu(int   hmenu,   int   nposition,   int   wflags);

public   const   int   mf_bycommand   =   0x00000000;
public   const   int   mf_disabled   =   0x00000002;
public   const   int   mf_grayed   =   0x00000001;
public   const   int   sc_move   =   0xf010;

protected   override   void   onload(eventargs   e)
{
int   hmenu;
hmenu   =   getsystemmenu(this.handle.toint32(),   0);
//移动菜单
removemenu(hmenu,   sc_move,   mf_bycommand   ¦   mf_disabled   ¦   mf_grayed);      
}
发表于:2007-01-12 15:10:415楼 得分:5
hbxtlhx方法好。我最近也才发现这个方法的。不过是vc下用的。这样是比较完美的禁止移动的方法了。


快速检索

最新资讯
热门点击