NO WAY!要么自己做窗体了
解决方案 »
- 我用stringgrid的drawcell做了很多东西,问个触发的问题
- Delphi 使用数据签名问题
- 郁闷了,请帮忙(人家开发了一个软件,我要接手,不会运行。。。。出错?)
- 如何取得"Windows"中的标准"文件夹选择框"就像是FlashGet中的那样.
- 关于AdoDataSet的Filter的问题,急救!!!!
- 一个很简单的问题:如何让用户不能拖动窗体大小
- 请高手指点,谢谢
- 请问如何利用Tnmhttp向指定ASP网页提交数据,插入记录到ACCESS数据库中
- 请问如何让某个字段的数据按照规定的格式显示?
- 如何共享一个文件夹?
- 关于程序运行中API函数、注册表和文件的监视工具!
- 关于Dll引出MDIChild的问题各位看看!hellion(恶人)和liang_z(千山一刀之忍者神龟)
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}uses
Consts;function GetAveCharSize(Canvas: TCanvas): TPoint;
var
I: Integer;
Buffer: array[0..51] of Char;
begin
for I := 0 to 25 do Buffer[I] := Chr(I + Ord('A'));
for I := 0 to 25 do Buffer[I + 26] := Chr(I + Ord('a'));
GetTextExtentPoint(Canvas.Handle, Buffer, 52, TSize(Result));
Result.X := Result.X div 52;
end;function InputQueryEx(const ACaption, APrompt: string; AFont: TFont;
var Value: string): Boolean;
var
Form: TForm;
Prompt: TLabel;
Edit: TEdit;
DialogUnits: TPoint;
ButtonTop, ButtonWidth, ButtonHeight: Integer;
begin
Result := False;
Form := TForm.Create(Application);
with Form do
try
Font.Assign(AFont);
Canvas.Font := Font;
DialogUnits := GetAveCharSize(Canvas);
BorderStyle := bsDialog;
Caption := ACaption;
ClientWidth := MulDiv(180, DialogUnits.X, 4);
Position := poScreenCenter;
Prompt := TLabel.Create(Form);
with Prompt do
begin
Parent := Form;
Caption := APrompt;
Left := MulDiv(8, DialogUnits.X, 4);
Top := MulDiv(8, DialogUnits.Y, 8);
Constraints.MaxWidth := MulDiv(164, DialogUnits.X, 4);
WordWrap := True;
end;
Edit := TEdit.Create(Form);
with Edit do
begin
Parent := Form;
Left := Prompt.Left;
Top := Prompt.Top + Prompt.Height + 5;
Width := MulDiv(164, DialogUnits.X, 4);
MaxLength := 255;
Text := Value;
SelectAll;
end;
ButtonTop := Edit.Top + Edit.Height + 15;
ButtonWidth := MulDiv(50, DialogUnits.X, 4);
ButtonHeight := MulDiv(14, DialogUnits.Y, 8);
with TButton.Create(Form) do
begin
Parent := Form;
Caption := SMsgDlgOK;
ModalResult := mrOk;
Default := True;
SetBounds(MulDiv(38, DialogUnits.X, 4), ButtonTop, ButtonWidth,
ButtonHeight);
end;
with TButton.Create(Form) do
begin
Parent := Form;
Caption := SMsgDlgCancel;
ModalResult := mrCancel;
Cancel := True;
SetBounds(MulDiv(92, DialogUnits.X, 4), Edit.Top + Edit.Height + 15,
ButtonWidth, ButtonHeight);
Form.ClientHeight := Top + Height + 13;
end;
if ShowModal = mrOk then
begin
Value := Edit.Text;
Result := True;
end;
finally
Form.Free;
end;
end;procedure TForm1.Button1Click(Sender: TObject);
var
S: string;
begin
S := Caption;
InputQueryEx('Input the caption', 'Input:', Font, S);
Caption := S;
end;end.
修改方法,新建一工程,将graphics.pas增加到该工程,然后编译,将graphics.dcu复制到delphi的lib目录下。
procedure InitDefFontData;
var
Charset: TFontCharset;
begin
DefFontData.Height := -MulDiv(8, ScreenLogPixels, 72);
if not SysLocale.FarEast then Exit;
Charset := GetDefFontCharset;
case Charset of
SHIFTJIS_CHARSET:
begin
DefFontData.Name := '俵俽 俹僑僔僢僋';
DefFontData.Height := -MulDiv(9, ScreenLogPixels, 72);
DefFontData.CharSet := CharSet;
end;
GB2312_CHARSET: //这里一段由自已增加
begin
DefFontData.Name := '宋体';
DefFontData.Height := -MulDiv(9, ScreenLogPixels, 72);
DefFontData.CharSet := CharSet;
end;
end;
end;