Browse Source

properties window size correctly on dpi change, don't use built in sizer

scott brogden 8 years ago
parent
commit
0debdad011
2 changed files with 21 additions and 3 deletions
  1. 19 3
      CopyProperties.cpp
  2. 2 0
      CopyProperties.h

+ 19 - 3
CopyProperties.cpp

@@ -65,6 +65,7 @@ BEGIN_MESSAGE_MAP(CCopyProperties, CDialog)
 	//}}AFX_MSG_MAP
 	ON_WM_CTLCOLOR()
 	ON_LBN_SELCHANGE(IDC_COPY_DATA, &CCopyProperties::OnLbnSelchangeCopyData)
+	ON_WM_NCLBUTTONDOWN()
 END_MESSAGE_MAP()
 
 /////////////////////////////////////////////////////////////////////////////
@@ -494,11 +495,13 @@ void CCopyProperties::OnSize(UINT nType, int cx, int cy)
 {
 	CDialog::OnSize(nType, cx, cy);
 	
-
-	m_Resize.MoveControls(CSize(cx, cy));
+	if (((GetKeyState(VK_LBUTTON) & 0x100) != 0) &&
+		m_mouseDownOnCaption == false)
+	{
+		m_Resize.MoveControls(CSize(cx, cy));
+	}
 }
 
-
 HBRUSH CCopyProperties::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
 {
 	HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
@@ -574,3 +577,16 @@ void CCopyProperties::OnLbnSelchangeCopyData()
 		}
 	}
 }
+
+
+void CCopyProperties::OnNcLButtonDown(UINT nHitTest, CPoint point)
+{
+	m_mouseDownOnCaption = false;
+
+	if (nHitTest == HTCAPTION)
+	{
+		m_mouseDownOnCaption = true;
+	}
+
+	CDialog::OnNcLButtonDown(nHitTest, point);
+}

+ 2 - 0
CopyProperties.h

@@ -66,6 +66,7 @@ protected:
 	CClip *m_pMemoryClip;
 	CBrush m_brush;
 	CClip m_clip;
+	bool m_mouseDownOnCaption;
 
 	void LoadDataIntoCClip(CClip &Clip);
 	void LoadDataFromCClip(CClip &Clip);
@@ -85,6 +86,7 @@ protected:
 public:
 	afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
 	afx_msg void OnLbnSelchangeCopyData();
+	afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point);
 };
 
 //{{AFX_INSERT_LOCATION}}