DLineDlg2.cpp 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368
  1. // DLineDlg2.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "EastDraw.h"
  5. #include "DLineDlg2.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CDLineDlg2 property page
  13. IMPLEMENT_DYNCREATE(CDLineDlg2, CPropertyPage)
  14. #include "CUnit.h"
  15. #include <afxdlgs.h>
  16. CDLineDlg2::CDLineDlg2() : CPropertyPage(CDLineDlg2::IDD)
  17. {
  18. //{{AFX_DATA_INIT(CDLineDlg2)
  19. m_Blue = 0;
  20. m_Green = 0;
  21. m_Red = 0;
  22. //}}AFX_DATA_INIT
  23. m_Color=RGB(0,0,0);
  24. m_PenColor=RGB(0,0,0);
  25. m_BrushColor=RGB(255,255,255);
  26. m_BackgroundColor=RGB(255,255,255);
  27. }
  28. CDLineDlg2::~CDLineDlg2()
  29. {
  30. }
  31. void CDLineDlg2::DoDataExchange(CDataExchange* pDX)
  32. {
  33. CPropertyPage::DoDataExchange(pDX);
  34. //{{AFX_DATA_MAP(CDLineDlg2)
  35. DDX_Control(pDX, IDC_CHECK_Pen, m_Check_Pen);
  36. DDX_Control(pDX, IDC_CHECK_Brush, m_Check_Brush);
  37. DDX_Control(pDX, IDC_CHECK_Background, m_Check_Background);
  38. DDX_Control(pDX, IDC_ShowBrushColor, m_Static_ShowBrushColor);
  39. DDX_Control(pDX, IDC_ShowBackground, m_Static_ShowBackgroundColor);
  40. DDX_Control(pDX, IDC_ShowPenColor, m_Static_ShowPenColor);
  41. DDX_Control(pDX, IDC_SPIN_Red, m_Spin_Red);
  42. DDX_Control(pDX, IDC_SPIN_Green, m_Spin_Green);
  43. DDX_Control(pDX, IDC_SPIN_Blue, m_Spin_Blue);
  44. DDX_Control(pDX, IDC_EDIT_Red, m_Edit_Red);
  45. DDX_Control(pDX, IDC_EDIT_Green, m_Edit_Green);
  46. DDX_Control(pDX, IDC_EDIT_Blue, m_Edit_Blue);
  47. DDX_Control(pDX, IDC_SLIDER_Red, m_Slider_Red);
  48. DDX_Control(pDX, IDC_SLIDER_Green, m_Slider_Green);
  49. DDX_Control(pDX, IDC_SLIDER_Blue, m_Slider_Blue);
  50. DDX_Control(pDX, IDC_STATIC_ShowColor, m_CStatic_ShowColor);
  51. DDX_Text(pDX, IDC_EDIT_Blue, m_Blue);
  52. DDX_Text(pDX, IDC_EDIT_Green, m_Green);
  53. DDX_Text(pDX, IDC_EDIT_Red, m_Red);
  54. //}}AFX_DATA_MAP
  55. }
  56. BEGIN_MESSAGE_MAP(CDLineDlg2, CPropertyPage)
  57. //{{AFX_MSG_MAP(CDLineDlg2)
  58. ON_BN_CLICKED(IDC_STATIC_Black, OnSTATICBlack)
  59. ON_BN_CLICKED(IDC_STATIC_Red, OnSTATICRed)
  60. ON_BN_CLICKED(IDC_STATIC_DarkGray, OnSTATICDarkGray)
  61. ON_BN_CLICKED(IDC_STATIC_LightRray, OnSTATICLightRray)
  62. ON_BN_CLICKED(IDC_STATIC_White, OnSTATICWhite)
  63. ON_BN_CLICKED(IDC_STATIC_DrakBlue, OnSTATICDrakBlue)
  64. ON_BN_CLICKED(IDC_STATIC_Blue, OnSTATICBlue)
  65. ON_BN_CLICKED(IDC_STATIC_Green, OnSTATICGreen)
  66. ON_BN_CLICKED(IDC_STATIC_DrakGreen, OnSTATICDrakGreen)
  67. ON_BN_CLICKED(IDC_STATIC_Yellow, OnSTATICYellow)
  68. ON_BN_CLICKED(IDC_STATIC_RarkRed, OnSTATICRarkRed)
  69. ON_BN_CLICKED(IDC_STATIC_BITMAP6, OnStaticBitmap6)
  70. ON_BN_CLICKED(IDC_STATIC_BITMAP5, OnStaticBitmap5)
  71. ON_BN_CLICKED(IDC_STATIC_DarkYellow, OnSTATICDarkYellow)
  72. ON_BN_CLICKED(IDC_STATIC_BITMAP10, OnStaticBitmap10)
  73. ON_BN_CLICKED(IDC_STATIC_BITMAP9, OnStaticBitmap9)
  74. ON_WM_PAINT()
  75. ON_WM_HSCROLL()
  76. ON_BN_CLICKED(IDC_BUTTON_Select, OnBUTTONSelect)
  77. ON_BN_CLICKED(IDC_BUTTON_ColorDlg, OnBUTTONColorDlg)
  78. ON_BN_CLICKED(IDC_CHECK_Pen, OnCHECKPen)
  79. ON_BN_CLICKED(IDC_CHECK_Brush, OnCHECKBrush)
  80. ON_BN_CLICKED(IDC_CHECK_Background, OnCHECKBackground)
  81. ON_WM_CTLCOLOR()
  82. //}}AFX_MSG_MAP
  83. END_MESSAGE_MAP()
  84. /////////////////////////////////////////////////////////////////////////////
  85. // CDLineDlg2 message handlers
  86. void CDLineDlg2::OnSTATICBlack()
  87. {
  88. // TODO: Add your control notification handler code here
  89. m_Color=RGB(0,0,0);
  90. CDC * pDC;
  91. CBrush brush;
  92. CRect rect;
  93. pDC=m_CStatic_ShowColor.GetDC();
  94. m_CStatic_ShowColor.GetClientRect(&rect);
  95. brush.CreateSolidBrush(m_Color);
  96. pDC->FillRect(&rect,&brush);
  97. brush.DeleteObject();
  98. m_CStatic_ShowColor.ReleaseDC(pDC);
  99. if(m_Check_Pen.GetCheck()==BST_CHECKED)
  100. {
  101. pDC=m_Static_ShowPenColor.GetDC();
  102. m_Static_ShowPenColor.GetClientRect(&rect);
  103. m_PenColor=m_Color;
  104. brush.CreateSolidBrush(m_PenColor);
  105. pDC->FillRect(&rect,&brush);
  106. brush.DeleteObject();
  107. m_Static_ShowPenColor.ReleaseDC(pDC);
  108. }
  109. if(m_Check_Brush.GetCheck()==BST_CHECKED)
  110. {
  111. pDC=m_Static_ShowBrushColor.GetDC();
  112. m_Static_ShowBrushColor.GetClientRect(&rect);
  113. m_BrushColor=m_Color;
  114. brush.CreateSolidBrush(m_BrushColor);
  115. pDC->FillRect(&rect,&brush);
  116. brush.DeleteObject();
  117. m_Static_ShowBrushColor.ReleaseDC(pDC);
  118. }
  119. if(m_Check_Background.GetCheck()==BST_CHECKED)
  120. {
  121. pDC=m_Static_ShowBackgroundColor.GetDC();
  122. m_Static_ShowBackgroundColor.GetClientRect(&rect);
  123. m_BackgroundColor=m_Color;
  124. brush.CreateSolidBrush(m_BackgroundColor);
  125. pDC->FillRect(&rect,&brush);
  126. brush.DeleteObject();
  127. m_Static_ShowBackgroundColor.ReleaseDC(pDC);
  128. }
  129. m_Blue=GetBValue(m_Color);
  130. m_Slider_Blue.SetPos(m_Blue);
  131. m_Red=GetRValue(m_Color);
  132. m_Slider_Red.SetPos(m_Red);
  133. m_Green=GetGValue(m_Color);
  134. m_Slider_Green.SetPos(m_Green);
  135. UpdateData(false);
  136. }
  137. void CDLineDlg2::OnSTATICRed()
  138. {
  139. // TODO: Add your control notification handler code here
  140. m_Color=RGB(255,0,0);
  141. CDC * pDC;
  142. CBrush brush;
  143. CRect rect;
  144. pDC=m_CStatic_ShowColor.GetDC();
  145. m_CStatic_ShowColor.GetClientRect(&rect);
  146. brush.CreateSolidBrush(m_Color);
  147. pDC->FillRect(&rect,&brush);
  148. brush.DeleteObject();
  149. m_CStatic_ShowColor.ReleaseDC(pDC);
  150. if(m_Check_Pen.GetCheck()==BST_CHECKED)
  151. {
  152. pDC=m_Static_ShowPenColor.GetDC();
  153. m_Static_ShowPenColor.GetClientRect(&rect);
  154. m_PenColor=m_Color;
  155. brush.CreateSolidBrush(m_PenColor);
  156. pDC->FillRect(&rect,&brush);
  157. brush.DeleteObject();
  158. m_Static_ShowPenColor.ReleaseDC(pDC);
  159. }
  160. if(m_Check_Brush.GetCheck()==BST_CHECKED)
  161. {
  162. pDC=m_Static_ShowBrushColor.GetDC();
  163. m_Static_ShowBrushColor.GetClientRect(&rect);
  164. m_BrushColor=m_Color;
  165. brush.CreateSolidBrush(m_BrushColor);
  166. pDC->FillRect(&rect,&brush);
  167. brush.DeleteObject();
  168. m_Static_ShowBrushColor.ReleaseDC(pDC);
  169. }
  170. if(m_Check_Background.GetCheck()==BST_CHECKED)
  171. {
  172. pDC=m_Static_ShowBackgroundColor.GetDC();
  173. m_Static_ShowBackgroundColor.GetClientRect(&rect);
  174. m_BackgroundColor=m_Color;
  175. brush.CreateSolidBrush(m_BackgroundColor);
  176. pDC->FillRect(&rect,&brush);
  177. brush.DeleteObject();
  178. m_Static_ShowBackgroundColor.ReleaseDC(pDC);
  179. }
  180. m_Blue=GetBValue(m_Color);
  181. m_Slider_Blue.SetPos(m_Blue);
  182. m_Red=GetRValue(m_Color);
  183. m_Slider_Red.SetPos(m_Red);
  184. m_Green=GetGValue(m_Color);
  185. m_Slider_Green.SetPos(m_Green);
  186. UpdateData(false);
  187. }
  188. void CDLineDlg2::OnSTATICDarkGray()
  189. {
  190. // TODO: Add your control notification handler code here
  191. m_Color=RGB(80,80,80);
  192. CDC * pDC;
  193. CBrush brush;
  194. CRect rect;
  195. pDC=m_CStatic_ShowColor.GetDC();
  196. m_CStatic_ShowColor.GetClientRect(&rect);
  197. brush.CreateSolidBrush(m_Color);
  198. pDC->FillRect(&rect,&brush);
  199. brush.DeleteObject();
  200. m_CStatic_ShowColor.ReleaseDC(pDC);
  201. if(m_Check_Pen.GetCheck()==BST_CHECKED)
  202. {
  203. pDC=m_Static_ShowPenColor.GetDC();
  204. m_Static_ShowPenColor.GetClientRect(&rect);
  205. m_PenColor=m_Color;
  206. brush.CreateSolidBrush(m_PenColor);
  207. pDC->FillRect(&rect,&brush);
  208. brush.DeleteObject();
  209. m_Static_ShowPenColor.ReleaseDC(pDC);
  210. }
  211. if(m_Check_Brush.GetCheck()==BST_CHECKED)
  212. {
  213. pDC=m_Static_ShowBrushColor.GetDC();
  214. m_Static_ShowBrushColor.GetClientRect(&rect);
  215. m_BrushColor=m_Color;
  216. brush.CreateSolidBrush(m_BrushColor);
  217. pDC->FillRect(&rect,&brush);
  218. brush.DeleteObject();
  219. m_Static_ShowBrushColor.ReleaseDC(pDC);
  220. }
  221. if(m_Check_Background.GetCheck()==BST_CHECKED)
  222. {
  223. pDC=m_Static_ShowBackgroundColor.GetDC();
  224. m_Static_ShowBackgroundColor.GetClientRect(&rect);
  225. m_BackgroundColor=m_Color;
  226. brush.CreateSolidBrush(m_BackgroundColor);
  227. pDC->FillRect(&rect,&brush);
  228. brush.DeleteObject();
  229. m_Static_ShowBackgroundColor.ReleaseDC(pDC);
  230. }
  231. m_Blue=GetBValue(m_Color);
  232. m_Slider_Blue.SetPos(m_Blue);
  233. m_Red=GetRValue(m_Color);
  234. m_Slider_Red.SetPos(m_Red);
  235. m_Green=GetGValue(m_Color);
  236. m_Slider_Green.SetPos(m_Green);
  237. UpdateData(false);
  238. }
  239. void CDLineDlg2::OnSTATICLightRray()
  240. {
  241. // TODO: Add your control notification handler code here
  242. m_Color=RGB(180,180,180);
  243. CDC * pDC;
  244. CBrush brush;
  245. CRect rect;
  246. pDC=m_CStatic_ShowColor.GetDC();
  247. m_CStatic_ShowColor.GetClientRect(&rect);
  248. brush.CreateSolidBrush(m_Color);
  249. pDC->FillRect(&rect,&brush);
  250. brush.DeleteObject();
  251. m_CStatic_ShowColor.ReleaseDC(pDC);
  252. if(m_Check_Pen.GetCheck()==BST_CHECKED)
  253. {
  254. pDC=m_Static_ShowPenColor.GetDC();
  255. m_Static_ShowPenColor.GetClientRect(&rect);
  256. m_PenColor=m_Color;
  257. brush.CreateSolidBrush(m_PenColor);
  258. pDC->FillRect(&rect,&brush);
  259. brush.DeleteObject();
  260. m_Static_ShowPenColor.ReleaseDC(pDC);
  261. }
  262. if(m_Check_Brush.GetCheck()==BST_CHECKED)
  263. {
  264. pDC=m_Static_ShowBrushColor.GetDC();
  265. m_Static_ShowBrushColor.GetClientRect(&rect);
  266. m_BrushColor=m_Color;
  267. brush.CreateSolidBrush(m_BrushColor);
  268. pDC->FillRect(&rect,&brush);
  269. brush.DeleteObject();
  270. m_Static_ShowBrushColor.ReleaseDC(pDC);
  271. }
  272. if(m_Check_Background.GetCheck()==BST_CHECKED)
  273. {
  274. pDC=m_Static_ShowBackgroundColor.GetDC();
  275. m_Static_ShowBackgroundColor.GetClientRect(&rect);
  276. m_BackgroundColor=m_Color;
  277. brush.CreateSolidBrush(m_BackgroundColor);
  278. pDC->FillRect(&rect,&brush);
  279. brush.DeleteObject();
  280. m_Static_ShowBackgroundColor.ReleaseDC(pDC);
  281. }
  282. m_Blue=GetBValue(m_Color);
  283. m_Slider_Blue.SetPos(m_Blue);
  284. m_Red=GetRValue(m_Color);
  285. m_Slider_Red.SetPos(m_Red);
  286. m_Green=GetGValue(m_Color);
  287. m_Slider_Green.SetPos(m_Green);
  288. UpdateData(false);
  289. }
  290. void CDLineDlg2::OnSTATICWhite()
  291. {
  292. // TODO: Add your control notification handler code here
  293. m_Color=RGB(255,255,255);
  294. CDC * pDC;
  295. CBrush brush;
  296. CRect rect;
  297. pDC=m_CStatic_ShowColor.GetDC();
  298. m_CStatic_ShowColor.GetClientRect(&rect);
  299. brush.CreateSolidBrush(m_Color);
  300. pDC->FillRect(&rect,&brush);
  301. brush.DeleteObject();
  302. m_CStatic_ShowColor.ReleaseDC(pDC);
  303. if(m_Check_Pen.GetCheck()==BST_CHECKED)
  304. {
  305. pDC=m_Static_ShowPenColor.GetDC();
  306. m_Static_ShowPenColor.GetClientRect(&rect);
  307. m_PenColor=m_Color;
  308. brush.CreateSolidBrush(m_PenColor);
  309. pDC->FillRect(&rect,&brush);
  310. brush.DeleteObject();
  311. m_Static_ShowPenColor.ReleaseDC(pDC);
  312. }
  313. if(m_Check_Brush.GetCheck()==BST_CHECKED)
  314. {
  315. pDC=m_Static_ShowBrushColor.GetDC();
  316. m_Static_ShowBrushColor.GetClientRect(&rect);
  317. m_BrushColor=m_Color;
  318. brush.CreateSolidBrush(m_BrushColor);
  319. pDC->FillRect(&rect,&brush);
  320. brush.DeleteObject();
  321. m_Static_ShowBrushColor.ReleaseDC(pDC);
  322. }
  323. if(m_Check_Background.GetCheck()==BST_CHECKED)
  324. {
  325. pDC=m_Static_ShowBackgroundColor.GetDC();
  326. m_Static_ShowBackgroundColor.GetClientRect(&rect);
  327. m_BackgroundColor=m_Color;
  328. brush.CreateSolidBrush(m_BackgroundColor);
  329. pDC->FillRect(&rect,&brush);
  330. brush.DeleteObject();
  331. m_Static_ShowBackgroundColor.ReleaseDC(pDC);
  332. }
  333. m_Blue=GetBValue(m_Color);
  334. m_Slider_Blue.SetPos(m_Blue);
  335. m_Red=GetRValue(m_Color);
  336. m_Slider_Red.SetPos(m_Red);
  337. m_Green=GetGValue(m_Color);
  338. m_Slider_Green.SetPos(m_Green);
  339. UpdateData(false);
  340. }
  341. void CDLineDlg2::OnSTATICDrakBlue()
  342. {
  343. // TODO: Add your control notification handler code here
  344. m_Color=RGB(0,0,128);
  345. CDC * pDC;
  346. CBrush brush;
  347. CRect rect;
  348. pDC=m_CStatic_ShowColor.GetDC();
  349. m_CStatic_ShowColor.GetClientRect(&rect);
  350. brush.CreateSolidBrush(m_Color);
  351. pDC->FillRect(&rect,&brush);
  352. brush.DeleteObject();
  353. m_CStatic_ShowColor.ReleaseDC(pDC);
  354. if(m_Check_Pen.GetCheck()==BST_CHECKED)
  355. {
  356. pDC=m_Static_ShowPenColor.GetDC();
  357. m_Static_ShowPenColor.GetClientRect(&rect);
  358. m_PenColor=m_Color;
  359. brush.CreateSolidBrush(m_PenColor);
  360. pDC->FillRect(&rect,&brush);
  361. brush.DeleteObject();
  362. m_Static_ShowPenColor.ReleaseDC(pDC);
  363. }
  364. if(m_Check_Brush.GetCheck()==BST_CHECKED)
  365. {
  366. pDC=m_Static_ShowBrushColor.GetDC();
  367. m_Static_ShowBrushColor.GetClientRect(&rect);
  368. m_BrushColor=m_Color;
  369. brush.CreateSolidBrush(m_BrushColor);
  370. pDC->FillRect(&rect,&brush);
  371. brush.DeleteObject();
  372. m_Static_ShowBrushColor.ReleaseDC(pDC);
  373. }
  374. if(m_Check_Background.GetCheck()==BST_CHECKED)
  375. {
  376. pDC=m_Static_ShowBackgroundColor.GetDC();
  377. m_Static_ShowBackgroundColor.GetClientRect(&rect);
  378. m_BackgroundColor=m_Color;
  379. brush.CreateSolidBrush(m_BackgroundColor);
  380. pDC->FillRect(&rect,&brush);
  381. brush.DeleteObject();
  382. m_Static_ShowBackgroundColor.ReleaseDC(pDC);
  383. }
  384. m_Blue=GetBValue(m_Color);
  385. m_Slider_Blue.SetPos(m_Blue);
  386. m_Red=GetRValue(m_Color);
  387. m_Slider_Red.SetPos(m_Red);
  388. m_Green=GetGValue(m_Color);
  389. m_Slider_Green.SetPos(m_Green);
  390. UpdateData(false);
  391. }
  392. void CDLineDlg2::OnSTATICBlue()
  393. {
  394. // TODO: Add your control notification handler code here
  395. m_Color=RGB(0,0,255);
  396. CDC * pDC;
  397. CBrush brush;
  398. CRect rect;
  399. pDC=m_CStatic_ShowColor.GetDC();
  400. m_CStatic_ShowColor.GetClientRect(&rect);
  401. brush.CreateSolidBrush(m_Color);
  402. pDC->FillRect(&rect,&brush);
  403. brush.DeleteObject();
  404. m_CStatic_ShowColor.ReleaseDC(pDC);
  405. if(m_Check_Pen.GetCheck()==BST_CHECKED)
  406. {
  407. pDC=m_Static_ShowPenColor.GetDC();
  408. m_Static_ShowPenColor.GetClientRect(&rect);
  409. m_PenColor=m_Color;
  410. brush.CreateSolidBrush(m_PenColor);
  411. pDC->FillRect(&rect,&brush);
  412. brush.DeleteObject();
  413. m_Static_ShowPenColor.ReleaseDC(pDC);
  414. }
  415. if(m_Check_Brush.GetCheck()==BST_CHECKED)
  416. {
  417. pDC=m_Static_ShowBrushColor.GetDC();
  418. m_Static_ShowBrushColor.GetClientRect(&rect);
  419. m_BrushColor=m_Color;
  420. brush.CreateSolidBrush(m_BrushColor);
  421. pDC->FillRect(&rect,&brush);
  422. brush.DeleteObject();
  423. m_Static_ShowBrushColor.ReleaseDC(pDC);
  424. }
  425. if(m_Check_Background.GetCheck()==BST_CHECKED)
  426. {
  427. pDC=m_Static_ShowBackgroundColor.GetDC();
  428. m_Static_ShowBackgroundColor.GetClientRect(&rect);
  429. m_BackgroundColor=m_Color;
  430. brush.CreateSolidBrush(m_BackgroundColor);
  431. pDC->FillRect(&rect,&brush);
  432. brush.DeleteObject();
  433. m_Static_ShowBackgroundColor.ReleaseDC(pDC);
  434. }
  435. m_Blue=GetBValue(m_Color);
  436. m_Slider_Blue.SetPos(m_Blue);
  437. m_Red=GetRValue(m_Color);
  438. m_Slider_Red.SetPos(m_Red);
  439. m_Green=GetGValue(m_Color);
  440. m_Slider_Green.SetPos(m_Green);
  441. UpdateData(false);
  442. }
  443. void CDLineDlg2::OnSTATICGreen()
  444. {
  445. // TODO: Add your control notification handler code here
  446. m_Color=RGB(0,255,0);
  447. CDC * pDC;
  448. CBrush brush;
  449. CRect rect;
  450. pDC=m_CStatic_ShowColor.GetDC();
  451. m_CStatic_ShowColor.GetClientRect(&rect);
  452. brush.CreateSolidBrush(m_Color);
  453. pDC->FillRect(&rect,&brush);
  454. brush.DeleteObject();
  455. m_CStatic_ShowColor.ReleaseDC(pDC);
  456. if(m_Check_Pen.GetCheck()==BST_CHECKED)
  457. {
  458. pDC=m_Static_ShowPenColor.GetDC();
  459. m_Static_ShowPenColor.GetClientRect(&rect);
  460. m_PenColor=m_Color;
  461. brush.CreateSolidBrush(m_PenColor);
  462. pDC->FillRect(&rect,&brush);
  463. brush.DeleteObject();
  464. m_Static_ShowPenColor.ReleaseDC(pDC);
  465. }
  466. if(m_Check_Brush.GetCheck()==BST_CHECKED)
  467. {
  468. pDC=m_Static_ShowBrushColor.GetDC();
  469. m_Static_ShowBrushColor.GetClientRect(&rect);
  470. m_BrushColor=m_Color;
  471. brush.CreateSolidBrush(m_BrushColor);
  472. pDC->FillRect(&rect,&brush);
  473. brush.DeleteObject();
  474. m_Static_ShowBrushColor.ReleaseDC(pDC);
  475. }
  476. if(m_Check_Background.GetCheck()==BST_CHECKED)
  477. {
  478. pDC=m_Static_ShowBackgroundColor.GetDC();
  479. m_Static_ShowBackgroundColor.GetClientRect(&rect);
  480. m_BackgroundColor=m_Color;
  481. brush.CreateSolidBrush(m_BackgroundColor);
  482. pDC->FillRect(&rect,&brush);
  483. brush.DeleteObject();
  484. m_Static_ShowBackgroundColor.ReleaseDC(pDC);
  485. }
  486. m_Blue=GetBValue(m_Color);
  487. m_Slider_Blue.SetPos(m_Blue);
  488. m_Red=GetRValue(m_Color);
  489. m_Slider_Red.SetPos(m_Red);
  490. m_Green=GetGValue(m_Color);
  491. m_Slider_Green.SetPos(m_Green);
  492. UpdateData(false);
  493. }
  494. void CDLineDlg2::OnSTATICDrakGreen()
  495. {
  496. // TODO: Add your control notification handler code here
  497. m_Color=RGB(0,128,0);
  498. CDC * pDC;
  499. CBrush brush;
  500. CRect rect;
  501. pDC=m_CStatic_ShowColor.GetDC();
  502. m_CStatic_ShowColor.GetClientRect(&rect);
  503. brush.CreateSolidBrush(m_Color);
  504. pDC->FillRect(&rect,&brush);
  505. brush.DeleteObject();
  506. m_CStatic_ShowColor.ReleaseDC(pDC);
  507. if(m_Check_Pen.GetCheck()==BST_CHECKED)
  508. {
  509. pDC=m_Static_ShowPenColor.GetDC();
  510. m_Static_ShowPenColor.GetClientRect(&rect);
  511. m_PenColor=m_Color;
  512. brush.CreateSolidBrush(m_PenColor);
  513. pDC->FillRect(&rect,&brush);
  514. brush.DeleteObject();
  515. m_Static_ShowPenColor.ReleaseDC(pDC);
  516. }
  517. if(m_Check_Brush.GetCheck()==BST_CHECKED)
  518. {
  519. pDC=m_Static_ShowBrushColor.GetDC();
  520. m_Static_ShowBrushColor.GetClientRect(&rect);
  521. m_BrushColor=m_Color;
  522. brush.CreateSolidBrush(m_BrushColor);
  523. pDC->FillRect(&rect,&brush);
  524. brush.DeleteObject();
  525. m_Static_ShowBrushColor.ReleaseDC(pDC);
  526. }
  527. if(m_Check_Background.GetCheck()==BST_CHECKED)
  528. {
  529. pDC=m_Static_ShowBackgroundColor.GetDC();
  530. m_Static_ShowBackgroundColor.GetClientRect(&rect);
  531. m_BackgroundColor=m_Color;
  532. brush.CreateSolidBrush(m_BackgroundColor);
  533. pDC->FillRect(&rect,&brush);
  534. brush.DeleteObject();
  535. m_Static_ShowBackgroundColor.ReleaseDC(pDC);
  536. }
  537. m_Blue=GetBValue(m_Color);
  538. m_Slider_Blue.SetPos(m_Blue);
  539. m_Red=GetRValue(m_Color);
  540. m_Slider_Red.SetPos(m_Red);
  541. m_Green=GetGValue(m_Color);
  542. m_Slider_Green.SetPos(m_Green);
  543. UpdateData(false);
  544. }
  545. void CDLineDlg2::OnSTATICYellow()
  546. {
  547. // TODO: Add your control notification handler code here
  548. m_Color=RGB(255,255,0);
  549. CDC * pDC;
  550. CBrush brush;
  551. CRect rect;
  552. pDC=m_CStatic_ShowColor.GetDC();
  553. m_CStatic_ShowColor.GetClientRect(&rect);
  554. brush.CreateSolidBrush(m_Color);
  555. pDC->FillRect(&rect,&brush);
  556. brush.DeleteObject();
  557. m_CStatic_ShowColor.ReleaseDC(pDC);
  558. if(m_Check_Pen.GetCheck()==BST_CHECKED)
  559. {
  560. pDC=m_Static_ShowPenColor.GetDC();
  561. m_Static_ShowPenColor.GetClientRect(&rect);
  562. m_PenColor=m_Color;
  563. brush.CreateSolidBrush(m_PenColor);
  564. pDC->FillRect(&rect,&brush);
  565. brush.DeleteObject();
  566. m_Static_ShowPenColor.ReleaseDC(pDC);
  567. }
  568. if(m_Check_Brush.GetCheck()==BST_CHECKED)
  569. {
  570. pDC=m_Static_ShowBrushColor.GetDC();
  571. m_Static_ShowBrushColor.GetClientRect(&rect);
  572. m_BrushColor=m_Color;
  573. brush.CreateSolidBrush(m_BrushColor);
  574. pDC->FillRect(&rect,&brush);
  575. brush.DeleteObject();
  576. m_Static_ShowBrushColor.ReleaseDC(pDC);
  577. }
  578. if(m_Check_Background.GetCheck()==BST_CHECKED)
  579. {
  580. pDC=m_Static_ShowBackgroundColor.GetDC();
  581. m_Static_ShowBackgroundColor.GetClientRect(&rect);
  582. m_BackgroundColor=m_Color;
  583. brush.CreateSolidBrush(m_BackgroundColor);
  584. pDC->FillRect(&rect,&brush);
  585. brush.DeleteObject();
  586. m_Static_ShowBackgroundColor.ReleaseDC(pDC);
  587. }
  588. m_Blue=GetBValue(m_Color);
  589. m_Slider_Blue.SetPos(m_Blue);
  590. m_Red=GetRValue(m_Color);
  591. m_Slider_Red.SetPos(m_Red);
  592. m_Green=GetGValue(m_Color);
  593. m_Slider_Green.SetPos(m_Green);
  594. UpdateData(false);
  595. }
  596. void CDLineDlg2::OnSTATICRarkRed()
  597. {
  598. // TODO: Add your control notification handler code here
  599. m_Color=RGB(128,0,0);
  600. CDC * pDC;
  601. CBrush brush;
  602. CRect rect;
  603. pDC=m_CStatic_ShowColor.GetDC();
  604. m_CStatic_ShowColor.GetClientRect(&rect);
  605. brush.CreateSolidBrush(m_Color);
  606. pDC->FillRect(&rect,&brush);
  607. brush.DeleteObject();
  608. m_CStatic_ShowColor.ReleaseDC(pDC);
  609. if(m_Check_Pen.GetCheck()==BST_CHECKED)
  610. {
  611. pDC=m_Static_ShowPenColor.GetDC();
  612. m_Static_ShowPenColor.GetClientRect(&rect);
  613. m_PenColor=m_Color;
  614. brush.CreateSolidBrush(m_PenColor);
  615. pDC->FillRect(&rect,&brush);
  616. brush.DeleteObject();
  617. m_Static_ShowPenColor.ReleaseDC(pDC);
  618. }
  619. if(m_Check_Brush.GetCheck()==BST_CHECKED)
  620. {
  621. pDC=m_Static_ShowBrushColor.GetDC();
  622. m_Static_ShowBrushColor.GetClientRect(&rect);
  623. m_BrushColor=m_Color;
  624. brush.CreateSolidBrush(m_BrushColor);
  625. pDC->FillRect(&rect,&brush);
  626. brush.DeleteObject();
  627. m_Static_ShowBrushColor.ReleaseDC(pDC);
  628. }
  629. if(m_Check_Background.GetCheck()==BST_CHECKED)
  630. {
  631. pDC=m_Static_ShowBackgroundColor.GetDC();
  632. m_Static_ShowBackgroundColor.GetClientRect(&rect);
  633. m_BackgroundColor=m_Color;
  634. brush.CreateSolidBrush(m_BackgroundColor);
  635. pDC->FillRect(&rect,&brush);
  636. brush.DeleteObject();
  637. m_Static_ShowBackgroundColor.ReleaseDC(pDC);
  638. }
  639. m_Blue=GetBValue(m_Color);
  640. m_Slider_Blue.SetPos(m_Blue);
  641. m_Red=GetRValue(m_Color);
  642. m_Slider_Red.SetPos(m_Red);
  643. m_Green=GetGValue(m_Color);
  644. m_Slider_Green.SetPos(m_Green);
  645. UpdateData(false);
  646. }
  647. void CDLineDlg2::OnStaticBitmap6()
  648. {
  649. // TODO: Add your control notification handler code here
  650. m_Color=RGB(0,255,255);
  651. CDC * pDC;
  652. CBrush brush;
  653. CRect rect;
  654. pDC=m_CStatic_ShowColor.GetDC();
  655. m_CStatic_ShowColor.GetClientRect(&rect);
  656. brush.CreateSolidBrush(m_Color);
  657. pDC->FillRect(&rect,&brush);
  658. brush.DeleteObject();
  659. m_CStatic_ShowColor.ReleaseDC(pDC);
  660. if(m_Check_Pen.GetCheck()==BST_CHECKED)
  661. {
  662. pDC=m_Static_ShowPenColor.GetDC();
  663. m_Static_ShowPenColor.GetClientRect(&rect);
  664. m_PenColor=m_Color;
  665. brush.CreateSolidBrush(m_PenColor);
  666. pDC->FillRect(&rect,&brush);
  667. brush.DeleteObject();
  668. m_Static_ShowPenColor.ReleaseDC(pDC);
  669. }
  670. if(m_Check_Brush.GetCheck()==BST_CHECKED)
  671. {
  672. pDC=m_Static_ShowBrushColor.GetDC();
  673. m_Static_ShowBrushColor.GetClientRect(&rect);
  674. m_BrushColor=m_Color;
  675. brush.CreateSolidBrush(m_BrushColor);
  676. pDC->FillRect(&rect,&brush);
  677. brush.DeleteObject();
  678. m_Static_ShowBrushColor.ReleaseDC(pDC);
  679. }
  680. if(m_Check_Background.GetCheck()==BST_CHECKED)
  681. {
  682. pDC=m_Static_ShowBackgroundColor.GetDC();
  683. m_Static_ShowBackgroundColor.GetClientRect(&rect);
  684. m_BackgroundColor=m_Color;
  685. brush.CreateSolidBrush(m_BackgroundColor);
  686. pDC->FillRect(&rect,&brush);
  687. brush.DeleteObject();
  688. m_Static_ShowBackgroundColor.ReleaseDC(pDC);
  689. }
  690. m_Blue=GetBValue(m_Color);
  691. m_Slider_Blue.SetPos(m_Blue);
  692. m_Red=GetRValue(m_Color);
  693. m_Slider_Red.SetPos(m_Red);
  694. m_Green=GetGValue(m_Color);
  695. m_Slider_Green.SetPos(m_Green);
  696. UpdateData(false);
  697. }
  698. void CDLineDlg2::OnStaticBitmap5()
  699. {
  700. // TODO: Add your control notification handler code here
  701. m_Color=RGB(0,170,170);
  702. CDC * pDC;
  703. CBrush brush;
  704. CRect rect;
  705. pDC=m_CStatic_ShowColor.GetDC();
  706. m_CStatic_ShowColor.GetClientRect(&rect);
  707. brush.CreateSolidBrush(m_Color);
  708. pDC->FillRect(&rect,&brush);
  709. brush.DeleteObject();
  710. m_CStatic_ShowColor.ReleaseDC(pDC);
  711. if(m_Check_Pen.GetCheck()==BST_CHECKED)
  712. {
  713. pDC=m_Static_ShowPenColor.GetDC();
  714. m_Static_ShowPenColor.GetClientRect(&rect);
  715. m_PenColor=m_Color;
  716. brush.CreateSolidBrush(m_PenColor);
  717. pDC->FillRect(&rect,&brush);
  718. brush.DeleteObject();
  719. m_Static_ShowPenColor.ReleaseDC(pDC);
  720. }
  721. if(m_Check_Brush.GetCheck()==BST_CHECKED)
  722. {
  723. pDC=m_Static_ShowBrushColor.GetDC();
  724. m_Static_ShowBrushColor.GetClientRect(&rect);
  725. m_BrushColor=m_Color;
  726. brush.CreateSolidBrush(m_BrushColor);
  727. pDC->FillRect(&rect,&brush);
  728. brush.DeleteObject();
  729. m_Static_ShowBrushColor.ReleaseDC(pDC);
  730. }
  731. if(m_Check_Background.GetCheck()==BST_CHECKED)
  732. {
  733. pDC=m_Static_ShowBackgroundColor.GetDC();
  734. m_Static_ShowBackgroundColor.GetClientRect(&rect);
  735. m_BackgroundColor=m_Color;
  736. brush.CreateSolidBrush(m_BackgroundColor);
  737. pDC->FillRect(&rect,&brush);
  738. brush.DeleteObject();
  739. m_Static_ShowBackgroundColor.ReleaseDC(pDC);
  740. }
  741. m_Blue=GetBValue(m_Color);
  742. m_Slider_Blue.SetPos(m_Blue);
  743. m_Red=GetRValue(m_Color);
  744. m_Slider_Red.SetPos(m_Red);
  745. m_Green=GetGValue(m_Color);
  746. m_Slider_Green.SetPos(m_Green);
  747. UpdateData(false);
  748. }
  749. void CDLineDlg2::OnSTATICDarkYellow()
  750. {
  751. // TODO: Add your control notification handler code here
  752. m_Color=RGB(128,128,0);
  753. CDC * pDC;
  754. CBrush brush;
  755. CRect rect;
  756. pDC=m_CStatic_ShowColor.GetDC();
  757. m_CStatic_ShowColor.GetClientRect(&rect);
  758. brush.CreateSolidBrush(m_Color);
  759. pDC->FillRect(&rect,&brush);
  760. brush.DeleteObject();
  761. m_CStatic_ShowColor.ReleaseDC(pDC);
  762. if(m_Check_Pen.GetCheck()==BST_CHECKED)
  763. {
  764. pDC=m_Static_ShowPenColor.GetDC();
  765. m_Static_ShowPenColor.GetClientRect(&rect);
  766. m_PenColor=m_Color;
  767. brush.CreateSolidBrush(m_PenColor);
  768. pDC->FillRect(&rect,&brush);
  769. brush.DeleteObject();
  770. m_Static_ShowPenColor.ReleaseDC(pDC);
  771. }
  772. if(m_Check_Brush.GetCheck()==BST_CHECKED)
  773. {
  774. pDC=m_Static_ShowBrushColor.GetDC();
  775. m_Static_ShowBrushColor.GetClientRect(&rect);
  776. m_BrushColor=m_Color;
  777. brush.CreateSolidBrush(m_BrushColor);
  778. pDC->FillRect(&rect,&brush);
  779. brush.DeleteObject();
  780. m_Static_ShowBrushColor.ReleaseDC(pDC);
  781. }
  782. if(m_Check_Background.GetCheck()==BST_CHECKED)
  783. {
  784. pDC=m_Static_ShowBackgroundColor.GetDC();
  785. m_Static_ShowBackgroundColor.GetClientRect(&rect);
  786. m_BackgroundColor=m_Color;
  787. brush.CreateSolidBrush(m_BackgroundColor);
  788. pDC->FillRect(&rect,&brush);
  789. brush.DeleteObject();
  790. m_Static_ShowBackgroundColor.ReleaseDC(pDC);
  791. }
  792. m_Blue=GetBValue(m_Color);
  793. m_Slider_Blue.SetPos(m_Blue);
  794. m_Red=GetRValue(m_Color);
  795. m_Slider_Red.SetPos(m_Red);
  796. m_Green=GetGValue(m_Color);
  797. m_Slider_Green.SetPos(m_Green);
  798. UpdateData(false);
  799. }
  800. void CDLineDlg2::OnStaticBitmap10()
  801. {
  802. // TODO: Add your control notification handler code here
  803. m_Color=RGB(255,0,255);
  804. CDC * pDC;
  805. CBrush brush;
  806. CRect rect;
  807. pDC=m_CStatic_ShowColor.GetDC();
  808. m_CStatic_ShowColor.GetClientRect(&rect);
  809. brush.CreateSolidBrush(m_Color);
  810. pDC->FillRect(&rect,&brush);
  811. brush.DeleteObject();
  812. m_CStatic_ShowColor.ReleaseDC(pDC);
  813. if(m_Check_Pen.GetCheck()==BST_CHECKED)
  814. {
  815. pDC=m_Static_ShowPenColor.GetDC();
  816. m_Static_ShowPenColor.GetClientRect(&rect);
  817. m_PenColor=m_Color;
  818. brush.CreateSolidBrush(m_PenColor);
  819. pDC->FillRect(&rect,&brush);
  820. brush.DeleteObject();
  821. m_Static_ShowPenColor.ReleaseDC(pDC);
  822. }
  823. if(m_Check_Brush.GetCheck()==BST_CHECKED)
  824. {
  825. pDC=m_Static_ShowBrushColor.GetDC();
  826. m_Static_ShowBrushColor.GetClientRect(&rect);
  827. m_BrushColor=m_Color;
  828. brush.CreateSolidBrush(m_BrushColor);
  829. pDC->FillRect(&rect,&brush);
  830. brush.DeleteObject();
  831. m_Static_ShowBrushColor.ReleaseDC(pDC);
  832. }
  833. if(m_Check_Background.GetCheck()==BST_CHECKED)
  834. {
  835. pDC=m_Static_ShowBackgroundColor.GetDC();
  836. m_Static_ShowBackgroundColor.GetClientRect(&rect);
  837. m_BackgroundColor=m_Color;
  838. brush.CreateSolidBrush(m_BackgroundColor);
  839. pDC->FillRect(&rect,&brush);
  840. brush.DeleteObject();
  841. m_Static_ShowBackgroundColor.ReleaseDC(pDC);
  842. }
  843. m_Blue=GetBValue(m_Color);
  844. m_Slider_Blue.SetPos(m_Blue);
  845. m_Red=GetRValue(m_Color);
  846. m_Slider_Red.SetPos(m_Red);
  847. m_Green=GetGValue(m_Color);
  848. m_Slider_Green.SetPos(m_Green);
  849. UpdateData(false);
  850. }
  851. void CDLineDlg2::OnStaticBitmap9()
  852. {
  853. // TODO: Add your control notification handler code here
  854. m_Color=RGB(128,0,128);
  855. CDC * pDC;
  856. CBrush brush;
  857. CRect rect;
  858. pDC=m_CStatic_ShowColor.GetDC();
  859. m_CStatic_ShowColor.GetClientRect(&rect);
  860. brush.CreateSolidBrush(m_Color);
  861. pDC->FillRect(&rect,&brush);
  862. brush.DeleteObject();
  863. m_CStatic_ShowColor.ReleaseDC(pDC);
  864. if(m_Check_Pen.GetCheck()==BST_CHECKED)
  865. {
  866. pDC=m_Static_ShowPenColor.GetDC();
  867. m_Static_ShowPenColor.GetClientRect(&rect);
  868. m_PenColor=m_Color;
  869. brush.CreateSolidBrush(m_PenColor);
  870. pDC->FillRect(&rect,&brush);
  871. brush.DeleteObject();
  872. m_Static_ShowPenColor.ReleaseDC(pDC);
  873. }
  874. if(m_Check_Brush.GetCheck()==BST_CHECKED)
  875. {
  876. pDC=m_Static_ShowBrushColor.GetDC();
  877. m_Static_ShowBrushColor.GetClientRect(&rect);
  878. m_BrushColor=m_Color;
  879. brush.CreateSolidBrush(m_BrushColor);
  880. pDC->FillRect(&rect,&brush);
  881. brush.DeleteObject();
  882. m_Static_ShowBrushColor.ReleaseDC(pDC);
  883. }
  884. if(m_Check_Background.GetCheck()==BST_CHECKED)
  885. {
  886. pDC=m_Static_ShowBackgroundColor.GetDC();
  887. m_Static_ShowBackgroundColor.GetClientRect(&rect);
  888. m_BackgroundColor=m_Color;
  889. brush.CreateSolidBrush(m_BackgroundColor);
  890. pDC->FillRect(&rect,&brush);
  891. brush.DeleteObject();
  892. m_Static_ShowBackgroundColor.ReleaseDC(pDC);
  893. }
  894. m_Blue=GetBValue(m_Color);
  895. m_Slider_Blue.SetPos(m_Blue);
  896. m_Red=GetRValue(m_Color);
  897. m_Slider_Red.SetPos(m_Red);
  898. m_Green=GetGValue(m_Color);
  899. m_Slider_Green.SetPos(m_Green);
  900. UpdateData(false);
  901. }
  902. void CDLineDlg2::OnPaint()
  903. {
  904. CPaintDC dc(this); // device context for painting
  905. // TODO: Add your message handler code here
  906. CDC * pDC;
  907. CRect rect;
  908. CBrush brush;
  909. pDC=m_CStatic_ShowColor.GetDC();
  910. m_CStatic_ShowColor.GetClientRect(&rect);
  911. brush.CreateSolidBrush(m_Color);
  912. pDC->FillRect(&rect,&brush);
  913. brush.DeleteObject();
  914. m_CStatic_ShowColor.ReleaseDC(pDC);
  915. pDC=m_Static_ShowPenColor.GetDC();
  916. m_Static_ShowPenColor.GetClientRect(&rect);
  917. brush.CreateSolidBrush(m_PenColor);
  918. pDC->FillRect(&rect,&brush);
  919. brush.DeleteObject();
  920. m_Static_ShowPenColor.ReleaseDC(pDC);
  921. pDC=m_Static_ShowBrushColor.GetDC();
  922. m_Static_ShowBrushColor.GetClientRect(&rect);
  923. brush.CreateSolidBrush(m_BrushColor);
  924. pDC->FillRect(&rect,&brush);
  925. brush.DeleteObject();
  926. m_Static_ShowBrushColor.ReleaseDC(pDC);
  927. pDC=m_Static_ShowBackgroundColor.GetDC();
  928. m_Static_ShowBackgroundColor.GetClientRect(&rect);
  929. brush.CreateSolidBrush(m_BackgroundColor);
  930. pDC->FillRect(&rect,&brush);
  931. brush.DeleteObject();
  932. m_Static_ShowBackgroundColor.ReleaseDC(pDC);
  933. m_Blue=GetBValue(m_Color);
  934. m_Slider_Blue.SetPos(m_Blue);
  935. m_Red=GetRValue(m_Color);
  936. m_Slider_Red.SetPos(m_Red);
  937. m_Green=GetGValue(m_Color);
  938. m_Slider_Green.SetPos(m_Green);
  939. UpdateData(false);
  940. // Do not call CPropertyPage::OnPaint() for painting messages
  941. }
  942. BOOL CDLineDlg2::OnInitDialog()
  943. {
  944. CPropertyPage::OnInitDialog();
  945. // TODO: Add extra initialization here
  946. m_Slider_Blue.SetRange(0,255);
  947. m_Slider_Blue.SetPos(0);
  948. m_Slider_Blue.SetTicFreq(26);
  949. m_Slider_Red.SetRange(0,255);
  950. m_Slider_Red.SetPos(0);
  951. m_Slider_Red.SetTicFreq(26);
  952. m_Slider_Green.SetRange(0,255);
  953. m_Slider_Green.SetPos(0);
  954. m_Slider_Green.SetTicFreq(26);
  955. return TRUE; // return TRUE unless you set the focus to a control
  956. // EXCEPTION: OCX Property Pages should return FALSE
  957. }
  958. void CDLineDlg2::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
  959. {
  960. // TODO: Add your message handler code here and/or call default
  961. if(pScrollBar->GetDlgCtrlID()==IDC_SLIDER_Red)
  962. {
  963. m_Red=m_Slider_Red.GetPos();
  964. }
  965. if(pScrollBar->GetDlgCtrlID()==IDC_SLIDER_Green)
  966. {
  967. m_Green=m_Slider_Green.GetPos();
  968. }
  969. if(pScrollBar->GetDlgCtrlID()==IDC_SLIDER_Blue)
  970. {
  971. m_Blue=m_Slider_Blue.GetPos();
  972. }
  973. m_Color=RGB(m_Red,m_Green,m_Blue);
  974. CDC * pDC;
  975. CBrush brush;
  976. CRect rect;
  977. pDC=m_CStatic_ShowColor.GetDC();
  978. m_CStatic_ShowColor.GetClientRect(&rect);
  979. brush.CreateSolidBrush(m_Color);
  980. pDC->FillRect(&rect,&brush);
  981. brush.DeleteObject();
  982. m_CStatic_ShowColor.ReleaseDC(pDC);
  983. if(m_Check_Pen.GetCheck()==BST_CHECKED)
  984. {
  985. pDC=m_Static_ShowPenColor.GetDC();
  986. m_Static_ShowPenColor.GetClientRect(&rect);
  987. m_PenColor=m_Color;
  988. brush.CreateSolidBrush(m_PenColor);
  989. pDC->FillRect(&rect,&brush);
  990. brush.DeleteObject();
  991. m_Static_ShowPenColor.ReleaseDC(pDC);
  992. }
  993. if(m_Check_Brush.GetCheck()==BST_CHECKED)
  994. {
  995. pDC=m_Static_ShowBrushColor.GetDC();
  996. m_Static_ShowBrushColor.GetClientRect(&rect);
  997. m_BrushColor=m_Color;
  998. brush.CreateSolidBrush(m_BrushColor);
  999. pDC->FillRect(&rect,&brush);
  1000. brush.DeleteObject();
  1001. m_Static_ShowBrushColor.ReleaseDC(pDC);
  1002. }
  1003. if(m_Check_Background.GetCheck()==BST_CHECKED)
  1004. {
  1005. pDC=m_Static_ShowBackgroundColor.GetDC();
  1006. m_Static_ShowBackgroundColor.GetClientRect(&rect);
  1007. m_BackgroundColor=m_Color;
  1008. brush.CreateSolidBrush(m_BackgroundColor);
  1009. pDC->FillRect(&rect,&brush);
  1010. brush.DeleteObject();
  1011. m_Static_ShowBackgroundColor.ReleaseDC(pDC);
  1012. }
  1013. UpdateData(false);
  1014. CPropertyPage::OnHScroll(nSBCode, nPos, pScrollBar);
  1015. }
  1016. void CDLineDlg2::OnBUTTONSelect()
  1017. {
  1018. // TODO: Add your control notification handler code here
  1019. m_Draw_Status=Select_Color_Status;
  1020. }
  1021. void CDLineDlg2::OnChange(COLORREF color)
  1022. {
  1023. CDC * pDC;
  1024. CBrush brush;
  1025. CRect rect;
  1026. m_Color=color;
  1027. pDC=m_CStatic_ShowColor.GetDC();
  1028. m_CStatic_ShowColor.GetClientRect(&rect);
  1029. brush.CreateSolidBrush(m_Color);
  1030. pDC->FillRect(&rect,&brush);
  1031. brush.DeleteObject();
  1032. m_CStatic_ShowColor.ReleaseDC(pDC);
  1033. if(m_Check_Pen.GetCheck()==BST_CHECKED)
  1034. {
  1035. pDC=m_Static_ShowPenColor.GetDC();
  1036. m_Static_ShowPenColor.GetClientRect(&rect);
  1037. m_PenColor=m_Color;
  1038. brush.CreateSolidBrush(m_PenColor);
  1039. pDC->FillRect(&rect,&brush);
  1040. brush.DeleteObject();
  1041. m_Static_ShowPenColor.ReleaseDC(pDC);
  1042. }
  1043. if(m_Check_Brush.GetCheck()==BST_CHECKED)
  1044. {
  1045. pDC=m_Static_ShowBrushColor.GetDC();
  1046. m_Static_ShowBrushColor.GetClientRect(&rect);
  1047. m_BrushColor=m_Color;
  1048. brush.CreateSolidBrush(m_BrushColor);
  1049. pDC->FillRect(&rect,&brush);
  1050. brush.DeleteObject();
  1051. m_Static_ShowBrushColor.ReleaseDC(pDC);
  1052. }
  1053. if(m_Check_Background.GetCheck()==BST_CHECKED)
  1054. {
  1055. pDC=m_Static_ShowBackgroundColor.GetDC();
  1056. m_Static_ShowBackgroundColor.GetClientRect(&rect);
  1057. m_BackgroundColor=m_Color;
  1058. brush.CreateSolidBrush(m_BackgroundColor);
  1059. pDC->FillRect(&rect,&brush);
  1060. brush.DeleteObject();
  1061. m_Static_ShowBackgroundColor.ReleaseDC(pDC);
  1062. }
  1063. m_Blue=GetBValue(color);
  1064. m_Slider_Blue.SetPos(m_Blue);
  1065. m_Red=GetRValue(color);
  1066. m_Slider_Red.SetPos(m_Red);
  1067. m_Green=GetGValue(color);
  1068. m_Slider_Green.SetPos(m_Green);
  1069. UpdateData(false);
  1070. }
  1071. void CDLineDlg2::OnBUTTONColorDlg()
  1072. {
  1073. // TODO: Add your control notification handler code here
  1074. CColorDialog dlg;
  1075. if(dlg.DoModal()==IDOK)
  1076. {
  1077. m_Color=dlg.m_cc.rgbResult;
  1078. this->OnChange(m_Color);
  1079. }
  1080. }
  1081. void CDLineDlg2::OnCHECKPen()
  1082. {
  1083. // TODO: Add your control notification handler code here
  1084. CDC * pDC;
  1085. CBrush brush;
  1086. CRect rect;
  1087. pDC=m_Static_ShowPenColor.GetDC();
  1088. m_Static_ShowPenColor.GetClientRect(&rect);
  1089. m_PenColor=m_Color;
  1090. brush.CreateSolidBrush(m_PenColor);
  1091. pDC->FillRect(&rect,&brush);
  1092. brush.DeleteObject();
  1093. m_Static_ShowPenColor.ReleaseDC(pDC);
  1094. }
  1095. void CDLineDlg2::OnCHECKBrush()
  1096. {
  1097. // TODO: Add your control notification handler code here
  1098. CDC * pDC;
  1099. CBrush brush;
  1100. CRect rect;
  1101. pDC=m_Static_ShowBrushColor.GetDC();
  1102. m_Static_ShowBrushColor.GetClientRect(&rect);
  1103. m_BrushColor=m_Color;
  1104. brush.CreateSolidBrush(m_BrushColor);
  1105. pDC->FillRect(&rect,&brush);
  1106. brush.DeleteObject();
  1107. m_Static_ShowBrushColor.ReleaseDC(pDC);
  1108. }
  1109. void CDLineDlg2::OnCHECKBackground()
  1110. {
  1111. // TODO: Add your control notification handler code here
  1112. CDC * pDC;
  1113. CBrush brush;
  1114. CRect rect;
  1115. pDC=m_Static_ShowBackgroundColor.GetDC();
  1116. m_Static_ShowBackgroundColor.GetClientRect(&rect);
  1117. m_BackgroundColor=m_Color;
  1118. brush.CreateSolidBrush(m_BackgroundColor);
  1119. pDC->FillRect(&rect,&brush);
  1120. brush.DeleteObject();
  1121. m_Static_ShowBackgroundColor.ReleaseDC(pDC);
  1122. }
  1123. HBRUSH CDLineDlg2::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
  1124. {
  1125. HBRUSH hbr = CPropertyPage::OnCtlColor(pDC, pWnd, nCtlColor);
  1126. // TODO: Change any attributes of the DC here
  1127. // TODO: Return a different brush if the default is not desired
  1128. pDC->SetTextColor(RGB(0,100,255));
  1129. pDC->SetBkColor(RGB(255,200,200));
  1130. pDC->SetBkMode(TRANSPARENT);
  1131. return hbr;
  1132. }