是这样的 ,我做了一个对话框,而且没有边框,现在,我想实现拉伸的效果,要什么方法呢?
  我将其style设置成resizing的时候,可以实现,但是,却出现了很薄的边框,我希望的效果是没有边框,并且可以实现拖动拉伸。

解决方案 »

  1.   

    google     WM_NCHITTEST 拉伸
      

  2.   

    把对话框边框风格设置成none然后添加 WM_NCHITTEST 消息响应函数测试鼠标位置
    如果靠近边框的话返回对应的代码
    HTBOTTOM In the lower-horizontal border of a resizable window (the user can click the mouse to resize the window vertically). 
    HTBOTTOMLEFT In the lower-left corner of a border of a resizable window (the user can click the mouse to resize the window diagonally). 
    HTBOTTOMRIGHT In the lower-right corner of a border of a resizable window (the user can click the mouse to resize the window diagonally). 基本上就是这样
      

  3.   


    UINT CMoveTestDlg::OnNcHitTest(CPoint point) 
    {
    // TODO: Add your message handler code here and/or call default
    CRect rc;
    CRect test;
    GetClientRect(&rc);
    test.left = rc.Width() - 5;
    test.right = rc.right;
    test.top = rc.Height() - 5;
    test.bottom = rc.bottom;
    ClientToScreen(&test);
    ClientToScreen(&rc);
    if(test.PtInRect(point))
    {
    return  HTBOTTOMRIGHT;
    }
    else
    {
    return rc.PtInRect(point) ? HTCAPTION : CDialog::OnNcHitTest(point);
    } return CDialog::OnNcHitTest(point);
    }花了十分钟帮你调试出来的,实现窗口的移动和改变大小(右下角),其它的类似!^_^
      

  4.   

    MoveWindow也是可以实现的,就不去实现了,楼主自己去弄了吧!
      

  5.   

    处理WM_NCHITTEST的响应:The WM_NCHITTEST message is sent to a window when the cursor moves, or when a mouse button is pressed or released. If the mouse is not captured, the message is sent to the window beneath the cursor. Otherwise, the message is sent to the window that has captured the mouse. 
      

  6.   

    把对话框边框风格设置成none后,运行程序,当鼠标移动到右下角确实有一个拉伸的光标,但是对话框拉不了