xref: /MusicPlayer2/MusicPlayer2/ColorStaticEx.cpp (revision 877f5f92b251a01591a4960c885129aa589a8135)
1 #include "stdafx.h"
2 #include "ColorStaticEx.h"
3 
4 
CColorStaticEx()5 CColorStaticEx::CColorStaticEx()
6 {
7 }
8 
9 
~CColorStaticEx()10 CColorStaticEx::~CColorStaticEx()
11 {
12 }
13 
14 
GetFillColor() const15 COLORREF CColorStaticEx::GetFillColor() const
16 {
17 	return m_fill_color;
18 }
19 
PreSubclassWindow()20 void CColorStaticEx::PreSubclassWindow()
21 {
22 	// TODO: 在此添加专用代码和/或调用基类
23 	DWORD dwStyle = GetStyle();
24 	::SetWindowLong(GetSafeHwnd(), GWL_STYLE, dwStyle | SS_NOTIFY);
25 
26 	CColorStatic::PreSubclassWindow();
27 }
BEGIN_MESSAGE_MAP(CColorStaticEx,CColorStatic)28 BEGIN_MESSAGE_MAP(CColorStaticEx, CColorStatic)
29 //	ON_CONTROL_REFLECT(STN_CLICKED, &CColorStaticEx::OnStnClicked)
30 	ON_WM_LBUTTONUP()
31 END_MESSAGE_MAP()
32 
33 
34 //void CColorStaticEx::OnStnClicked()
35 //{
36 //	// TODO: 在此添加控件通知处理程序代码
37 //}
38 
39 
40 void CColorStaticEx::OnLButtonUp(UINT nFlags, CPoint point)
41 {
42 	// TODO: 在此添加消息处理程序代码和/或调用默认值
43 	CColorDialog color_dlg(m_fill_color);
44 	if (color_dlg.DoModal() == IDOK)
45 	{
46 		SetFillColor(color_dlg.GetColor());
47 
48         //向父窗口发送WM_COLOR_SELECTED消息
49         CWnd* pParent = GetParent();
50         if(pParent!=nullptr)
51             ::SendMessage(pParent->GetSafeHwnd(), WM_COLOR_SELECTED, (WPARAM)this, 0);
52 	}
53 
54 	CColorStatic::OnLButtonUp(nFlags, point);
55 }
56