uses Dialogs;procedure TForm1.Button1Click(Sender: TObject);
var
InputString: string;
begin
InputString:= InputBox('Input Box', 'Prompt', 'Default string');end;
var
InputString: string;
begin
InputString:= InputBox('Input Box', 'Prompt', 'Default string');end;
解决方案 »
- 为什么我用DELPHI7编的东西杀毒软件都提示有病毒?
- 关于往文件头写标识,然后读取文件的问题
- 如何解决在VISTA系统下继续运行BDE连接SQLSERVER的程序的问题!!!!谢谢
- 谁知道哪能找到MapX的源代码?
- MDIChild的一个问题
- 请问一个关于用QReport做报表的问题
- 还是屏蔽系统功能键的问题!!
- 如何调试三层程序的中间层呢?
- 用delphi把excel表插入sql server数据库怎样做?
- TClientSocket不断尝试与TServerSocket连接,运行一段时间后的问题!
- 怎么取得一个机器中网卡的序列号??
- 请问 LoadBitmap(hInstance, 'BACKGROUND') 此函数的BACKGROUND windows资源自代马?
var
InputString: string;
begin
InputString := Caption;
if not InputQuery('Input Box', 'Prompt', InputString) then Exit;
Caption := InputString;
end;
begin
form1.Height:=edit1.Height;
form1.Width:=edit1.Width;
edit1.Top:=0;
edit1.Left:=0;
form1.BorderStyle:=bsnone;
end;end.这种方法一定行,试试吧。
函数声明:function InputBox(const ACaption, APrompt, ADefault: string): string;
描述:Description
Call InputBox to bring up an input dialog box ready for the user to enter a string in its edit box. ACaption is the caption of the dialog box.APrompt is the text that prompts the user to enter input in the edit box.ADefault is the string that appears in the edit box when the dialog box first appears.If the user chooses the Cancel button, InputBox returns the default string. If the user chooses the OK button, InputBox returns the string in the edit box.Use the InputBox function when there is a default value that should be used when the user chooses the Cancel button (or presses Esc) to exit the dialog. If the application needs to know whether the user chooses OK or Cancel, use the InputQuery function instead.例程:
uses Dialogs;procedure TForm1.Button1Click(Sender: TObject);
var
InputString: string;
begin
InputString:= InputBox('Input Box', 'Prompt', 'Default string');end;
也可用Delphi给的InputBox,很简单的,如果不明白的话,你可以看一下它的Help中的Sample