当前位置: 代码迷 >> 综合 >> 2014.03.21 MFC 设置窗体透明
  详细解决方案

2014.03.21 MFC 设置窗体透明

热度:35   发布时间:2024-01-20 11:03:59.0

1、MFC 设置窗体透明 

SetWindowLong(this->GetSafeHwnd(),GWL_EXSTYLE,GetWindowLong(this->GetSafeHwnd(),GWL_EXSTYLE)^0x80000);

SetLayeredWindowAttributes(0,100,LWA_ALPHA);


2、 无标题栏时拖动问题

LRESULT CNoteDlg::OnNcHitTest(CPoint point)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
CRect rc;
GetClientRect(&rc);
ClientToScreen(&rc);
return rc.PtInRect(point) ? HTCAPTION : CDialog::OnNcHitTest(point);




//return CDialogEx::OnNcHitTest(point);


}