delphi 7中新建一个工程, 在窗体上粘贴如下代码,然后运行程序,你会发现TSpeedButton, TStaticText两中空间的字体变粗了。我使用的是windows xp sp2, delphi 7object pnl2: TPanel
Left = 216
Top = 88
Width = 409
Height = 41
TabOrder = 2
object pnl3: TPanel
Left = 1
Top = 1
Width = 407
Height = 39
Align = alClient
Caption = 'pnl3'
TabOrder = 0
object btn2: TSpeedButton
Left = 88
Top = 8
Width = 65
Height = 22
Caption = #20013#25991'asdf'
end
object lbl1: TLabel
Left = 272
Top = 18
Width = 48
Height = 12
Caption = #20013#25991'asdf'
end
object btn6: TBitBtn
Left = 8
Top = 5
Width = 75
Height = 25
Caption = #20013#25991'asdf'
TabOrder = 0
end
object txt1: TStaticText
Left = 216
Top = 18
Width = 52
Height = 16
Caption = #20013#25991'asdf'
TabOrder = 1
end
object btn10: TButton
Left = 328
Top = 5
Width = 75
Height = 25
Caption = #20013#25991'asdf'
TabOrder = 2
end
end
end
object pnl4: TPanel
Left = 216
Top = 136
Width = 409
Height = 41
Caption = 'pnl3'
TabOrder = 3
object btn7: TSpeedButton
Left = 88
Top = 8
Width = 65
Height = 22
Caption = #20013#25991'asdf'
end
object lbl2: TLabel
Left = 272
Top = 18
Width = 48
Height = 12
Caption = #20013#25991'asdf'
end
object btn8: TBitBtn
Left = 8
Top = 5
Width = 75
Height = 25
Caption = #20013#25991'asdf'
TabOrder = 0
end
object txt2: TStaticText
Left = 216
Top = 18
Width = 52
Height = 16
Caption = #20013#25991'asdf'
TabOrder = 1
end
object btn9: TButton
Left = 328
Top = 5
Width = 75
Height = 25
Caption = #20013#25991'asdf'
TabOrder = 2
end
end
object grp1: TGroupBox
Left = 216
Top = 192
Width = 409
Height = 73
Caption = 'grp1'
TabOrder = 4
object pnl5: TPanel
Left = 2
Top = 14
Width = 405
Height = 57
Align = alClient
Caption = 'pnl3'
TabOrder = 0
object btn11: TSpeedButton
Left = 88
Top = 8
Width = 65
Height = 22
Caption = #20013#25991'asdf'
end
object lbl3: TLabel
Left = 272
Top = 18
Width = 48
Height = 12
Caption = #20013#25991'asdf'
end
object btn12: TBitBtn
Left = 8
Top = 5
Width = 75
Height = 25
Caption = #20013#25991'asdf'
TabOrder = 0
end
object txt3: TStaticText
Left = 216
Top = 18
Width = 52
Height = 16
Caption = #20013#25991'asdf'
TabOrder = 1
end
object btn13: TButton
Left = 328
Top = 5
Width = 75
Height = 25
Caption = #20013#25991'asdf'
TabOrder = 2
end
end
end
object XPManifest1: TXPManifest
Left = 400
Top = 64
end
Left = 216
Top = 88
Width = 409
Height = 41
TabOrder = 2
object pnl3: TPanel
Left = 1
Top = 1
Width = 407
Height = 39
Align = alClient
Caption = 'pnl3'
TabOrder = 0
object btn2: TSpeedButton
Left = 88
Top = 8
Width = 65
Height = 22
Caption = #20013#25991'asdf'
end
object lbl1: TLabel
Left = 272
Top = 18
Width = 48
Height = 12
Caption = #20013#25991'asdf'
end
object btn6: TBitBtn
Left = 8
Top = 5
Width = 75
Height = 25
Caption = #20013#25991'asdf'
TabOrder = 0
end
object txt1: TStaticText
Left = 216
Top = 18
Width = 52
Height = 16
Caption = #20013#25991'asdf'
TabOrder = 1
end
object btn10: TButton
Left = 328
Top = 5
Width = 75
Height = 25
Caption = #20013#25991'asdf'
TabOrder = 2
end
end
end
object pnl4: TPanel
Left = 216
Top = 136
Width = 409
Height = 41
Caption = 'pnl3'
TabOrder = 3
object btn7: TSpeedButton
Left = 88
Top = 8
Width = 65
Height = 22
Caption = #20013#25991'asdf'
end
object lbl2: TLabel
Left = 272
Top = 18
Width = 48
Height = 12
Caption = #20013#25991'asdf'
end
object btn8: TBitBtn
Left = 8
Top = 5
Width = 75
Height = 25
Caption = #20013#25991'asdf'
TabOrder = 0
end
object txt2: TStaticText
Left = 216
Top = 18
Width = 52
Height = 16
Caption = #20013#25991'asdf'
TabOrder = 1
end
object btn9: TButton
Left = 328
Top = 5
Width = 75
Height = 25
Caption = #20013#25991'asdf'
TabOrder = 2
end
end
object grp1: TGroupBox
Left = 216
Top = 192
Width = 409
Height = 73
Caption = 'grp1'
TabOrder = 4
object pnl5: TPanel
Left = 2
Top = 14
Width = 405
Height = 57
Align = alClient
Caption = 'pnl3'
TabOrder = 0
object btn11: TSpeedButton
Left = 88
Top = 8
Width = 65
Height = 22
Caption = #20013#25991'asdf'
end
object lbl3: TLabel
Left = 272
Top = 18
Width = 48
Height = 12
Caption = #20013#25991'asdf'
end
object btn12: TBitBtn
Left = 8
Top = 5
Width = 75
Height = 25
Caption = #20013#25991'asdf'
TabOrder = 0
end
object txt3: TStaticText
Left = 216
Top = 18
Width = 52
Height = 16
Caption = #20013#25991'asdf'
TabOrder = 1
end
object btn13: TButton
Left = 328
Top = 5
Width = 75
Height = 25
Caption = #20013#25991'asdf'
TabOrder = 2
end
end
end
object XPManifest1: TXPManifest
Left = 400
Top = 64
end
object pnl1: TPanel
Left = 0
Top = 322
Width = 642
Height = 31
Align = alBottom
AutoSize = True
BevelOuter = bvNone
TabOrder = 1
object TPanel
Left = 0
Top = 0
Width = 642
Height = 31
Align = alBottom
BevelInner = bvRaised
BevelOuter = bvLowered
Font.Charset = GB2312_CHARSET
Font.Color = clRed
Font.Height = -12
Font.Name = #23435#20307
Font.Style = []
ParentFont = False
TabOrder = 0
DesignSize = (
642
31)
object btn3: TSpeedButton
Left = 9
Top = 5
Width = 75
Height = 22
Caption = #24110#21161'(&H)'
Flat = True
end
object btn4: TSpeedButton
Left = 473
Top = 5
Width = 75
Height = 22
Anchors = [akTop, akRight]
Caption = #20445#23384'(&S)'
Flat = True
end
object btn5: TSpeedButton
Left = 555
Top = 5
Width = 75
Height = 22
Anchors = [akTop, akRight]
Caption = #36864#20986'(&E)'
Flat = True
end
end
end
object TPanel
Left = 0
Top = 291
Width = 642
Height = 31
Align = alBottom
BevelInner = bvRaised
BevelOuter = bvLowered
Font.Charset = GB2312_CHARSET
Font.Color = clRed
Font.Height = -12
Font.Name = #23435#20307
Font.Style = []
ParentFont = False
TabOrder = 2
DesignSize = (
642
31)
object btn1: TSpeedButton
Left = 9
Top = 5
Width = 75
Height = 22
Caption = #24110#21161'(&H)'
Flat = True
end
object btn2: TSpeedButton
Left = 473
Top = 5
Width = 75
Height = 22
Anchors = [akTop, akRight]
Caption = #20445#23384'(&S)'
Flat = True
end
object btn6: TSpeedButton
Left = 555
Top = 5
Width = 75
Height = 22
Anchors = [akTop, akRight]
Caption = #36864#20986'(&E)'
Flat = True
end
end
object XPManifest1: TXPManifest
Left = 360
Top = 192
end
Font.Color = clRed
Font.Height = -12
Font.Name = #23435#20307
这个设置了字体了啊!
Line:1011
加入:
OldColor:=Canvas.Font.Color;
Canvas.Font.Color := clWhite;//此颜色不可与原来的颜色相同。
Canvas.Font.Color := OldColor;
当然需要先声明:
var
OldColor: TColor;
即可!
不知哪位高手能告诉为什么?