2个回答
展开全部
你还是自己定一个比较好一点这样就会没什麽限制
unit uStock_MesShow;
interface
uses
Windows ,Forms ,Controls ,StdCtrls ,Classes,Graphics,SysUtils;
type
TMyForm = class(TForm)
private
procedure buttclick(Sender:TObject);
public
constructor CreateNew(Title,MesStr:string;FAOwner:TComponent);reintroduce;
procedure FormShow;
end;
TDlgForm = class (TForm)
private
procedure buttclick(Sender:TObject);
procedure but2tclick(Sender:TObject);
public
constructor CreateNew(Title,MesStr:string;FAOwner:TComponent);reintroduce;
procedure FormShow;
end;
var
lb1:TLabel;
but,but2:TButton ;
Cen,len,ret:Integer;
StrTitle,strShow:string;
implementation
procedure TMyForm.buttclick(Sender: TObject);
begin
Close;
end;
constructor TMyForm.Createnew(Title,MesStr: string;FAOwner:TComponent);
begin
inherited CreateNew(FAOwner);
len := Length(MesStr);
Cen := len div 17;
strShow := MesStr;
StrTitle := Title;
lb1 := TLabel.Create(self);
but := TButton.Create(self);
Self.Width := 300;
Self.Height := 200;
Self.Position := poScreenCenter ;
end;
procedure TMyForm.FormShow;
begin
lb1.Parent := self;
lb1.AutoSize := false;
lb1.Left := 26 ;
lb1.Top := self.Top + 30;
lb1.Color := clRed ;
lb1.Width := self.Width -55;
if cen > 0 then lb1.Height := cen*20 ;
lb1.Alignment := taCenter;
lb1.Transparent := true;
if StrTitle = '' then self.Caption := '声动王提示讯息' else self.Caption := StrTitle;
lb1.Caption := strShow;
lb1.WordWrap := True;
but.Top := 90 ;
but.Left := self.Width div 2 -but.Width div 2;
but.Parent := self;
but.OnClick := buttclick;
but.Caption := ' 确定 ';
but.Default := true;
end;
constructor TDlgForm.CreateNew(Title,MesStr:string;FAOwner:TComponent);
begin
inherited CreateNew(FAOwner);
len := Length(MesStr);
Cen := len div 17;
strShow := MesStr;
StrTitle := Title;
lb1 := TLabel.Create(self);
but := TButton.Create(self);
but2 := TButton.Create(self);
Self.Width := 300;
Self.Height := 200;
Self.BorderStyle := bsDialog ;
Self.Position := poScreenCenter ;
Self.Hint := '0';
end;
procedure TDlgForm.FormShow;
begin
lb1.Parent := self;
lb1.AutoSize := false;
lb1.Left := 26 ;
lb1.Top := self.Top + 30;
lb1.Color := clRed ;
lb1.Width := self.Width -55;
if cen > 0 then lb1.Height := cen*20 ;
lb1.Alignment := taCenter;
lb1.Transparent := true;
if StrTitle = '' then self.Caption := 'Application is Error' else self.Caption := StrTitle;
lb1.Caption := strShow;
lb1.Font.color := clRed;
lb1.WordWrap := True;
but.Top := 90 ;
but.Left := self.Width div 2 - but.Width;
but.Parent := self;
but.OnClick := buttclick;
but.Caption := '确定';
but.Default := true;
but2.Top := 90 ;
but2.Left := self.Width div 2 +10;
but2.Parent := self;
but2.OnClick := but2tclick;
but2.Caption := '取消';
end;
procedure TDlgForm.buttclick(Sender:TObject);
begin
Self.Hint := '0';
Close;
end;
procedure TDlgForm.but2tclick(Sender:TObject);
begin
Self.Hint := '1';
Close;
end;
procedure MessageShow(str1, str2: string; Sender: TObject);
var
dd:TMyForm;
begin
try
dd:=TMyForm.Createnew(str1,str2,TForm(Sender));
dd.FormShow ;
dd.FormStyle := fsStayOnTop ;
dd.ShowModal ;
finally
FreeAndNil(dd);
end;
end;
end.
这里只用了一个label,你用两个就可以了
unit uStock_MesShow;
interface
uses
Windows ,Forms ,Controls ,StdCtrls ,Classes,Graphics,SysUtils;
type
TMyForm = class(TForm)
private
procedure buttclick(Sender:TObject);
public
constructor CreateNew(Title,MesStr:string;FAOwner:TComponent);reintroduce;
procedure FormShow;
end;
TDlgForm = class (TForm)
private
procedure buttclick(Sender:TObject);
procedure but2tclick(Sender:TObject);
public
constructor CreateNew(Title,MesStr:string;FAOwner:TComponent);reintroduce;
procedure FormShow;
end;
var
lb1:TLabel;
but,but2:TButton ;
Cen,len,ret:Integer;
StrTitle,strShow:string;
implementation
procedure TMyForm.buttclick(Sender: TObject);
begin
Close;
end;
constructor TMyForm.Createnew(Title,MesStr: string;FAOwner:TComponent);
begin
inherited CreateNew(FAOwner);
len := Length(MesStr);
Cen := len div 17;
strShow := MesStr;
StrTitle := Title;
lb1 := TLabel.Create(self);
but := TButton.Create(self);
Self.Width := 300;
Self.Height := 200;
Self.Position := poScreenCenter ;
end;
procedure TMyForm.FormShow;
begin
lb1.Parent := self;
lb1.AutoSize := false;
lb1.Left := 26 ;
lb1.Top := self.Top + 30;
lb1.Color := clRed ;
lb1.Width := self.Width -55;
if cen > 0 then lb1.Height := cen*20 ;
lb1.Alignment := taCenter;
lb1.Transparent := true;
if StrTitle = '' then self.Caption := '声动王提示讯息' else self.Caption := StrTitle;
lb1.Caption := strShow;
lb1.WordWrap := True;
but.Top := 90 ;
but.Left := self.Width div 2 -but.Width div 2;
but.Parent := self;
but.OnClick := buttclick;
but.Caption := ' 确定 ';
but.Default := true;
end;
constructor TDlgForm.CreateNew(Title,MesStr:string;FAOwner:TComponent);
begin
inherited CreateNew(FAOwner);
len := Length(MesStr);
Cen := len div 17;
strShow := MesStr;
StrTitle := Title;
lb1 := TLabel.Create(self);
but := TButton.Create(self);
but2 := TButton.Create(self);
Self.Width := 300;
Self.Height := 200;
Self.BorderStyle := bsDialog ;
Self.Position := poScreenCenter ;
Self.Hint := '0';
end;
procedure TDlgForm.FormShow;
begin
lb1.Parent := self;
lb1.AutoSize := false;
lb1.Left := 26 ;
lb1.Top := self.Top + 30;
lb1.Color := clRed ;
lb1.Width := self.Width -55;
if cen > 0 then lb1.Height := cen*20 ;
lb1.Alignment := taCenter;
lb1.Transparent := true;
if StrTitle = '' then self.Caption := 'Application is Error' else self.Caption := StrTitle;
lb1.Caption := strShow;
lb1.Font.color := clRed;
lb1.WordWrap := True;
but.Top := 90 ;
but.Left := self.Width div 2 - but.Width;
but.Parent := self;
but.OnClick := buttclick;
but.Caption := '确定';
but.Default := true;
but2.Top := 90 ;
but2.Left := self.Width div 2 +10;
but2.Parent := self;
but2.OnClick := but2tclick;
but2.Caption := '取消';
end;
procedure TDlgForm.buttclick(Sender:TObject);
begin
Self.Hint := '0';
Close;
end;
procedure TDlgForm.but2tclick(Sender:TObject);
begin
Self.Hint := '1';
Close;
end;
procedure MessageShow(str1, str2: string; Sender: TObject);
var
dd:TMyForm;
begin
try
dd:=TMyForm.Createnew(str1,str2,TForm(Sender));
dd.FormShow ;
dd.FormStyle := fsStayOnTop ;
dd.ShowModal ;
finally
FreeAndNil(dd);
end;
end;
end.
这里只用了一个label,你用两个就可以了
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Bitbtn不就可以改字体颜色了吗。。。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询