怎样让delphi窗体默认字体为宋体9号,位置为屏幕中央?(100分)

  • 主题发起人 主题发起人 aRichMan
  • 开始时间 开始时间
用cnpack工具!
 
位置为屏幕中央不知道怎么做,设为宋体9号倒容易。
将以下文字存为一个注册表文件(*.REG),然后双击加入到注册表中即可。(6.0处按实际版本修改)
REGEDIT4
[HKEY_CURRENT_USER/Software/Borland/Delphi/6.0/FormDesign]
"DefaultFont"="/"宋体/",9"
 
只要将label的长度同form的一样,
再设置label的字居中即可.
 
to 月光宝盒
你好想跑题了
 
字体修改完毕,谢谢兄弟,大家还有其他技巧吗?
 
form的position为poScreenCenter
 
月光宝盒
我要求窗体的默认值为poScreenCenter ,而不是我去手动更改.
 
试试这个函数MessageDlgPos:
Displays a message dialog box at the specified screen coordinates.

Unit

QDialogs

Category

dialog and message routines

function MessageDlgPos(const Msg: WideString; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; HelpCtx: Longint; X, Y: Integer; DefaultBtn: TMsgDlgBtn = mbNone; Bitmap: TBitmap = nil): Integer;

Description

Call MessageDlgPos to bring up a message box at a particular location when you do not need to specify a caption. (If you need to specify the caption as well, use the MessageDlg function).

Msg is the content of the message that appears.

DlgType indicates the purpose of the dialog.

Buttons indicates what buttons should appear in the message box.

HelpCtx specifies the context ID for the help topic that should appear when the user clicks the help button or presses F1 while the dialog is displayed.

X and Y specify the screen coordinates where the dialog should appear. A value of ? means that the message box can appear anywhere in the specified dimension.

DefaultBtn specifies which button from among those specified by Buttons is the default button for the dialog. If DefaultBtn is mbNone, there is no default button.

Bitmap is an image that appears on the face of the message dialog. If Bitmap is nil, there is no image unless DlgType is mtConfirmation.

MessageDlgPos returns the value of the button the user selected. The following table lists the TMsgDlgBtn values for each type of button that can appear in the message box, and the corresponding value that is returned if the user selects that button:

TMsgDlgBtn Value Corresponding return value

mbOk mrOk
mbCancel mrCancel
mbYes mrYes
mbNo mrNo
mbAbort mrAbort
mbRetry mrRetry
mbIgnore mrIgnore
 
cnpack是什么工具啊?
 
cnpack 果然厉害
 
1.修改注册表,如上
2。加如如下消息处理:
//处理消息WM_WINDOWPOSCHANGING:设置窗体不可移动:
procedure OnPosChange(var Msg:TWMWindowPosChanging); message WM_WINDOWPOSCHANGING;
//设置窗体的顶点位置居中:
procedure TMainFrm.OnPosChange(var Msg:TWMWindowPosChanging);
begin
Msg.WindowPos.x:=(Screen.Width - Mainfrm.Width) div 2 ;
Msg.WindowPos.y:=(Screen.Height - Mainfrm.Height) div 2 - 20;
Msg.Result:=0;
end;
 
多人接受答案了。
 
后退
顶部