movewindow_mfc movewindow_setwindowpos

电脑杂谈  发布时间:2017-01-09 16:00:46  来源:网络整理

setwindowpos_mfc movewindow_movewindow

movewindow

MoveWindow()这个函数的作用:Changes the window's size and position.

参数有两种:BOOL MoveWindow(int x,int y,int nWidth,int nHeight,BOOL bRepaint = TRUE ) x,y为左上角顶点坐标

BOOL MoveWindow(LPCRECT lpRect,BOOL bRepaint = TRUE )

强调:哪个对象(窗体)或指向该对象的指针调用了MoveWindow(),那么就改变该对象(窗体)的大小、位置

举例如下:CMSGOPT *temp=new CMSGOPT;

movewindow_mfc movewindow_setwindowpos

temp->Create(IDD_DLG_MAIN,this);

temp->ShowWindow(SW_SHOW);

CRect rc;

temp->GetWindowRect(&rc);//注意与this->GetWindowRect(&rc);区别。movewindow

//temp->MoveWindow((1024-rc.Width())/2,0,rc.Width(),rc.Height(),1);//居中显示,改变了位置

setwindowpos_movewindow_mfc movewindow

rc.left=(1024-rc.Width())/2;

rc.right=rc.left+500;

rc.top=0;

rc.bottom=rc.top+500;

temp->MoveWindow(&rc,true);//改变了大小与位置

temp->UpdateWindow();


本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/jisuanjixue/article-25211-1.html

    相关阅读
      发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

      • 陈文帝陈蒨
        陈文帝陈蒨

        也行

      • 陈康伯
        陈康伯

        这不正好给了中国军事建设南海岛礁的口实么

      热点图片
      拼命载入中...