Народ, появилась проблемма...
Надо сделать TLabelEx, у которого будет надпись из WizardForm.DirEdit
с обычным Tlabel будет как-то так:
А с TLabelEx не получается.
Если, что вот код (TlabelEx):
Надо сделать TLabelEx, у которого будет надпись из WizardForm.DirEdit
с обычным Tlabel будет как-то так:
Код:
[_Code]
var
SelDir: TLabel;
procedure DirEditOnChange(Sender: TObject);
begin;
SelDir.Caption := MinimizePathName(WizardForm.DirEdit.Text, SelDir.Font, SelDir.Width);
end;
procedure InitializeWizard;
begin
with WizardForm do begin
DirEdit.OnChange:=@DirEditOnChange;
end;
with SelDir do begin
SetBounds(ScaleX(183), ScaleY(182), ScaleX(290), ScaleY(18));
AutoSize := False;
WordWrap := False;
Font.Name:= 'Arial';
Font.Size:= 10;
Font.Style := [fsBold];
ShowAccelChar := False;
Caption := MinimizePathName(WizardForm.DirEdit.Text, SelDir.Font, SelDir.Width);
Font.Color := $FFFFFF;
Transparent := True;
Parent := WizardForm;
end;
end;
Если, что вот код (TlabelEx):
Код:
[_Code]
type
TLabelEx = record Massive: array [0..3] of TLabel; TextLabel: TLabel; end;
function LabelCreateEx(ALeft, ATop, AWidth, AHeight: Integer; FontName: String; FontSize: Integer; FontStyle: TFontStyles; FontColor, ShadowColor: TColor; AAutoSize, ATransparent, AWordWrap: Boolean; AAlignment: TAlignment; AParent: TWinControl; Text: String): TLabelEx;
var i: integer; tmp: TLabelEx;
begin
for i:= 0 to 3 do begin
tmp.Massive[i]:= TLabel.Create(WizardForm);
with tmp.Massive[i] do begin
SetBounds(ALeft, ATop, AWidth, AHeight);
case i of
0: Left:=Left-1;
1: Left:=Left+1;
2: Top:= Top-1;
3: Top:= Top+1;
end;
AutoSize:= AAutoSize;
Alignment:= AAlignment;
Transparent:= ATransparent;
WordWrap:= AWordWrap;
Font.Name:= FontName;
Font.Size:= FontSize;
Font.Style:= FontStyle;
Font.Color:= ShadowColor;
Caption:= Text;
Parent:= AParent;
end;
end;
tmp.TextLabel:= TLabel.Create(WizardForm);
with tmp.TextLabel do begin
SetBounds(ALeft, ATop, AWidth, Aheight);
AutoSize:= AAutoSize;
Alignment:= AAlignment;
Transparent:= ATransparent;
WordWrap:= AWordWrap;
Font.Name:= FontName;
Font.Size:= FontSize;
Font.Style:= FontStyle;
Font.Color:= FontColor;
Caption:= Text;
Parent:= AParent;
end;
Result:= tmp;
end;
procedure HideLabelEx(Line: TLabelEx);
var i: integer;
begin for i:=0 to 3 do begin
Line.Massive[i].Hide;
end;
Line.TextLabel.Hide;
end;
procedure ShowLabelEx(Line: TLabelEx);
var i: integer;
begin for i:=0 to 3 do begin
Line.Massive[i].Show;
end;
Line.TextLabel.Show;
end;
procedure SetLabelExCaption(var Line: TLabelEx; Text: String);
var i: Integer;
begin for i:=0 to 3 do begin
Line.Massive[i].Caption:=Text
end;
Line.TextLabel.Caption:= Text;
end;
procedure SetLabelExColor(var Line: TLabelEx; BackColor, TextColor: TColor);
var i: Integer;
begin for i:=0 to 3 do begin
Line.Massive[i].Font.Color:= BackColor;
end;
Line.TextLabel.Font.Color:= TextColor;
end;
procedure SetLabelExEvent(var Line: TlabelEx; ClickEvent: TNotifyEvent; MouseDown, MouseUp: TMouseEvent; MouseMove: TMouseMoveEvent);
begin
If ClickEvent <> nil then Line.TextLabel.OnClick:= ClickEvent;
If MouseDown <> nil then Line.TextLabel.OnMouseDown:= MouseDown;
If MouseUp <> nil then Line.TextLabel.OnMouseUp:= MouseUp;
If MouseMove <> nil then Line.TextLabel.OnMouseMove:= MouseMove;
end;