本文整理汇总了C#中Window.Init方法的典型用法代码示例。如果您正苦于以下问题:C# Window.Init方法的具体用法?C# Window.Init怎么用?C# Window.Init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Window
的用法示例。
在下文中一共展示了Window.Init方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialize
public override void Initialize() {
base.Initialize();
mDialog = new Window(WindowManager);
mDialog.Init();
mDialog.Width = mWidth;
mDialog.Height = mHeight;
mDialog.Text = mTitle;
mDialog.Visible = true;
mDialog.Resizable = false;
mDialog.Closed += new WindowClosedEventHandler(mDialog_Closed);
Label lbl = new Label(WindowManager);
lbl.Init();
lbl.Width = mDialog.ClientWidth - 10;
lbl.Height = mDialog.ClientHeight - 40;
lbl.Left = 5;
lbl.Top = 5;
lbl.Text = mMessage;
lbl.Alignment = EAlignment.TopCenter;
mDialog.Add(lbl);
Panel pnl = new Panel(WindowManager);
pnl.Height = 40;
pnl.Top = mDialog.ClientHeight - pnl.Height;
pnl.BevelBorder = EBevelBorder.Top;
pnl.BevelMargin = 1;
pnl.BackColor = new Color(16, 16, 16);
pnl.Anchor = EAnchors.Bottom | EAnchors.Horizontal;
pnl.Width = mDialog.ClientWidth;
mDialog.Add(pnl);
/*
* wont work oO
Button btnOK = new Button( WindowManager );
btnOK.Init();
//btnOK.Width = 20;
btnOK.Height = 24;
btnOK.Text = "OK";
btnOK.Click += new WindowLibrary.Controls.EventHandler( btnOK_Click );
pnl.Controls.Add( btnOK );
*/
AddWindow(mDialog);
}
示例2: btnRandom_Click
void btnRandom_Click(object sender, Controls.EventArgs e) {
Window win = new Window(Manager);
Button btn = new Button(Manager);
TextBox txt = new TextBox(Manager);
win.Init();
btn.Init();
txt.Init();
win.ClientWidth = 320;
win.ClientHeight = 160;
win.MinimumWidth = 128;
win.MinimumHeight = 128;
Random r = new Random((int)Central.Frames);
win.ClientWidth += r.Next(-100, +100);
win.ClientHeight += r.Next(-100, +100);
win.Left = r.Next(200, Manager.ScreenWidth - win.ClientWidth / 2);
win.Top = r.Next(0, Manager.ScreenHeight - win.ClientHeight / 2);
win.Closed += new WindowClosedEventHandler(win_Closed);
/*
win.Width = 1024;
win.Height = 768;
win.Left = 220;
win.Top = 0;
win.StayOnBack = true;
win.SendToBack();
*/
btn.Anchor = EAnchors.Bottom;
btn.Left = (win.ClientWidth / 2) - (btn.Width / 2);
btn.Top = win.ClientHeight - btn.Height - 8;
btn.Text = "OK";
win.Text = "Window (" + win.Width.ToString() + "x" + win.Height.ToString() + ")";
txt.Parent = win;
txt.Left = 8;
txt.Top = 8;
txt.Width = win.ClientArea.Width - 16;
txt.Height = win.ClientArea.Height - 48;
txt.Anchor = EAnchors.All;
txt.Mode = ETextBoxMode.Multiline;
txt.Text = "This is a Multiline TextBox.\n" +
"Allows to edit large texts,\n" +
"copy text to and from clipboard,\n" +
"select text with mouse or keyboard\n" +
"and much more...";
txt.SelectAll();
txt.Focused = true;
//txt.ReadOnly = true;
txt.ScrollBars = EScrollBars.Both;
win.Add(btn, true);
win.Show();
Manager.Add(win);
}
示例3: Initialize
public override void Initialize() {
base.Initialize();
Window win = new Window(WindowManager);
win.Init();
win.Text = "Account Login";
win.Width = 350;
win.Height = 150;
win.Center();
win.Resizable = false;
win.Movable = false;
win.StayOnTop = true;
win.Shadow = false;
win.CloseButtonVisible = false;
win.IconVisible = false;
win.FocusLost += delegate(object sender, WindowLibrary.Controls.EventArgs e) {
win.Focused = true;
};
win.Visible = true;
Label lbl = new Label(WindowManager);
lbl.Init();
lbl.Parent = win;
lbl.Text = "Name";
lbl.Left = 20;
lbl.Top = 20;
win.Add(lbl);
mUsername = new TextBox(WindowManager);
mUsername.Init();
mUsername.Parent = win;
mUsername.Left = 80;
mUsername.Top = 20;
mUsername.Width = win.ClientWidth - 160;
mUsername.Focused = true;
mUsername.KeyPress += new KeyEventHandler(txt_KeyPress);
win.Add(mUsername);
lbl = new Label(WindowManager);
lbl.Init();
lbl.Parent = win;
lbl.Text = "Passwort";
lbl.Left = 20;
lbl.Top = 40;
win.Add(lbl);
mPassword = new TextBox(WindowManager);
mPassword.Init();
mPassword.Parent = win;
mPassword.Left = 80;
mPassword.Top = 40;
mPassword.Width = win.ClientWidth - 160;
mPassword.PasswordChar = '*';
mPassword.Mode = ETextBoxMode.Password;
mPassword.KeyPress += new KeyEventHandler(txt_KeyPress);
win.Add(mPassword);
mSubmitButton = new Button(WindowManager);
mSubmitButton.Init();
mSubmitButton.Parent = win;
mSubmitButton.Text = "Login";
mSubmitButton.Width = 72;
mSubmitButton.Height = 24;
mSubmitButton.Left = win.ClientWidth - 74;
mSubmitButton.Top = win.ClientHeight - 26;
mSubmitButton.Anchor = EAnchors.Bottom | EAnchors.Right;
mSubmitButton.Click += new WindowLibrary.Controls.EventHandler(mSubmitButton_Click);
win.Add(mSubmitButton);
AddWindow(win);
}