如何做弹出的选择提示框,如:是否继续操作? 显示按钮:是 否 取消(50分)

  • 主题发起人 fengyuyang
  • 开始时间
F

fengyuyang

Unregistered / Unconfirmed
GUEST, unregistred user!
MessageDlg('是否继续操作?',mtConfirmation,[mbYes, mbNo,mbCancel],0)
 
if MessageDlg('文件已存在,覆盖吗?',mtwarning,[mbyes,mbno], 0)=idno then
...
if MessageDlg('文件已存在,覆盖吗?',mtwarning,[mbyes,mbno], 0)=idyes then
...

 
application.messagebox('你要继续执行吗?','标题',mb_yesnocancel)
 
用MessageDlg显示出的对话框按钮是英文的。
建议使用MessageBox
if Application.MessageBox('内容','标题', MB_ICONQUESTION + MB_YESNOCANCEL) = MB_OK then
begin

end;
 
if application.messagebox('是否继续操作? ','提示',mb_yesno+mb_iconquestion)=idyes then
......
 
Application.MessageBox('是否继续操作?','提示...',MB_YESNOCANCEL+64);
 
在.net中不能用。
 
他们压根就不知道你是说的C#:
if (MessageBox.Show("提示","是否关闭?",MessageBoxButtons.YesNo )==DialogResult.Yes)
{
}
 
messagebox好
 
同意上楼的,用Application.MessageBox()的好
 
我ft,拜托你们看清楚别人用的是什么语言好不好啊
 
用createmessagedialog 来定制对话框,可以参照 delphi 的DEMOs/Ado/Adotest
procedure ShowProperties(Props: Properties);
var
I: Integer;
F: TForm;
Button: TButton;
begin
F := CreateMessageDialog('', mtInformation, [mbCancel]);
F.Height := Screen.Height div 2;
F.Width := Screen.Width div 2;
Button := F.Components[2] as TButton;
Button.Top := F.ClientHeight - Button.Height - 5;
Button.Left := (F.ClientWidth - Button.Width) div 2;
F.Caption := 'Properties';
with TMemo.Create(F)do
begin
SetBounds(5, 5, F.ClientWidth-10, F.ClientHeight - 40);
Parent := F;
for I := 0 to Props.Count - 1do
with Propsdo
Lines.Add(Format('%-30s: %s', [Name, VarToStr(Value)]));
end;
F.ShowModal;
end;
 
萧星离说的对!
 
一群白痴,。。。
 
同意萧星离。
private void button1_Click(object sender, System.EventArgs e)
{
if (MessageBox.Show(Form1.ActiveForm,"是否继续操作","提示",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Information)==DialogResult.No)
{
Form1.ActiveForm.Close() ;
}
}
 
private void validateUserEntry2()
{
// Checks the value of the text.
if(serverName.Text.Length == 0)
{
// Initializes the variables to pass to the MessageBox.Show method.
string message = "You did not enter a server name. Cancel this operation?";
string caption = "No Server Name Specified";
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
DialogResult result;
// Displays the MessageBox.
result = MessageBox.Show(this, message, caption, buttons,
MessageBoxIcon.Question, MessageBoxDefaultButton.Button1,
MessageBoxOptions.RightAlign);
if(result == DialogResult.Yes)
{
// Closes the parent form.
this.Close();
}
}
}
 
给你一个函数。。自己写的。感觉不错。。
呵呵~~~~(谁扔的鸡蛋!)
function MsgBox(Msg:Variant;Title:string;Flag:longint):integer;
//简化MessageBox函数
begin
if length(title)=0 then
title:=SAppName;
case flag of
0:flag:=MB_OK + MB_ICONINFORMATION;
1:flag:=MB_OK + MB_ICONERROR;
2:flag:=MB_YESNO + MB_ICONERROR;
3:flag:=MB_YESNO + MB_ICONWARNING;
4:flag:=MB_YesNo +MB_ICONQUESTION;
else
flag:=MB_OK + MB_ICONERROR;
end;
Result:=application.MessageBox(pchar(vartostr(Msg)),pchar(Title),flag);
end;
 
To:萧星离 &
realLearning
先谢谢你们。
我做的是ASP.NET Web应用程序,不知道要使用MessageBox,需要using那些名称空间。
 
要引用System.Windows.Forms
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
顶部