M
maxim
Unregistered / Unconfirmed
GUEST, unregistred user!
各位大侠:
我想编写一个带下划线的Label控件,可是不管我怎么搞都看不到线,请各位大侠
给俺瞧瞧:(如果分不够我还可以加)
unit mxLabelLine;
interface
uses
Windows, Messages, SysUtils, Classes, Controls, StdCtrls,ExtCtrls;
type
TmxLabelLine = class(TLabel)
private
FmLine: TShape;
procedure WMSize (var Message: TWMSize); message WM_SIZE;
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create(AOwner:TComponent);override;
destructor Destroy;override;
published
{ Published declarations }
property mLine: TShape read FmLine;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('MxDBTools', [TmxLabelLine]);
end;
{ TmxLabelLine }
constructor TmxLabelLine.Create(AOwner: TComponent);
begin
inherited;
FmLine := TShape.Create (Self);
FmLine.Visible := TRue;
FmLine.Top:=Self.Top+self.Height+2;
FmLine.Height :=1;
FmLine.Pen.Color:=$000080FF;
// ControlStyle := ControlStyle - [csSetCaption];
end;
destructor TmxLabelLine.Destroy;
begin
FmLine := nil;
inherited Destroy;
end;
procedure TmxLabelLine.WMSize(var Message: TWMSize);
var
MinWidth: Integer;
begin
inherited;
if width < MinWidth then
width := MinWidth
else
if FmLine <> nil then
begin
FmLine.SetBounds(0,height+2,Width+2,1)
end;
end;
end.
我想编写一个带下划线的Label控件,可是不管我怎么搞都看不到线,请各位大侠
给俺瞧瞧:(如果分不够我还可以加)
unit mxLabelLine;
interface
uses
Windows, Messages, SysUtils, Classes, Controls, StdCtrls,ExtCtrls;
type
TmxLabelLine = class(TLabel)
private
FmLine: TShape;
procedure WMSize (var Message: TWMSize); message WM_SIZE;
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create(AOwner:TComponent);override;
destructor Destroy;override;
published
{ Published declarations }
property mLine: TShape read FmLine;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('MxDBTools', [TmxLabelLine]);
end;
{ TmxLabelLine }
constructor TmxLabelLine.Create(AOwner: TComponent);
begin
inherited;
FmLine := TShape.Create (Self);
FmLine.Visible := TRue;
FmLine.Top:=Self.Top+self.Height+2;
FmLine.Height :=1;
FmLine.Pen.Color:=$000080FF;
// ControlStyle := ControlStyle - [csSetCaption];
end;
destructor TmxLabelLine.Destroy;
begin
FmLine := nil;
inherited Destroy;
end;
procedure TmxLabelLine.WMSize(var Message: TWMSize);
var
MinWidth: Integer;
begin
inherited;
if width < MinWidth then
width := MinWidth
else
if FmLine <> nil then
begin
FmLine.SetBounds(0,height+2,Width+2,1)
end;
end;
end.