本文整理汇总了C#中Form.Show方法的典型用法代码示例。如果您正苦于以下问题:C# Form.Show方法的具体用法?C# Form.Show怎么用?C# Form.Show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Form
的用法示例。
在下文中一共展示了Form.Show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MainForm_Load
void MainForm_Load (object sender, EventArgs e)
{
InstructionsForm instructionsForm = new InstructionsForm ();
instructionsForm.Show ();
Form child1 = new Form ();
child1.BackColor = Color.Blue;
child1.Height = 200;
child1.MdiParent = this;
child1.Text = "Child #1";
child1.Show ();
Form child2 = new Form ();
child2.BackColor = Color.Red;
child2.Height = 200;
child2.MdiParent = this;
child2.Text = "Child #2";
child2.Show ();
Form child3 = new Form ();
child3.BackColor = Color.Green;
child3.Height = 200;
child3.MdiParent = this;
child3.Text = "Child #3";
child3.Show ();
}
示例2: Main
public static void Main ()
{
int x = 25;
foreach (FormBorderStyle style in Enum.GetValues (typeof(FormBorderStyle))) {
Form f1 = new Form();
f1.FormBorderStyle = style;
f1.Location = new Point (x, 25);
f1.Size = new Size (200, 200);
f1.StartPosition = FormStartPosition.Manual;
f1.Menu = CreateMenu ("");
f1.Text = style.ToString ();
f1.Show ();
x += f1.Width + 25;
}
Form mdi = new Form ();
Form child = new Form ();
mdi.IsMdiContainer = true;
mdi.StartPosition = FormStartPosition.Manual;
mdi.Location = new Point (25, 250);
mdi.Size = new Size (600, 400);
mdi.Menu = CreateMenu ("Main ");
child.MdiParent = mdi;
child.StartPosition = FormStartPosition.Manual;
child.Location = new Point (25, 25);
child.Size = new Size (200, 200);
child.Menu = CreateMenu ("Child ");
child.Show ();
Application.Run (mdi);
}
示例3: CleaniREB
public void CleaniREB()
{
MDIMain.dfuinstructions.Visible = false;
MDIMain.dfuinstructionstxt.Visible = false;
MDIMain.blue.Visible = false;
MDIMain.Button1.Visible = false;
BackgroundWorker1.Dispose();
BackgroundWorker2.Dispose();
// Display a child form.
Form frm = new Form();
frm.MdiParent = MDIMain;
frm.Width = this.Width / 2;
frm.Height = this.Height / 2;
frm.Show();
frm.Hide();
Welcome.MdiParent = MDIMain;
Welcome.Show();
Welcome.Button1.Enabled = false;
About.MdiParent = MDIMain;
About.Show();
About.BringToFront();
MDIMain.done.Enabled = false;
MDIMain.done.Checked = false;
MDIMain.donetxt.ForeColor = Color.DimGray;
this.Dispose();
}
示例4: OpenMenuItem_Click
void OpenMenuItem_Click (object sender, EventArgs e)
{
Form child = new Form ();
child.ClientSize = new Size (150, 150);
child.MdiParent = this;
child.Text = "Child";
child.Show ();
}
示例5: NewMenuItem_Click
void NewMenuItem_Click (object sender, EventArgs e)
{
Form child = new Form ();
child.ClientSize = new Size (209, 100);
child.MdiParent = this;
child.Text = "Child " + (++formCount).ToString (CultureInfo.InvariantCulture);
child.Show ();
}
示例6: ToolBar_ButtonClick
void ToolBar_ButtonClick (object sender, ToolBarButtonClickEventArgs e)
{
Form child = new Form ();
child.ClientSize = new Size (200, 100);
child.MdiParent = this;
child.Text = "Child";
child.Load += new EventHandler (Child_Load);
child.Show ();
}
示例7: ComboBox_SelectedIndexChanged
void ComboBox_SelectedIndexChanged (object sender, EventArgs e)
{
Form f = new Form ();
f.ClientSize = new Size (300, 70);
f.Location = new Point (250, 205);
f.StartPosition = FormStartPosition.Manual;
f.Text = "Child";
f.Show ();
}
示例8: CreateWindow
private void CreateWindow()
{
_window = new Form();
var box = new TextBox();
box.Dock = DockStyle.Fill;
_window.Controls.Add(box);
_window.Show();
box.Select();
Application.DoEvents();
}
示例9: Main
static int Main ()
{
for (int i = 0; i < 50; i++) {
Form form = new Form ();
form.KeyDown += new KeyEventHandler (Form_KeyDown);
form.Show ();
SendKeys.SendWait ("a");
if (_keyDown == null)
return 1;
if (_keyDown != "A")
return 2;
form.Dispose ();
}
return 0;
}
示例10: ClickHandler
public void ClickHandler (object sender, EventArgs e)
{
Form form = new Form ();
form.Text = "tool window";
if (sizable) {
form.FormBorderStyle = FormBorderStyle.SizableToolWindow;
form.Text = "Sizable Tool Window";
button.Text = "Gimme a Fixed Tool Window";
} else {
form.FormBorderStyle = FormBorderStyle.FixedToolWindow;
form.Text = "Fixed Tool Window";
button.Text = "Gimme a Sizable Tool Window";
}
sizable = !sizable;
form.Show ();
}
示例11: MDIMain_Load
private void MDIMain_Load(System.Object sender, System.EventArgs e)
{
SetMdiClientBorder(false);
foreach (Control ctl in this.Controls) {
if (ctl is MdiClient) {
ctl.BackColor = this.BackColor;
}
}
// Display a child form.
Form frm = new Form();
frm.MdiParent = this;
frm.Width = this.Width / 2;
frm.Height = this.Height / 2;
frm.Show();
frm.Hide();
this.Text = "iFaith v" + VersionNumber + " -- By: iH8sn0w";
Welcome.MdiParent = this;
Welcome.Show();
Welcome.Button1.Enabled = false;
About.MdiParent = this;
About.Show();
About.BringToFront();
temppath = System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Temp\\iFaith";
Folder_Delete(temppath);
Create_Directory(temppath);
// SendKeys
Microsoft.Win32.RegistryKey NewKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows NT\\CurrentVersion", true);
string GetVal = Convert.ToString(NewKey.GetValue("ProductName"));
if (GetVal.Contains("Windows XP")) {
NewKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{FF66E9F6-83E7-3A3E-AF14-8DE9A809A6A4}", true);
try {
GetVal = Convert.ToString(NewKey.GetValue("DisplayName"));
} catch (Exception ex) {
//uh-oh...
}
if (GetVal.Contains("C++")) {
//MsgBox("INSTALLED!", MsgBoxStyle.Information)
} else {
InstallVCPP.RunWorkerAsync();
//MsgBox("NOT INSTALLED!", MsgBoxStyle.Information)
}
}
}
示例12: Main
public static void Main() {
talk = new Form();
talk.Text = "TalkUser - The OFFICIAL TalkServ Client";
talk.Closing += new CancelEventHandler(talk_Closing);
talk.Controls.Add(new TextBox());
talk.Controls[0].Dock = DockStyle.Fill;
talk.Controls.Add(new TextBox());
talk.Controls[1].Dock = DockStyle.Bottom;
((TextBox)talk.Controls[0]).Multiline = true;
((TextBox)talk.Controls[1]).Multiline = true;
talk.WindowState = FormWindowState.Maximized;
talk.Show();
((TextBox)talk.Controls[1]).KeyUp += new KeyEventHandler(key_up);
TC = new N.Sockets.TcpClient();
TC.Connect("IP OF A SERVER HERE",4296);
Thread t = new Thread(new ThreadStart(run));
t.Start();
while(true) {
Application.DoEvents();
}
}
示例13: SetPosTest
public SetPosTest ()
{
left_pos = new NumericUpDown ();
top_pos = new NumericUpDown ();
tool_window = new Form ();
tool_window.FormBorderStyle = FormBorderStyle.FixedToolWindow;
tool_window.LocationChanged += new EventHandler (ToolWindowLocationChanged);
Label xlabel = new Label ();
xlabel.Text = "Left:";
Label ylabel = new Label ();
ylabel.Text = "Top:";
xlabel.Width = 45;
ylabel.Width = 45;
xlabel.Left = 10;
left_pos.Left = 55;
ylabel.Left = 10;
top_pos.Left = 55;
ylabel.Top = left_pos.Bottom + 25;
top_pos.Top = left_pos.Bottom + 25;
left_pos.Minimum = top_pos.Minimum = Int32.MinValue;
left_pos.Maximum = top_pos.Maximum = Int32.MaxValue;
left_pos.ValueChanged += new EventHandler (LeftPosChanged);
top_pos.ValueChanged += new EventHandler (TopPosChanged);
Controls.Add (xlabel);
Controls.Add (ylabel);
Controls.Add (left_pos);
Controls.Add (top_pos);
tool_window.Show ();
}
示例14: DownloadLWJGL
public bool DownloadLWJGL()
{
Debug.WriteLine("[DownloadLWJGL] Creating DownloadLWJGLStatusForm form.");
DownloadLWJGLStatusForm = new Form();
Label DownloadStatusLabel = new Label();
DownloadLWJGLStatusForm.SuspendLayout();
DownloadStatusLabel.Text = "Downloading LWJGL...";
DownloadStatusLabel.Name = "DownloadStatusLabel";
DownloadStatusLabel.Location = new System.Drawing.Point(12, 0);
DownloadStatusLabel.Height = 48;
DownloadStatusLabel.Width = 192;
DownloadStatusLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
DownloadStatusLabel.BackColor = System.Drawing.SystemColors.Control;
DownloadStatusLabel.ForeColor = System.Drawing.SystemColors.ControlText;
DownloadStatusLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8);
DownloadLWJGLStatusForm.Height = 72;
DownloadLWJGLStatusForm.Width = 216;
DownloadLWJGLStatusForm.Controls.Add(DownloadStatusLabel);
DownloadLWJGLStatusForm.FormBorderStyle = FormBorderStyle.FixedToolWindow;
DownloadLWJGLStatusForm.ResumeLayout(false);
DownloadLWJGLStatusForm.Text = "launcher²";
DownloadLWJGLStatusForm.Icon = global::launcher2.Properties.Resources.l2_ico;
DownloadLWJGLStatusForm.FormClosing += new FormClosingEventHandler(DownloadLWJGLStatusForm_FormClosing);
DownloadLWJGLStatusForm.Refresh();
DownloadLWJGLStatusForm.Show();
DownloadLWJGLStatusForm.Activate();
DownloadLWJGLThread = new BackgroundWorker();
DownloadLWJGLThread.WorkerReportsProgress = true;
DownloadLWJGLThread.WorkerSupportsCancellation = true;
DownloadLWJGLThread.DoWork += new DoWorkEventHandler(DownloadLWJGLThread_DoWork);
DownloadLWJGLThread.ProgressChanged += new ProgressChangedEventHandler(DownloadLWJGLThread_ProgressChanged);
DownloadLWJGLThread.RunWorkerCompleted += new RunWorkerCompletedEventHandler(DownloadLWJGLThread_RunWorkerCompleted);
DownloadLWJGLThread.RunWorkerAsync();
return true;
}
示例15: CreateGlWindow
/// <summary>
/// Creates our OpenGl Window.
/// </summary>
/// <param name="title">
/// The title to appear at the top of the window.
/// </param>
/// <param name="width">
/// The width of the Gl window or fullscreen mode.
/// </param>
/// <param name="height">
/// The height of the Gl window or fullscreen mode.
/// </param>
/// <param name="bits">
/// The number of bits to use for color (8/16/24/32).
/// </param>
/// <param name="fullscreenflag">
/// Use fullscreen mode (<c>true</c>) or windowed mode (<c>false</c>).
/// </param>
/// <returns>
/// <c>true</c> on successful window creation, otherwise <c>false</c>.
/// </returns>
private static bool CreateGlWindow(string title, int width, int height, int bits, bool fullscreenflag)
{
int pixelFormat; // Holds The Results After Searching For A Match
fullscreen = fullscreenflag; // Set The Global Fullscreen Flag
form = null; // Null The Form
GC.Collect(); // Request A Collection
// This Forces A Swap
Kernel.SetProcessWorkingSetSize(Process.GetCurrentProcess().Handle, -1, -1);
if (fullscreen)
{ // Attempt Fullscreen Mode?
Gdi.DEVMODE dmScreenSettings = new Gdi.DEVMODE(); // Device Mode
// Size Of The Devmode Structure
dmScreenSettings.dmSize = (short)Marshal.SizeOf(dmScreenSettings);
dmScreenSettings.dmPelsWidth = width; // Selected Screen Width
dmScreenSettings.dmPelsHeight = height; // Selected Screen Height
dmScreenSettings.dmBitsPerPel = bits; // Selected Bits Per Pixel
dmScreenSettings.dmFields = Gdi.DM_BITSPERPEL | Gdi.DM_PELSWIDTH | Gdi.DM_PELSHEIGHT;
// Try To Set Selected Mode And Get Results. NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar.
fullscreen = true;
}
form = new QuadricDemo(); // Create The Window
form.Width = width; // Set Window Width
form.Height = height; // Set Window Height
form.Text = title;
#region WINDOW CREATION STUFF
Gdi.PIXELFORMATDESCRIPTOR pfd = new Gdi.PIXELFORMATDESCRIPTOR(); // pfd Tells Windows How We Want Things To Be
pfd.nSize = (short)Marshal.SizeOf(pfd); // Size Of This Pixel Format Descriptor
pfd.nVersion = 1; // Version Number
pfd.dwFlags = Gdi.PFD_DRAW_TO_WINDOW | // Format Must Support Window
Gdi.PFD_SUPPORT_OPENGL | // Format Must Support OpenGl
Gdi.PFD_DOUBLEBUFFER; // Format Must Support Double Buffering
pfd.iPixelType = (byte)Gdi.PFD_TYPE_RGBA; // Request An RGBA Format
pfd.cColorBits = (byte)bits; // Select Our Color Depth
pfd.cRedBits = 0; // Color Bits Ignored
pfd.cRedShift = 0;
pfd.cGreenBits = 0;
pfd.cGreenShift = 0;
pfd.cBlueBits = 0;
pfd.cBlueShift = 0;
pfd.cAlphaBits = 0; // No Alpha Buffer
pfd.cAlphaShift = 0; // Shift Bit Ignored
pfd.cAccumBits = 0; // No Accumulation Buffer
pfd.cAccumRedBits = 0; // Accumulation Bits Ignored
pfd.cAccumGreenBits = 0;
pfd.cAccumBlueBits = 0;
pfd.cAccumAlphaBits = 0;
pfd.cDepthBits = 16; // 16Bit Z-Buffer (Depth Buffer)
pfd.cStencilBits = 0; // No Stencil Buffer
pfd.cAuxBuffers = 0; // No Auxiliary Buffer
pfd.iLayerType = (byte)Gdi.PFD_MAIN_PLANE; // Main Drawing Layer
pfd.bReserved = 0; // Reserved
pfd.dwLayerMask = 0; // Layer Masks Ignored
pfd.dwVisibleMask = 0;
pfd.dwDamageMask = 0;
hDC = User.GetDC(form.Handle); // Attempt To Get A Device Context
if (hDC == IntPtr.Zero)
{ // Did We Get A Device Context?
KillGlWindow(); // Reset The Display
MessageBox.Show("Can't Create A Gl Device Context.", "ERROR",
MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
pixelFormat = Gdi.ChoosePixelFormat(hDC, ref pfd); // Attempt To Find An Appropriate Pixel Format
if (pixelFormat == 0)
{ // Did Windows Find A Matching Pixel Format?
KillGlWindow(); // Reset The Display
MessageBox.Show("Can't Find A Suitable PixelFormat.", "ERROR",
MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
//.........这里部分代码省略.........