如何将inputbox的按钮变中文(100分)

  • 主题发起人 主题发起人 sntmpl
  • 开始时间 开始时间
S

sntmpl

Unregistered / Unconfirmed
GUEST, unregistred user!
用inputbox时显示的按钮为ok...如何能让其显示为“确定”.....
 
普通按钮&lt;input name="submit" type="button" value="确定"&gt;<br>提交按钮&lt;input name="submit" type="submit" value="确定"&gt;<br>
 
什么意思,怎么做
 
老兄,你说的是html,人家问的是delphi啊<br>自己修改一下dialogs的TButton.Create部分,改成自己想要的就行了
 
小海兄讲的是在网页里面显示一个按钮并在按钮上显示名称<br><br>你讲的是不是在delphi中改变系统的默认的显示,可能需要改vcl吧<br>我现在没有delphi不好做试验
 
请说的详细点好吗
 
改原文件就可以了不过最好还是自己照着写一个<br>function TFrmZD.MyInputQuery(const ACaption, APrompt: string;<br>&nbsp; var Value: string): Boolean;<br>&nbsp; function MyGetAveCharSize(Canvas: TCanvas): TPoint;<br>&nbsp; var<br>&nbsp; &nbsp; I: Integer;<br>&nbsp; &nbsp; Buffer: array[0..51] of Char;<br>&nbsp; begin<br>&nbsp; &nbsp; for I := 0 to 25 do Buffer := Chr(I + Ord('A'));<br>&nbsp; &nbsp; for I := 0 to 25 do Buffer[I + 26] := Chr(I + Ord('a'));<br>&nbsp; &nbsp; GetTextExtentPoint(Canvas.Handle, Buffer, 52, TSize(Result));<br>&nbsp; &nbsp; Result.X := Result.X div 52;<br>&nbsp; end;<br>var<br>&nbsp; Form: TForm;<br>&nbsp; Prompt: TLabel;<br>&nbsp; Edit: TEdit;<br>&nbsp; DialogUnits: TPoint;<br>&nbsp; ButtonTop, ButtonWidth, ButtonHeight: Integer;<br>begin<br>&nbsp; Result := False;<br>&nbsp; Form := TForm.Create(Application);<br>&nbsp; with Form do<br>&nbsp; try<br>&nbsp; &nbsp; Font.Assign(FrmZD.Font);<br>&nbsp; &nbsp; Canvas.Font := Font;<br>&nbsp; &nbsp; DialogUnits := MyGetAveCharSize(Canvas);<br>&nbsp; &nbsp; BorderStyle := bsDialog;<br>&nbsp; &nbsp; Caption := ACaption;<br>&nbsp; &nbsp; ClientWidth := MulDiv(180, DialogUnits.X, 4);<br>&nbsp; &nbsp; ClientHeight := MulDiv(63, DialogUnits.Y, 8);<br>&nbsp; &nbsp; Position := poScreenCenter;<br>&nbsp; &nbsp; Prompt := TLabel.Create(Form);<br>&nbsp; &nbsp; with Prompt do<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; Parent := Form;<br>&nbsp; &nbsp; &nbsp; AutoSize := True;<br>&nbsp; &nbsp; &nbsp; Left := MulDiv(8, DialogUnits.X, 4);<br>&nbsp; &nbsp; &nbsp; Top := MulDiv(8, DialogUnits.Y, 8);<br>&nbsp; &nbsp; &nbsp; Caption := APrompt;<br>&nbsp; &nbsp; end;<br>&nbsp; &nbsp; Edit := TEdit.Create(Form);<br>&nbsp; &nbsp; with Edit do<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; Parent := Form;<br>&nbsp; &nbsp; &nbsp; Left := Prompt.Left;<br>&nbsp; &nbsp; &nbsp; Top := MulDiv(19, DialogUnits.Y, 8);<br>&nbsp; &nbsp; &nbsp; Width := MulDiv(164, DialogUnits.X, 4);<br>&nbsp; &nbsp; &nbsp; MaxLength := 255;<br>&nbsp; &nbsp; &nbsp; Text := Value;<br>&nbsp; &nbsp; &nbsp; SelectAll;<br>&nbsp; &nbsp; end;<br>&nbsp; &nbsp; ButtonTop := MulDiv(41, DialogUnits.Y, 8);<br>&nbsp; &nbsp; ButtonWidth := MulDiv(50, DialogUnits.X, 4);<br>&nbsp; &nbsp; ButtonHeight := MulDiv(14, DialogUnits.Y, 8);<br>&nbsp; &nbsp; with TButton.Create(Form) do<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; Parent := Form;<br>&nbsp; &nbsp; &nbsp; Caption := '&amp;Egrave;·&amp;para;¨';<br>&nbsp; &nbsp; &nbsp; ModalResult := mrOk;<br>&nbsp; &nbsp; &nbsp; Default := True;<br>&nbsp; &nbsp; &nbsp; SetBounds(MulDiv(38, DialogUnits.X, 4), ButtonTop, ButtonWidth,<br>&nbsp; &nbsp; &nbsp; &nbsp; ButtonHeight);<br>&nbsp; &nbsp; end;<br>&nbsp; &nbsp; with TButton.Create(Form) do<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; Parent := Form;<br>&nbsp; &nbsp; &nbsp; Caption := '&amp;Egrave;&amp;iexcl;&amp;Iuml;&amp;ucirc;';<br>&nbsp; &nbsp; &nbsp; ModalResult := mrCancel;<br>&nbsp; &nbsp; &nbsp; Cancel := True;<br>&nbsp; &nbsp; &nbsp; SetBounds(MulDiv(92, DialogUnits.X, 4), ButtonTop, ButtonWidth,<br>&nbsp; &nbsp; &nbsp; &nbsp; ButtonHeight);<br>&nbsp; &nbsp; end;<br>&nbsp; &nbsp; if ShowModal = mrOk then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; Value := Edit.Text;<br>&nbsp; &nbsp; &nbsp; Result := True;<br>&nbsp; &nbsp; end;<br>&nbsp; finally<br>&nbsp; &nbsp; Form.Free;<br>&nbsp; end;<br>end;<br><br>function TFrmZD.MyInputBox(const ACaption, APrompt, ADefault: string): string;<br>begin<br>&nbsp; Result := ADefault;<br>&nbsp; MyInputQuery(ACaption, APrompt, Result);<br>end;<br>用的时候直接用自己的函数就行了,和InputBox InputQuery一样的用法
 
就是啊,把dialogs.pas里面inputquery拷出来改一下不就得了,不光可以改caption,还有font<br>啊什么的,或者干脆改成speedbutton,再加上icon,总之随便改啦
 
将vcl中的consts中的对应项改为中文
 
弄个新窗体得了
 
jlutt-sadan的方法通过了,我也学了一点非常感谢,其他人只能给点鼓励了
 
后退
顶部