Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

visual_xp_styles.inc 35KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114
  1. // Name: KOL Addon - Visual XP Styles
  2. // Rev.: 1.95
  3. // Date: 9 aug 2007 /18:49/
  4. // Author: MTsv DN
  5. // Thanks: mdw
  6. {$IFDEF _FPC}
  7. const
  8. clGrey = TColor($808080);
  9. clLtGrey = TColor($C0C0C0);
  10. clDkGrey = TColor($808080);
  11. {$ENDIF}
  12. //********************* Creating font on Sender font base ********************//
  13. function CreateNewFont(Sender : PControl): HFont;
  14. const
  15. CLEARTYPE_QUALITY = 5;
  16. var
  17. fnWeight : Integer;
  18. fnItalic, fnUnderline, fnStrikeOut,
  19. fnQuality, fnPitch : DWORD;
  20. begin
  21. // Font style
  22. if Sender.Font.FontStyle = [fsBold] then fnWeight := 700 else fnWeight := 0;
  23. if Sender.Font.FontStyle = [fsItalic] then fnItalic := DWORD(TRUE) else fnItalic := DWORD(FALSE);
  24. if Sender.Font.FontStyle = [fsUnderline] then fnUnderline := DWORD(TRUE) else fnUnderline := DWORD(FALSE);
  25. if Sender.Font.FontStyle = [fsStrikeOut] then fnStrikeOut := DWORD(TRUE) else fnStrikeOut := DWORD(FALSE);
  26. // Font quality
  27. case Sender.Font.FontQuality of
  28. fqAntialiased: fnQuality := DWORD(ANTIALIASED_QUALITY);
  29. {$IFDEF AUTO_REPLACE_CLEARTYPE}
  30. fqClearType: fnQuality := DWORD(CLEARTYPE_QUALITY);
  31. {$ELSE}
  32. fqClearType: fnQuality := DWORD(ANTIALIASED_QUALITY);
  33. {$ENDIF}
  34. fqDraft: fnQuality := DWORD(DRAFT_QUALITY);
  35. fqNonAntialiased: fnQuality := DWORD(NONANTIALIASED_QUALITY);
  36. fqProof: fnQuality := DWORD(PROOF_QUALITY);
  37. {fqDefault:} else fnQuality := DWORD(DEFAULT_QUALITY);
  38. end;
  39. // Font pitch
  40. case Sender.Font.FontPitch of
  41. fpFixed: fnPitch := DWORD(FIXED_PITCH);
  42. fpVariable: fnPitch := DWORD(VARIABLE_PITCH);
  43. {fpDefault:} else fnPitch := DWORD(DEFAULT_PITCH);
  44. end;
  45. Result := CreateFont(Sender.Font.FontHeight,
  46. Sender.Font.FontWidth,
  47. 0,
  48. Sender.Font.FontOrientation,
  49. fnWeight,
  50. fnItalic,
  51. fnUnderline,
  52. fnStrikeOut,
  53. Sender.Font.FontCharset,
  54. OUT_DEFAULT_PRECIS,
  55. CLIP_DEFAULT_PRECIS,
  56. fnQuality,
  57. fnPitch,
  58. PKOLChar(Sender.Font.FontName));
  59. end;
  60. //***************************** Initializing themes **************************//
  61. function InitThemes : boolean;
  62. begin
  63. Result := false;
  64. ThemeLibrary := LoadLibrary(themelib);
  65. if ThemeLibrary > 0 then
  66. begin
  67. OpenThemeData := GetProcAddress(ThemeLibrary, 'OpenThemeData');
  68. DrawThemeBackground := GetProcAddress(ThemeLibrary, 'DrawThemeBackground');
  69. IsThemeBackgroundPartiallyTransparent := GetProcAddress(ThemeLibrary, 'IsThemeBackgroundPartiallyTransparent');
  70. DrawThemeParentBackground := GetProcAddress(ThemeLibrary, 'DrawThemeParentBackground');
  71. DrawThemeText := GetProcAddress(ThemeLibrary, 'DrawThemeText');
  72. CloseThemeData := GetProcAddress(ThemeLibrary, 'CloseThemeData');
  73. IsThemeActive := GetProcAddress(ThemeLibrary, 'IsThemeActive');
  74. IsAppThemed := GetProcAddress(ThemeLibrary, 'IsAppThemed');
  75. GetThemeColor := GetProcAddress(ThemeLibrary, 'GetThemeColor');
  76. Result := true;
  77. end;
  78. end;
  79. //***************************** Deinitializing themes ************************//
  80. procedure DeinitThemes;
  81. begin
  82. if ThemeLibrary > 0 then
  83. begin
  84. FreeLibrary(ThemeLibrary);
  85. ThemeLibrary := 0;
  86. OpenThemeData := nil;
  87. DrawThemeBackground := nil;
  88. IsThemeBackgroundPartiallyTransparent := nil;
  89. DrawThemeParentBackground := nil;
  90. CloseThemeData := nil;
  91. IsAppThemed := nil;
  92. IsThemeActive := nil;
  93. GetThemeColor := nil;
  94. end;
  95. end;
  96. //****************************** Checking themes *****************************//
  97. procedure CheckThemes;
  98. // Check Manifest file or resource
  99. function IsManifestFilePresent : boolean;
  100. begin
  101. Result := false;
  102. if FileExists(ExePath + '.manifest') then
  103. begin
  104. Result := true;
  105. exit;
  106. end;
  107. if FindResource(hInstance, MAKEINTRESOURCE(1), MakeIntResource(24)) <> 0 then
  108. Result := true;
  109. end;
  110. // Check activity themes
  111. function UseThemes: Boolean;
  112. begin
  113. if (ThemeLibrary > 0) then Result := IsThemeActive
  114. else Result := False;
  115. end;
  116. begin
  117. AppTheming := false;
  118. if IsManifestFilePresent then
  119. if InitThemes then
  120. begin
  121. if UseThemes then
  122. AppTheming := true;
  123. DeinitThemes;
  124. end;
  125. end;
  126. //****************************** Drawing Splitter ****************************//
  127. procedure WndSplitterXPDraw( Dummy : Pointer; Sender: PControl; DC: HDC );
  128. const
  129. Bit : Word = $FF;
  130. var
  131. B, Brush : HBRUSH;
  132. fDC : HDC;
  133. Bmp : HBITMAP;
  134. begin
  135. // Checking user owner-draw
  136. if Assigned(Sender.fOnPaint) and (@Sender.fOnPaint <> @WndSplitterXPDraw) then
  137. begin
  138. Sender.fOnPaint(Sender, DC);
  139. exit;
  140. end;
  141. // Draw back layer
  142. Brush := CreateSolidBrush(Color2RGB(Sender.fParent.Color));
  143. fDC := SelectObject(DC, Brush);
  144. FillRect(DC, Sender.ClientRect, Brush);
  145. SelectObject(DC, fDC);
  146. DeleteObject(Brush);
  147. // Creating brush and pen
  148. if Sender.fPressed then
  149. begin
  150. Bmp := CreateBitmap(2, 2, 1, 1, @Bit);
  151. B := CreatePatternBrush(Bmp);
  152. fDC := SelectObject(DC, B);
  153. // Drawing splitter
  154. PatBlt (DC, 0, 0, Sender.Width, Sender.Height, PATINVERT);
  155. // Destroying brush and pen
  156. SelectObject(DC, fDC);
  157. DeleteObject(B);
  158. DeleteObject(Bmp);
  159. end;
  160. end;
  161. //*************************** Drawing TabControl Page ************************//
  162. procedure WndTabXPDraw( Dummy : Pointer; Sender: PControl; DC: HDC );
  163. var
  164. hThemes : THandle;
  165. Color : COLORREF;
  166. Brush : HBRUSH;
  167. fDC : HDC;
  168. begin
  169. // Checking user owner-draw
  170. if Assigned(Sender.fOnPaint) and (@Sender.fOnPaint <> @WndTabXPDraw) then
  171. begin
  172. Sender.fOnPaint(Sender, DC);
  173. exit;
  174. end;
  175. hThemes := OpenThemeData(Sender.fHandle, 'TAB');
  176. if hThemes <> 0 then
  177. begin
  178. GetThemeColor(hThemes, 10, 0, 3805, Color);
  179. Sender.Color := Color2RGB(Color);
  180. Brush := CreateSolidBrush(Color2RGB(Color));
  181. fDC := SelectObject(DC, Brush);
  182. FillRect(DC, Sender.ClientRect, Brush);
  183. SelectObject(DC, fDC);
  184. DeleteObject(Brush);
  185. CloseThemeData(hThemes);
  186. end;
  187. end;
  188. //*************************** Drawing Panel control **************************//
  189. procedure WndPanelXPResize( Dummy : Pointer; Sender: PObj );
  190. var
  191. R : TRect;
  192. begin
  193. R := PControl(Sender).ClientRect;
  194. InvalidateRect(PControl(Sender).fHandle, @R, False);
  195. end;
  196. procedure WndPanelXPDraw( Dummy : Pointer; Sender: PControl; DC: HDC );
  197. var
  198. RClient, RText : TRect;
  199. LPos : DWORD;
  200. S : KOLString;
  201. F : HFONT;
  202. fDC1, fDC2 : HDC;
  203. hThemes : THandle;
  204. TxtColor, Color : COLORREF;
  205. Brush : HBRUSH;
  206. Pen : HPEN;
  207. begin
  208. // Checking user owner-draw
  209. if Assigned(Sender.fOnPaint) and (@Sender.fOnPaint <> @WndPanelXPDraw) then
  210. begin
  211. Sender.fOnPaint(Sender, DC);
  212. exit;
  213. end;
  214. // Getting rects
  215. RClient := Sender.ClientRect;
  216. // Getting text and text flags
  217. S := Sender.fCaption;
  218. LPos := 0;
  219. if S <> '' then
  220. begin
  221. case Sender.fVerticalAlign of
  222. vaTop: LPos := DT_TOP;
  223. vaCenter: LPos := DT_VCENTER;
  224. vaBottom: LPos := DT_BOTTOM;
  225. end;
  226. case Sender.fTextAlign of
  227. taLeft: LPos := LPos or DT_LEFT;
  228. taCenter: LPos := LPos or DT_CENTER;
  229. taRight: LPos := LPos or DT_RIGHT;
  230. end;
  231. end;
  232. // Draw back layer
  233. if Sender.fedgeStyle <> esTransparent then
  234. begin
  235. Brush := CreateSolidBrush(Color2RGB(Sender.fParent.Color));
  236. fDC1 := SelectObject(DC, Brush);
  237. FillRect(DC, RClient, Brush);
  238. case Sender.fedgeStyle of
  239. esRaised, esLowered:
  240. begin
  241. Sender.fStyle := Sender.fStyle and (not SS_SUNKEN) and (not WS_DLGFRAME);
  242. Sender.fExStyle := Sender.fExStyle and (not WS_EX_STATICEDGE) or WS_EX_WINDOWEDGE;
  243. Pen := CreatePen(PS_SOLID, 1, Color2RGB(clLtGrey));
  244. fDC2 := SelectObject(DC, Pen);
  245. RoundRect(DC, RClient.Left, RClient.Top,
  246. RClient.Right, RClient.Bottom, 5, 5);
  247. SelectObject(DC, fDC2);
  248. DeleteObject(Pen);
  249. end;
  250. end;
  251. SelectObject(DC, fDC1);
  252. DeleteObject(Brush);
  253. end;
  254. if S <> '' then
  255. begin
  256. hThemes := OpenThemeData(Sender.fHandle, 'button');
  257. Color := Sender.Font.Color;
  258. if hThemes <> 0 then
  259. begin
  260. if not Sender.fEnabled then
  261. GetThemeColor(hThemes, 1, 4, 3803, Color);
  262. CloseThemeData(hThemes);
  263. end;
  264. RText := MakeRect(2, 2, Sender.Width-2, Sender.Height-2);
  265. // Create font
  266. F := CreateNewFont(Sender);
  267. fDC1 := SelectObject(DC, F);
  268. // Draw text
  269. SetBkMode(DC, TRANSPARENT);
  270. TxtColor := SetTextColor(DC, Color2RGB(Color));
  271. DrawText(DC, PKOLChar(S), Length(S), RText, LPos or DT_SINGLELINE);
  272. // Backup color
  273. SetTextColor(DC, Color2RGB(TxtColor));
  274. SetBkMode(DC, OPAQUE);
  275. // Destroying font
  276. SelectObject(DC, fDC1);
  277. DeleteObject(F);
  278. end;
  279. end;
  280. //************************** Drawing GroupBox control ************************//
  281. procedure WndGroupBoxXPDraw( Dummy : Pointer; Sender: PControl; DC: HDC );
  282. var
  283. hThemes : THandle;
  284. RClient, RText, RClipMain, RClipLeft, RClipRight : TRect;
  285. LPos, fState : DWORD;
  286. S : KOLString;
  287. F : HFONT;
  288. fDC : HDC;
  289. TxtColor, Color : COLORREF;
  290. TextWidth, TextHeight : Integer;
  291. begin
  292. // Checking user owner-draw
  293. if Assigned(Sender.fOnPaint) and (@Sender.fOnPaint <> @WndGroupBoxXPDraw) then
  294. begin
  295. Sender.fOnPaint(Sender, DC);
  296. exit;
  297. end;
  298. // Getting text and text flags
  299. LPos := 0;
  300. case Sender.fVerticalAlign of
  301. vaTop: LPos := DT_TOP;
  302. vaCenter: LPos := DT_VCENTER;
  303. vaBottom: LPos := DT_BOTTOM;
  304. end;
  305. case Sender.fTextAlign of
  306. taLeft: LPos := LPos or DT_LEFT;
  307. taCenter: LPos := LPos or DT_CENTER;
  308. taRight: LPos := LPos or DT_RIGHT;
  309. end;
  310. S := Sender.fCaption;
  311. // Getting rects
  312. TextWidth := Sender.Canvas.WTextWidth(S);
  313. TextHeight := Sender.Canvas.WTextHeight(S);
  314. RClient := Sender.ClientRect;
  315. RClient.Left := RClient.Left - Sender.MarginLeft;
  316. RClient.Top := RClient.Top - Sender.MarginTop + (TextHeight div 2);
  317. RClient.Right := RClient.Right + Sender.MarginRight;
  318. RClient.Bottom := RClient.Bottom + Sender.MarginBottom;
  319. case Sender.fTextAlign of
  320. taCenter:
  321. begin
  322. RText := MakeRect(((RClient.Right div 2) - (TextWidth div 2)) - 2,
  323. RClient.Top-6,
  324. ((RClient.Right div 2) + (TextWidth div 2)) + 2,
  325. TextHeight + (RClient.Top-6));
  326. RClipLeft := MakeRect(RClient.Left,
  327. RClient.Top,
  328. ((RClient.Right div 2) - (TextWidth div 2)) - 2,
  329. TextHeight + (RClient.Top-6));
  330. RClipRight := MakeRect(((RClient.Right div 2) + (TextWidth div 2)) + 2,
  331. RClient.Top-6,
  332. RClient.Right,
  333. TextHeight + (RClient.Top-6));
  334. end;
  335. taRight:
  336. begin
  337. RText := MakeRect((RClient.Right-4) - TextWidth,
  338. RClient.Top-6,
  339. RClient.Right-4,
  340. TextHeight + (RClient.Top-6));
  341. RClipLeft := MakeRect(RClient.Left,
  342. RClient.Top,
  343. (RClient.Right-4) - TextWidth,
  344. TextHeight + (RClient.Top-6));
  345. RClipRight := MakeRect(RClient.Right-4,
  346. RClient.Top-6,
  347. RClient.Right,
  348. TextHeight + (RClient.Top-6));
  349. end;
  350. else
  351. RText := MakeRect(RClient.Left+4,
  352. RClient.Top-6,
  353. TextWidth + RClient.Left+4,
  354. TextHeight + RClient.Top-6);
  355. RClipLeft := MakeRect(RClient.Left,
  356. RClient.Top,
  357. RClient.Left+4,
  358. TextHeight + RClient.Top-6);
  359. RClipRight := MakeRect(TextWidth + RClient.Left+4,
  360. RClient.Top-6,
  361. RClient.Right,
  362. TextHeight + RClient.Top-6);
  363. end;
  364. RClipMain := MakeRect(RClient.Left,
  365. TextHeight + RClient.Top-6,
  366. RClient.Right,
  367. RClient.Bottom);
  368. // Open themes
  369. hThemes := OpenThemeData(Sender.fHandle, 'button');
  370. if hThemes <> 0 then
  371. begin
  372. Sender.Color := Sender.fParent.Color;
  373. if Sender.fEnabled then fState := 1 else fState := 2;
  374. // Drawing GroupBox rect "step by step"
  375. DrawThemeBackground(hThemes, DC, 4{BP_GROUPBOX}, fState{GBS_XXXXXX}, RClient, @RClipMain);
  376. DrawThemeBackground(hThemes, DC, 4{BP_GROUPBOX}, fState{GBS_XXXXXX}, RClient, @RClipLeft);
  377. DrawThemeBackground(hThemes, DC, 4{BP_GROUPBOX}, fState{GBS_XXXXXX}, RClient, @RClipRight);
  378. // Drawing GroupBox text
  379. if not Sender.fEnabled then GetThemeColor(hThemes, 1, 4, 3803, Color)
  380. else GetThemeColor(hThemes, 4, 2, 3803, Color);
  381. // Close themes
  382. CloseThemeData(hThemes);
  383. // Create font
  384. F := CreateNewFont(Sender);
  385. fDC := SelectObject(DC, F);
  386. // Draw text
  387. SetBkMode(DC, TRANSPARENT);
  388. TxtColor := SetTextColor(DC, Color2RGB(Color));
  389. DrawText(DC, PKOLChar(S), Length(S), RText, LPos or DT_SINGLELINE);
  390. // Backup color
  391. SetTextColor(DC, Color2RGB(TxtColor));
  392. SetBkMode(DC, OPAQUE);
  393. // Destroying font
  394. SelectObject(DC, fDC);
  395. DeleteObject(F);
  396. end;
  397. end;
  398. //************************* Drawing CheckBox control *************************//
  399. procedure WndCheckBoxXPDraw( Dummy : Pointer; Sender: PControl; DC: HDC );
  400. var
  401. hThemes : THandle;
  402. RClient, RCheck, RText : TRect;
  403. fState : DWORD;
  404. W, H : Integer;
  405. S : KOLString;
  406. F : HFONT;
  407. fDC : HDC;
  408. Color : COLORREF;
  409. TxtColor : COLORREF;
  410. Brush : HBRUSH;
  411. begin
  412. // Checking user owner-draw
  413. if Assigned(Sender.fOnPaint) and (@Sender.fOnPaint <> @WndCheckBoxXPDraw) then
  414. begin
  415. Sender.fOnPaint(Sender, DC);
  416. exit;
  417. end;
  418. // Getting metrics
  419. W := GetSystemMetrics( SM_CXMENUCHECK );
  420. H := GetSystemMetrics( SM_CYMENUCHECK );
  421. // Getting caption
  422. S := Sender.fCaption;
  423. // Getting rects
  424. RClient := Sender.ClientRect;
  425. RCheck := RClient;
  426. RCheck.Right := RCheck.Left + W;
  427. if Sender.fWordWrap then
  428. RCheck.Top := RCheck.Top + Sender.Border
  429. else
  430. RCheck.Top := RCheck.Top + (RCheck.Bottom - RCheck.Top - H) div 2;
  431. RCheck.Bottom := RCheck.Top + H;
  432. RText := MakeRect(RCheck.Right + Sender.Border, RCheck.Top,
  433. RClient.Right, RCheck.Bottom);
  434. // Getting state
  435. fState := 1; {CBS_UNCHECKEDNORMAL}
  436. if not Sender.fEnabled then
  437. fState := 4 {CBS_UNCHECKEDDISABLED}
  438. else
  439. if Sender.fHot then
  440. fState := 2; {CBS_UNCHECKEDHOT}
  441. if Sender.fPressed then
  442. fState := 3{CBS_UNCHECKEDPRESSED};
  443. case Sender.Check3 of
  444. tsChecked : Inc( fState, 4 );
  445. tsIndeterminate : Inc( fState, 8 );
  446. end;
  447. // Draw back layer
  448. if not Sender.fTransparent then
  449. begin
  450. Brush := CreateSolidBrush(Color2RGB(Sender.fParent.Color));
  451. fDC := SelectObject(DC, Brush);
  452. FillRect(DC, RClient, Brush);
  453. SelectObject(DC, fDC);
  454. DeleteObject(Brush);
  455. end;
  456. // Draw theme
  457. Color := Sender.Font.Color;
  458. hThemes := OpenThemeData(Sender.fHandle, 'button');
  459. if hThemes <> 0 then
  460. begin
  461. if not Sender.fEnabled then
  462. GetThemeColor(hThemes, 1, 4, 3803, Color);
  463. DrawThemeBackground(hThemes, DC, 3 {BP_CHECKBOX}, fState, RCheck, @RCheck);
  464. CloseThemeData(hThemes);
  465. end;
  466. // Create font
  467. F := CreateNewFont(Sender);
  468. fDC := SelectObject(DC, F);
  469. // Draw text
  470. SetBkMode(DC, TRANSPARENT);
  471. TxtColor := SetTextColor(DC, Color2RGB(Color));
  472. DrawText(DC, PKOLChar(S), Length(S), RText, DT_LEFT or DT_VCENTER or DT_SINGLELINE);
  473. // Destroying font
  474. SetTextColor(DC, Color2RGB(TxtColor));
  475. SetBkMode(DC, OPAQUE);
  476. // Destroying object
  477. SelectObject(DC, fDC);
  478. DeleteObject(F);
  479. // Draw focusrect
  480. if GetFocus = Sender.fHandle then DrawFocusRect(DC, RClient);
  481. end;
  482. //************************* Drawing RadioBox control *************************//
  483. procedure WndRadioBoxXPDraw( Dummy : Pointer; Sender: PControl; DC: HDC );
  484. var
  485. hThemes : THandle;
  486. RClient, RDot, RText : TRect;
  487. fState : DWORD;
  488. W, H : Integer;
  489. S : KOLString;
  490. F : HFONT;
  491. fDC : HDC;
  492. Color, TxtColor : COLORREF;
  493. Brush : HBRUSH;
  494. begin
  495. // Checking user owner-draw
  496. if Assigned(Sender.fOnPaint) and (@Sender.fOnPaint <> @WndRadioBoxXPDraw) then
  497. begin
  498. Sender.fOnPaint(Sender, DC);
  499. exit;
  500. end;
  501. // Getting metrics
  502. W := GetSystemMetrics( SM_CXMENUCHECK );
  503. H := GetSystemMetrics( SM_CYMENUCHECK );
  504. // Getting caption
  505. S := Sender.fCaption;
  506. // Getting rects
  507. RClient := Sender.ClientRect;
  508. RDot := RClient;
  509. RDot.Right := RDot.Left + W;
  510. if Sender.fWordWrap then
  511. RDot.Top := RDot.Top + Sender.Border
  512. else
  513. RDot.Top := RDot.Top + (RDot.Bottom - RDot.Top - H) div 2;
  514. RDot.Bottom := RDot.Top + H;
  515. RText := MakeRect(RDot.Right + Sender.Border, RDot.Top,
  516. RClient.Right, RDot.Bottom);
  517. // Getting state
  518. fState := 1; {CBS_UNCHECKEDNORMAL}
  519. if not Sender.fEnabled then
  520. fState := 4 {CBS_UNCHECKEDDISABLED}
  521. else
  522. if Sender.fHot then
  523. fState := 2; {CBS_UNCHECKEDHOT}
  524. if Sender.fPressed then
  525. fState := 3{CBS_UNCHECKEDPRESSED};
  526. if Sender.Checked then
  527. Inc( fState, 4 );
  528. // Draw back layer
  529. if not Sender.fTransparent then
  530. begin
  531. Brush := CreateSolidBrush(Color2RGB(Sender.fParent.Color));
  532. fDC := SelectObject(DC, Brush);
  533. FillRect(DC, RClient, Brush);
  534. SelectObject(DC, fDC);
  535. DeleteObject(Brush);
  536. end;
  537. // Draw theme
  538. Color := Sender.Font.Color;
  539. hThemes := OpenThemeData(Sender.fHandle, 'button');
  540. if hThemes <> 0 then
  541. begin
  542. if not Sender.fEnabled then
  543. GetThemeColor(hThemes, 1, 4, 3803, Color);
  544. DrawThemeBackground(hThemes, DC, 2 {BP_RADIOBOX}, fState, RDot, @RDot);
  545. CloseThemeData(hThemes);
  546. end;
  547. // Create font
  548. F := CreateNewFont(Sender);
  549. fDC := SelectObject(DC, F);
  550. // Draw text
  551. SetBkMode(DC, TRANSPARENT);
  552. TxtColor := SetTextColor(DC, Color2RGB(Color));
  553. DrawText(DC, PKOLChar(S), Length(S), RText, DT_LEFT or DT_VCENTER or DT_SINGLELINE);
  554. // Destroying font
  555. SetTextColor(DC, Color2RGB(TxtColor));
  556. SetBkMode(DC, OPAQUE);
  557. // Destroying object
  558. SelectObject(DC, fDC);
  559. DeleteObject(F);
  560. // Draw focusrect
  561. if GetFocus = Sender.fHandle then DrawFocusRect(DC, RClient);
  562. end;
  563. //******************** Drawing Button and BitButton control ******************//
  564. procedure WndButtonXPDraw( Dummy : Pointer; Sender: PControl; DC: HDC );
  565. var
  566. hThemes : THandle;
  567. F : HFONT;
  568. fDC1, fDC2 : HDC;
  569. RClient : TRect;
  570. RText : TRect;
  571. RIcon : TRect;
  572. S : WideString;
  573. fState, bStyle : DWORD;
  574. Bmp : HBITMAP;
  575. W, H : Integer;
  576. HPos, VPos : DWORD;
  577. Brush : HBRUSH;
  578. Pen : HPEN;
  579. SenderWidth, SenderHeight : integer;
  580. begin
  581. // Checking user owner-draw
  582. if Assigned(Sender.fOnPaint) and (@Sender.fOnPaint <> @WndButtonXPDraw) then
  583. begin
  584. Sender.fOnPaint(Sender, DC);
  585. exit;
  586. end;
  587. if Assigned(Sender.fOnBitBtnDraw) then
  588. begin
  589. fState := 0{PBS_NORMAL};
  590. if not Sender.fEnabled then
  591. fState := 2{PBS_DISABLED}
  592. else
  593. if GetFocus = Sender.fHandle then
  594. fState := 3{PBS_PRESSED}
  595. else
  596. if Sender.fHot then
  597. fState := 4{PBS_HOT};
  598. if Sender.fPressed then
  599. fState := 1{PBS_PRESSED};
  600. Sender.fOnBitBtnDraw(Sender, fState);
  601. exit;
  602. end;
  603. // Getting rects
  604. RClient := Sender.ClientRect;
  605. RText := RClient;
  606. // Calc bitmap rect
  607. Bmp := Sender.fGlyphBitmap;
  608. HPos := 0; VPos := 0;
  609. if Bmp <> 0 then
  610. begin
  611. SenderWidth := Sender.Width;
  612. SenderHeight := Sender.Height;
  613. W := Sender.fGlyphWidth;
  614. H := Sender.fGlyphHeight;
  615. if Sender.fglyphLayout in [ glyphLeft ] then
  616. begin
  617. RIcon := MakeRect((SenderWidth div 2) - (W + (W div 4)),
  618. (SenderHeight div 2) - (H div 2),
  619. W, SenderHeight);
  620. RText.Left := (SenderWidth div 2) + (W div 4);
  621. HPos := DT_LEFT;
  622. VPos := DT_VCENTER;
  623. end;
  624. if Sender.fglyphLayout in [ glyphRight ] then
  625. begin
  626. RIcon := MakeRect((SenderWidth div 2) + (W div 4),
  627. (SenderHeight div 2) - (H div 2),
  628. W, SenderHeight);
  629. RText.Right := (SenderWidth div 2) - (W div 4);
  630. HPos := DT_RIGHT;
  631. VPos := DT_VCENTER;
  632. end;
  633. if Sender.fglyphLayout in [ glyphOver ] then
  634. begin
  635. RIcon := MakeRect((SenderWidth div 2) - (W div 2),
  636. (SenderHeight div 2) - (H div 2),
  637. W, SenderHeight);
  638. HPos := DT_CENTER;
  639. VPos := DT_VCENTER;
  640. end;
  641. if Sender.fglyphLayout in [ glyphTop ] then
  642. begin
  643. RIcon := MakeRect((SenderWidth div 2) - (W div 2),
  644. (SenderHeight div 2) - (H + (H div 4)),
  645. W, SenderHeight);
  646. RText.Top := (SenderHeight div 2) + (H div 4);
  647. HPos := DT_CENTER;
  648. VPos := DT_TOP;
  649. end;
  650. if Sender.fglyphLayout in [ glyphBottom ] then
  651. begin
  652. RIcon := MakeRect((SenderWidth div 2) - (W div 2),
  653. (SenderHeight div 2) + (H div 4),
  654. W, SenderHeight);
  655. RText.Bottom := (SenderHeight div 2) - (H div 4);
  656. HPos := DT_CENTER;
  657. VPos := DT_BOTTOM;
  658. end;
  659. end
  660. else
  661. begin
  662. HPos := DT_CENTER;
  663. VPos := DT_VCENTER;
  664. RIcon := MakeRect(0, 0, 0, 0);
  665. end;
  666. // Getting caption
  667. S := Sender.fCaption;
  668. // Getting state
  669. fState := 1{PBS_NORMAL};
  670. if not Sender.fEnabled then
  671. fState := 4{PBS_DISABLED}
  672. else
  673. if Sender.fHot then
  674. fState := 2{PBS_HOT};
  675. if Sender.fPressed then
  676. fState := 3{PBS_PRESSED};
  677. // Opening themes
  678. hThemes := OpenThemeData(Sender.fHandle, 'button');
  679. if hThemes <> 0 then
  680. begin
  681. Brush := CreateSolidBrush(Color2RGB(Sender.fParent.Color));
  682. fDC1 := SelectObject(DC, Brush);
  683. FillRect(DC, RClient, Brush);
  684. if (Sender.Flat) and (fState = 1{PBS_NORMAL}) then
  685. begin
  686. Pen := CreatePen(PS_SOLID, 1, clLtGrey);
  687. fDC2 := SelectObject(DC, Pen);
  688. RoundRect(DC, RClient.Left+2, RClient.Top+2, RClient.Right-2, RClient.Bottom-2, 3, 3);
  689. SelectObject(DC, fDC2);
  690. DeleteObject(Pen);
  691. end
  692. else
  693. DrawThemeBackground(hThemes, DC, 1{BP_PUSHBUTTON}, fState, RClient, @RClient);
  694. SelectObject(DC, fDC1);
  695. DeleteObject(Brush);
  696. if Bmp <> 0 then
  697. begin
  698. if Sender.fEnabled then bStyle := ILD_TRANSPARENT else bStyle := ILD_BLEND50;
  699. ImageList_Draw(Bmp, Sender.BitBtnImgIdx, DC, RIcon.Left, RIcon.Top, bStyle);
  700. end;
  701. // Create font
  702. F := CreateNewFont(Sender);
  703. fDC1 := SelectObject(DC, F);
  704. // Draw text
  705. DrawThemeText(hThemes, DC, 1{BP_PUSHBUTTON}, fState, PWideChar(S), Length(S),
  706. HPos or VPos or DT_SINGLELINE, 0, RText);
  707. // Destroying font
  708. SelectObject(DC, fDC1);
  709. DeleteObject(F);
  710. CloseThemeData(hThemes);
  711. end;
  712. if GetFocus = Sender.fHandle then
  713. DrawFocusRect(DC, MakeRect(RClient.Left+4, RClient.Top+4, RClient.Right-4, RClient.Bottom-4));
  714. end;
  715. //************************* Control MouseEnter event *************************//
  716. procedure WndXPMouseEnter( Dummy : Pointer; Sender: PObj );
  717. begin
  718. PControl(Sender).fHot := true;
  719. if Assigned(PControl(Sender).fOnMouseEnter) and
  720. (@PControl(Sender).fOnMouseEnter <> @WndXPMouseEnter) then
  721. PControl(Sender).fOnMouseEnter(Sender);
  722. end;
  723. //************************* Control MouseLeave event *************************//
  724. procedure WndXPMouseLeave( Dummy : Pointer; Sender: PObj );
  725. begin
  726. PControl(Sender).fHot := false;
  727. if Assigned(PControl(Sender).fOnMouseLeave) and
  728. (@PControl(Sender).fOnMouseLeave <> @WndXPMouseLeave) then
  729. PControl(Sender).fOnMouseLeave(Sender);
  730. end;
  731. //*************************** Control Message event **************************//
  732. function WndXPMessage( Sender: PControl; var Msg: TMsg; var Rslt: Integer ): Boolean;
  733. var
  734. pt : TPoint;
  735. Mouse: TMouseEventData;
  736. begin
  737. Result := false;
  738. case Msg.message of
  739. WM_LBUTTONDBLCLK:
  740. begin
  741. if Assigned(Sender.fOnMouseDblClk) then
  742. begin
  743. Mouse.Button := mbLeft;
  744. Mouse.StopHandling := false;
  745. Mouse.R1 := 0;
  746. Mouse.R2 := 0;
  747. Mouse.Shift := 120;
  748. Mouse.X := 0;
  749. Mouse.Y := 0;
  750. GetCursorPos(pt);
  751. if ScreenToClient(Sender.fHandle, pt) then
  752. begin
  753. Mouse.X := pt.X;
  754. Mouse.Y := pt.Y;
  755. end;
  756. Sender.fOnMouseDblClk(Sender, Mouse);
  757. end;
  758. if not Sender.fIsSplitter then
  759. SendMessage( Sender.fHandle, WM_LBUTTONDOWN, Msg.wParam, Msg.lParam );
  760. end;
  761. WM_LBUTTONDOWN:
  762. begin
  763. if Assigned(Sender.fOnMouseDown) then
  764. begin
  765. Mouse.Button := mbLeft;
  766. Mouse.StopHandling := false;
  767. Mouse.R1 := 0;
  768. Mouse.R2 := 0;
  769. Mouse.Shift := 120;
  770. Mouse.X := 0;
  771. Mouse.Y := 0;
  772. GetCursorPos(pt);
  773. if ScreenToClient(Sender.fHandle, pt) then
  774. begin
  775. Mouse.X := pt.X;
  776. Mouse.Y := pt.Y;
  777. end;
  778. Sender.fOnMouseDown(Sender, Mouse);
  779. end;
  780. Sender.fPressed := true;
  781. Sender.OnPaint(Sender, GetWindowDC(Msg.hWnd));
  782. end;
  783. WM_LBUTTONUP:
  784. begin
  785. if Assigned(Sender.fOnMouseUp) then
  786. begin
  787. Mouse.Button := mbLeft;
  788. Mouse.StopHandling := false;
  789. Mouse.R1 := 0;
  790. Mouse.R2 := 0;
  791. Mouse.Shift := 120;
  792. Mouse.X := 0;
  793. Mouse.Y := 0;
  794. GetCursorPos(pt);
  795. if ScreenToClient(Sender.fHandle, pt) then
  796. begin
  797. Mouse.X := pt.X;
  798. Mouse.Y := pt.Y;
  799. end;
  800. Sender.fOnMouseUp(Sender, Mouse);
  801. end;
  802. Sender.fPressed := false;
  803. Sender.OnPaint(Sender, GetWindowDC(Msg.hWnd));
  804. end;
  805. WM_KEYDOWN:
  806. begin
  807. if Msg.wParam = VK_SPACE then
  808. begin
  809. if Assigned(Sender.fOnKeyDown) then
  810. Sender.fOnKeyDown(Sender, Msg.wParam, GetShiftState);
  811. Sender.fPressed := true;
  812. Sender.OnPaint(Sender, GetWindowDC(Msg.hWnd));
  813. end;
  814. end;
  815. WM_KEYUP:
  816. begin
  817. if Msg.wParam = VK_SPACE then
  818. begin
  819. if Assigned(Sender.fOnKeyUp) then
  820. Sender.fOnKeyUp(Sender, Msg.wParam, GetShiftState);
  821. Sender.fPressed := false;
  822. Sender.OnPaint(Sender, GetWindowDC(Msg.hWnd));
  823. end;
  824. end;
  825. WM_KILLFOCUS:
  826. begin
  827. Sender.fHot := false;
  828. Sender.OnPaint(Sender, GetWindowDC(Msg.hWnd));
  829. end;
  830. WM_SETFOCUS:
  831. begin
  832. Sender.fHot := true;
  833. Sender.OnPaint(Sender, GetWindowDC(Msg.hWnd));
  834. Result := true;
  835. end;
  836. end;
  837. end;
  838. //*************************** Events for CheckBox ****************************//
  839. procedure XP_Themes_For_CheckBox(Sender : PControl);
  840. begin
  841. if AppTheming then
  842. Sender.OnPaint := TOnPaint( MakeMethod( nil, @WndCheckBoxXPDraw ) );
  843. end;
  844. //*************************** Events for RadioBox ****************************//
  845. procedure XP_Themes_For_RadioBox(Sender : PControl);
  846. begin
  847. if AppTheming then
  848. Sender.OnPaint := TOnPaint( MakeMethod( nil, @WndRadioBoxXPDraw ) );
  849. end;
  850. //**************************** Events for Panel ******************************//
  851. procedure XP_Themes_For_Panel(Sender : PControl);
  852. begin
  853. if AppTheming then
  854. begin
  855. if Sender.fedgeStyle = esTransparent then Sender.SetTransparent(True) else
  856. begin
  857. Sender.OnResize := TOnEvent( MakeMethod( nil, @WndPanelXPResize ) );
  858. Sender.OnPaint := TOnPaint( MakeMethod( nil, @WndPanelXPDraw ) );
  859. end;
  860. end;
  861. end;
  862. //*************************** Events for Splitter ****************************//
  863. procedure XP_Themes_For_Splitter(Sender : PControl);
  864. begin
  865. if AppTheming then
  866. begin
  867. Sender.AttachProc(WndXPMessage);
  868. Sender.OnPaint := TOnPaint( MakeMethod( nil, @WndSplitterXPDraw ) );
  869. end;
  870. end;
  871. //**************************** Events for Label ******************************//
  872. procedure XP_Themes_For_Label(Sender : PControl);
  873. begin
  874. if AppTheming then Sender.SetTransparent(True);
  875. end;
  876. //************************** Events for GroupBox *****************************//
  877. procedure XP_Themes_For_GroupBox(Sender : PControl);
  878. begin
  879. if AppTheming then
  880. Sender.OnPaint := TOnPaint( MakeMethod( nil, @WndGroupBoxXPDraw ) );
  881. end;
  882. //************************** Events for TabPanel *****************************//
  883. procedure XP_Themes_For_TabPanel(Sender : PControl);
  884. begin
  885. if AppTheming then
  886. Sender.OnPaint := TOnPaint( MakeMethod( nil, @WndTabXPDraw ) );
  887. end;
  888. //********************* Events for Button and BitButton **********************//
  889. procedure XP_Themes_For_BitBtn(Sender : PControl);
  890. begin
  891. if AppTheming then
  892. begin
  893. Sender.AttachProc(WndXPMessage);
  894. Sender.OnMouseEnter := TOnEvent( MakeMethod( nil, @WndXPMouseEnter ) );
  895. Sender.OnMouseLeave := TOnEvent( MakeMethod( nil, @WndXPMouseLeave ) );
  896. Sender.OnPaint := TOnPaint( MakeMethod( nil, @WndButtonXPDraw ) );
  897. end;
  898. end;
  899. //*********************** Deattach ownerdraw function ************************//
  900. procedure Deattach(Sender : PControl; PaintProc : Pointer);
  901. begin
  902. if Sender.IsProcAttached(WndXPMessage) then
  903. Sender.DetachProc(WndXPMessage);
  904. if Assigned(Sender.fOnMouseEnter) and (@Sender.fOnMouseEnter = @WndXPMouseEnter) and (not Sender.fFlat) then
  905. Sender.fOnMouseEnter := nil;
  906. if Assigned(Sender.fOnMouseLeave) and (@Sender.fOnMouseLeave = @WndXPMouseLeave) and (not Sender.fFlat) then
  907. Sender.fOnMouseLeave := nil;
  908. if Assigned(Sender.fOnPaint) and (@Sender.fOnPaint = PaintProc) then
  909. Sender.fOnPaint := nil;
  910. end;
  911. //********************* Handling of message WM_THEMECHANGED ******************//
  912. function WndXP_WM_THEMECHANGED( Sender: PControl; var Msg: TMsg; var Rslt: Integer ): Boolean;
  913. begin
  914. Result := false;
  915. if Msg.message = $31A {WM_THEMECHANGED} then
  916. begin
  917. if AppTheming then DeinitThemes;
  918. CheckThemes;
  919. if AppTheming then
  920. begin
  921. InitThemes;
  922. if ((Sender.fStyle and BS_AUTOCHECKBOX) = BS_AUTOCHECKBOX) and
  923. (Sender.SubClassName = 'obj_BUTTON') and
  924. (Sender.fIsGroupBox = false) and
  925. (Sender.fIsSplitter = false) and
  926. (Sender.fIsBitBtn = false) then
  927. begin
  928. XP_Themes_For_CheckBox(Sender);
  929. exit;
  930. end;
  931. if ((Sender.fStyle and BS_AUTO3STATE) = BS_AUTO3STATE) and
  932. (Sender.SubClassName = 'obj_BUTTON') and
  933. (Sender.fIsGroupBox = false) and
  934. (Sender.fIsSplitter = false) and
  935. (Sender.fIsBitBtn = false) then
  936. begin
  937. XP_Themes_For_CheckBox(Sender);
  938. exit;
  939. end;
  940. if ((Sender.fStyle and BS_RADIOBUTTON) = BS_RADIOBUTTON) and
  941. (Sender.SubClassName = 'obj_BUTTON') and
  942. (Sender.fIsGroupBox = false) and
  943. (Sender.fIsSplitter = false) and
  944. (Sender.fIsBitBtn = false) then
  945. begin
  946. XP_Themes_For_RadioBox(Sender);
  947. exit;
  948. end;
  949. if ((Sender.fStyle and BS_GROUPBOX) = BS_GROUPBOX) and
  950. (Sender.SubClassName = 'obj_BUTTON') and
  951. (Sender.fIsGroupBox = true) and
  952. (Sender.fIsSplitter = false) and
  953. (Sender.fIsBitBtn = false) then
  954. begin
  955. XP_Themes_For_GroupBox(Sender);
  956. exit;
  957. end;
  958. if (Sender.SubClassName = 'obj_BUTTON') and
  959. (Sender.fIsGroupBox = false) and
  960. (Sender.fIsSplitter = false) then
  961. begin
  962. XP_Themes_For_BitBtn(Sender);
  963. exit;
  964. end;
  965. if (Sender.SubClassName = 'obj_STATIC') then
  966. begin
  967. if Sender.fIsStaticControl > 0 then XP_Themes_For_Label(Sender)
  968. else
  969. begin
  970. if Sender.fIsSplitter then XP_Themes_For_Splitter(Sender)
  971. else
  972. begin
  973. if Sender.fParent.SubClassName = 'obj_SysTabControl32' then
  974. XP_Themes_For_TabPanel(Sender)
  975. else
  976. XP_Themes_For_Panel(Sender);
  977. end;
  978. end;
  979. exit;
  980. end;
  981. end
  982. else
  983. begin
  984. if ((Sender.fStyle and BS_AUTOCHECKBOX) = BS_AUTOCHECKBOX) and
  985. (Sender.SubClassName = 'obj_BUTTON') and
  986. (Sender.fIsGroupBox = false) and
  987. (Sender.fIsSplitter = false) and
  988. (Sender.fIsBitBtn = false) then
  989. begin
  990. Deattach(Sender, @WndCheckBoxXPDraw);
  991. exit;
  992. end;
  993. if ((Sender.fStyle and BS_AUTO3STATE) = BS_AUTO3STATE) and
  994. (Sender.SubClassName = 'obj_BUTTON') and
  995. (Sender.fIsGroupBox = false) and
  996. (Sender.fIsSplitter = false) and
  997. (Sender.fIsBitBtn = false) then
  998. begin
  999. Deattach(Sender, @WndCheckBoxXPDraw);
  1000. exit;
  1001. end;
  1002. if ((Sender.fStyle and BS_RADIOBUTTON) = BS_RADIOBUTTON) and
  1003. (Sender.SubClassName = 'obj_BUTTON') and
  1004. (Sender.fIsGroupBox = false) and
  1005. (Sender.fIsSplitter = false) and
  1006. (Sender.fIsBitBtn = false) then
  1007. begin
  1008. Deattach(Sender, @WndRadioBoxXPDraw);
  1009. exit;
  1010. end;
  1011. if ((Sender.fStyle and BS_GROUPBOX) = BS_GROUPBOX) and
  1012. (Sender.SubClassName = 'obj_BUTTON') and
  1013. (Sender.fIsGroupBox = true) and
  1014. (Sender.fIsSplitter = false) and
  1015. (Sender.fIsBitBtn = false) then
  1016. begin
  1017. Deattach(Sender, @WndGroupBoxXPDraw);
  1018. exit;
  1019. end;
  1020. if (Sender.SubClassName = 'obj_BUTTON') and
  1021. (Sender.fIsGroupBox = false) and
  1022. (Sender.fIsSplitter = false) then
  1023. begin
  1024. Deattach(Sender, @WndButtonXPDraw);
  1025. exit;
  1026. end;
  1027. if (Sender.SubClassName = 'obj_STATIC') then
  1028. begin
  1029. if Sender.fIsStaticControl > 0 then
  1030. else
  1031. begin
  1032. if Sender.fIsSplitter then Deattach(Sender, @WndSplitterXPDraw)
  1033. else
  1034. if Sender.fParent.SubClassName = 'obj_SysTabControl32' then
  1035. Deattach(Sender, @WndTabXPDraw)
  1036. else
  1037. begin
  1038. Deattach(Sender, @WndPanelXPDraw);
  1039. case Sender.fedgeStyle of
  1040. esRaised:
  1041. begin
  1042. Sender.fStyle := Sender.fStyle and (not SS_SUNKEN);
  1043. Sender.fExStyle := Sender.fExStyle and (not WS_EX_STATICEDGE);
  1044. Sender.fExStyle := Sender.fExStyle or WS_EX_WINDOWEDGE;
  1045. Sender.fStyle := Sender.fStyle or WS_DLGFRAME;
  1046. end;
  1047. esLowered:
  1048. begin
  1049. Sender.fStyle := Sender.fStyle and (not WS_DLGFRAME);
  1050. Sender.fExStyle := Sender.fExStyle or WS_EX_WINDOWEDGE;
  1051. Sender.fExStyle := Sender.fExStyle or WS_EX_STATICEDGE;
  1052. Sender.fStyle := Sender.fStyle or SS_SUNKEN;
  1053. end;
  1054. else
  1055. Sender.fStyle := Sender.fStyle and (not SS_SUNKEN) and (not WS_DLGFRAME);
  1056. Sender.fExStyle := Sender.fExStyle and (not WS_EX_STATICEDGE) or WS_EX_WINDOWEDGE;
  1057. end;
  1058. end;
  1059. end;
  1060. Sender.SetTransparent(Sender.fClassicTransparent);
  1061. exit;
  1062. end;
  1063. end;
  1064. end;
  1065. end;
  1066. //********************* Attaching to message WM_THEMECHANGED *****************//
  1067. procedure Attach_WM_THEMECHANGED(Sender : PControl);
  1068. begin
  1069. Sender.AttachProc(WndXP_WM_THEMECHANGED);
  1070. end;
  1071. //********************************* End File *********************************//