不是说好不改字体么。。
而且这样的效果是,如果AutoSize=False,没字的地方直接没有线。。别和我说加空格
而且这样的效果是,如果AutoSize=False,没字的地方直接没有线。。别和我说加空格
解决方案 »
- 大家帮忙啊 怎样获取 硬盘的个数 和每块硬盘的 串号 啊??
- 特急﹗﹗ delphi2005安裝后﹐注冊不成功???無法使用﹗
- 上次问的问题,揭贴早了没有解决。就是如何在delphi里实现公交车刷卡那种悦耳的声音?
- 将Table的数据保存时出现“Record/deleted.”何故,如何解决?
- 求ado连接sql数据库的源代码
- 怎样在form中用程序判断表(paradox)是否纯在?
- 天大的美事------------100大方 送出,行动吧各位仁兄。
- forgot2000的散分帖:庆祝CSDN改版,调查一下大家平时空闲时间喜欢做什么?一定给分!
- DELPHI里那个语句的功能和vb里的raiseevent一样
- 这样的表如何排序打印
- Delphi悬浮窗任务栏
- delphi 如何禁止应用访问网络
type
TUnderLineLabel = class(TLabel)
protected
procedure Paint; override;
end;
procedure TUnderLineLabel.Paint;
begin
inherited;
with Canvas do begin
Pen.Style := psSolid; //实线
Pen.Color := clBlack; //线条颜色
MoveTo(0 , ClientRect.Bottom-1);
LineTo(ClientRect.Right,ClientRect.Bottom-1);
end;
end;
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TmyLabel = class(TLabel)
procedure Paint; override;
end;
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}{ TmyLabel }procedure TmyLabel.Paint;
begin
inherited;
self.Canvas.Pen.Color := clred;
self.Canvas.MoveTo(0,self.Height - 1);
self.Canvas.LineTo(self.Width,self.Height - 1);
end;procedure TForm1.Button1Click(Sender: TObject);
begin
with TmyLabel.Create(self) do
begin
AutoSize := False;
Caption := '测试';
Width := 100;
Height := 13;
left := 50; top := 50;
Parent := self;
end;
end;end.
这个???
protected
procedure AdjustBounds; dynamic;
procedure DoDrawText(var Rect: TRect; Flags: Longint); dynamic;而Paint里面是如下这样:
with Canvas do
begin
..............
DoDrawText(Rect, DrawStyle);
end;于是我就override了这个DoDrawText,加了画线代码,咋就失败了,求解
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TmyLabel = class(TLabel)
procedure Paint; override;
procedure DoDrawText(var Rect: TRect; Flags: Longint);override;
end;
TForm1 = class(TForm)
Button1: TButton; procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}{ TmyLabel }procedure TmyLabel.DoDrawText;
begin
inherited;
self.Canvas.Pen.Color := clred;
self.Canvas.MoveTo(0,self.Height - 1);
self.Canvas.LineTo(self.Width,self.Height - 1);end;procedure TmyLabel.Paint;
begin
inherited;end;procedure TForm1.Button1Click(Sender: TObject);
begin
with TmyLabel.Create(self) do
begin
AutoSize := False;
Caption := '测试';
Width := 100;
Height := 13;
left := 50; top := 50;
Parent := self;
end;
end;end.不懂你意思。