如何使showmessage出来的对话框 焦点不在按钮上 而是在showmessage出来的对话框上不用showmessage
Application.MessageBox也可以我就是不想让按钮获得焦点 就是说用户必须用鼠标点一下按钮才可以 不能一下回车就完了
Application.MessageBox也可以我就是不想让按钮获得焦点 就是说用户必须用鼠标点一下按钮才可以 不能一下回车就完了
File-->new-- >other
在弹出的窗口选Dialog页,有很多种,自己选
var h:HWND;
begin
timer1.Interval:=100;
h:=findwindow(0,'sssssss');
h:=FindWindowEx(h,0,'Static',0);
if h<>0 then
begin
SetWindowLong(h, GWL_STYLE, ES_CENTER);
SetActiveWindow(h);
end;
end;然后,你搞一个Button按扭放到窗体上,事件如下:
procedure TForm1.Button1Click(Sender: TObject);
begin
Application.MessageBox('哈哈哈哈','sssssss',1);
end;
封装在DLL里的,因为方便调用
图标是传参自定的,文字大小可以自定。
对话框大小可以根据文字多少变化,当然焦点可以自己自由设置的,
肯定会满足你的要求。
//如果需要的话,可以给我留言!
//部分代码如下://对话框的代码
case IconFlag of
Info : IconInfo.Visible := True;
Ask : IconAsk.Visible := True;
Err : IconErr.Visible := True;
Warn : IconWarn.Visible := True;
end; labelText.Caption := Text;
while labelText.Width > Self.Width-80 do
Self.Width := Self.Width + 10; btnConfirm.Left := Self.Width div 2- 70;
btnCancel.Left := Self.Width div 2; while labelText.Height > panelTop.Height- 43 do
Self.Height := Self.Height + 10;
//创建对话框
with TfrmDialog.Create(nil) do
begin
Text := aTxt;
IconFlag := aIcon;
Caption := acapt;
ShowModal;
Result := BtnFlag;
end;//调用的代码:
function ShowAsk(acapt,aTxt:ShortString;aIcon:Integer):Boolean;external 'Dialog.dll';
if ShowAsk('测试','我只是测试而只') then
begin
//
end;