浏览代码

margin in ColorSpeedButton

lainz 8 年之前
父节点
当前提交
0e9f738717
共有 2 个文件被更改,包括 12 次插入4 次删除
  1. 1 1
      colorspeedbutton.pas
  2. 11 3
      test/test_colorspeedbutton/umain.lfm

+ 1 - 1
colorspeedbutton.pas

@@ -334,7 +334,7 @@ begin
           TextStyle.Wordbreak := True;
           TextStyle.Alignment := taCenter;
           TextStyle.Layout := tlCenter;
-          Canvas.TextRect(Rect(0,0, Width, Height), 0, 0, Caption, TextStyle);
+          Canvas.TextRect(Rect(Margin,Margin, Width-Margin, Height-Margin), 0, 0, Caption, TextStyle);
         end;
       end;
     end;

+ 11 - 3
test/test_colorspeedbutton/umain.lfm

@@ -14,6 +14,7 @@ object Form1: TForm1
     Top = 17
     Width = 150
     Caption = 'Button'
+    Font.Color = clBlack
     Glyph.Data = {
       36100000424D3610000000000000360000002800000020000000200000000100
       2000000000000010000064000000640000000000000000000000000000000000
@@ -148,6 +149,7 @@ object Form1: TForm1
     }
     Layout = blGlyphTop
     Margin = 30
+    ParentFont = False
     PopupMode = False
     StateNormal.Color = 14803425
     StateNormal.BorderColor = 11382189
@@ -169,6 +171,7 @@ object Form1: TForm1
     Width = 150
     Caption = 'Disabled'
     Enabled = False
+    Font.Color = clBlack
     Glyph.Data = {
       36100000424D3610000000000000360000002800000020000000200000000100
       2000000000000010000064000000640000000000000000000000000000000000
@@ -301,6 +304,7 @@ object Form1: TForm1
       AEFF7799AEFF7799ADD17696A972627D8C0E0000000000000000000000042222
       22AF242424FF242524FF242424B0000000040000000000000000
     }
+    ParentFont = False
     PopupMode = False
     StateNormal.Color = 14803425
     StateNormal.BorderColor = 11382189
@@ -321,6 +325,7 @@ object Form1: TForm1
     Top = 17
     Width = 144
     Caption = 'Popup'
+    Font.Color = clBlack
     Glyph.Data = {
       36100000424D3610000000000000360000002800000020000000200000000100
       2000000000000010000064000000640000000000000000000000FFFFFF00FFFF
@@ -453,6 +458,7 @@ object Form1: TForm1
       FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
       FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
     }
+    ParentFont = False
     PopupMenu = PopupMenu1
     PopupMode = True
     StateNormal.Color = 14803425
@@ -500,11 +506,13 @@ object Form1: TForm1
   end
   object ColorSpeedButton4: TColorSpeedButton
     Left = 480
-    Height = 63
+    Height = 135
     Top = 17
-    Width = 88
+    Width = 104
     Caption = 'Multi Line Text'
-    Margin = 0
+    Font.Color = clBlack
+    Margin = 50
+    ParentFont = False
     PopupMode = False
     StateNormal.Color = 14803425
     StateNormal.BorderColor = 11382189