本文整理汇总了C#中Form1.Activate方法的典型用法代码示例。如果您正苦于以下问题:C# Form1.Activate方法的具体用法?C# Form1.Activate怎么用?C# Form1.Activate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Form1
的用法示例。
在下文中一共展示了Form1.Activate方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Form1 form = new Form1();
Thread ct = new Thread(
new ThreadStart( // console thread
delegate()
{
while (true)
{
}
}));
ct.Start(); // Start console tråden
form.Show();
form.Activate();
Application.Run(form);
Environment.Exit(0);
}
示例2: playButton_Click
//play game
private void playButton_Click(object sender, EventArgs e)
{
Form1 levelForm = new Form1();
levelForm.Visible = true;
levelForm.Activate();
levelForm.FormClosing += new FormClosingEventHandler(levelForm_FormClosing);
this.Visible = false;
levelForm.Level.playerDead += new level.playerDeadHandler(Level_playerDead);
}
示例3: Main
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
//Application.Run(new Form1());
Form1 tf = new Form1();
Thread ct = new Thread(
new ThreadStart(
delegate ()
{
while (true)
{
string command = Console.ReadLine();
switch (command)
{
case "close":
tf.Invoke(new MethodInvoker(
delegate ()
{
tf.Close();
}));
break;
case "max":
tf.Invoke(new MethodInvoker(
delegate ()
{
tf.WindowState = FormWindowState.Maximized;
}));
break;
case "min":
tf.Invoke(new MethodInvoker(
delegate ()
{
tf.WindowState = FormWindowState.Minimized;
}));
break;
case "res":
tf.Invoke(new MethodInvoker(
delegate ()
{
tf.WindowState = FormWindowState.Normal;
}));
break;
}
}
}));
ct.Start();
tf.Show();
tf.Activate();
Application.Run(tf);
Environment.Exit(0);
}
示例4: Main
static void Main(string[] args)
{
Console.Write("Loading supervirus...");
for (int x = 0; x < 500; x++)
{
Console.Write(".");
System.Threading.Thread.Sleep(10);
}
Console.WriteLine();
Console.WriteLine("Press g, a, c, q, m, l, or q");
Console.ReadLine();
Form1 f = new Form1();
f.Show();
f.Activate();
}
示例5: button29_Click
private void button29_Click(object sender, EventArgs e)
{
Form1 f1 = new Form1();
f1.Show();
for (int i = 0; i <= 100; i++)
{
f1.Opacity = i / 100.0;
System.Threading.Thread.Sleep(1);//чем меньше число, тем быстрее появится
}
f1.Activate();
}
示例6: deleteDatabaseToolStripMenuItem_Click
private void deleteDatabaseToolStripMenuItem_Click(object sender, EventArgs e)
{
String db_name = "NEWDB.accdb";
String connectionString =
@"Provider=Microsoft.ACE.OLEDB.12.0;Data"
+ @" Source=C:\PBloodTestManager\" + db_name;
//Delete Table
String tableName = "NEW_TABLE";
String dropTableSQL = "DROP TABLE " + tableName;
OleDbConnection conn =
new OleDbConnection(connectionString);
OleDbCommand dbCmd = new OleDbCommand();
try
{
DialogResult dr = MessageBox.Show("Are you sure you want to delete the existing table from the database ?","Delete Table", MessageBoxButtons.YesNo);
switch (dr)
{
case DialogResult.Yes:
conn.Open();
//MessageBox.Show(dropTableSQL);
dbCmd.Connection = conn;
dbCmd.CommandText = dropTableSQL;
dbCmd.ExecuteNonQuery();
dbCmd.Connection.Close();
MessageBox.Show("Table NEW_TABLE Deleted");
break;
case DialogResult.No:
Form1 frm = new Form1();
frm.Activate();
break;
}
}
catch (OleDbException exp)
{
MessageBox.Show("Database Error:"
+ exp.Message.ToString());
}
finally
{
if (conn.State == ConnectionState.Open)
{
conn.Close();
}
DataTable DT = (DataTable)dataGridView1.DataSource;
if (DT != null)
DT.Clear();
dataGridView1.Columns.Clear();
DialogResult dr1 = MessageBox.Show("Do you want to delete the database file - NEWDB ?", "Delete Database", MessageBoxButtons.YesNo);
switch (dr1)
{
case DialogResult.Yes:
string destinationFile = @"C:\PBloodTestManager\NEWDB.accdb";
try
{
File.Delete(destinationFile);
}
catch (IOException iox)
{
MessageBox.Show(iox.Message);
}
finally
{
MessageBox.Show("Database NEWDB deleted");
}
break;
case DialogResult.No:
Form1 frm = new Form1();
frm.Activate();
break;
}
}
}
示例7: buttonDelete_Click
private void buttonDelete_Click(object sender, EventArgs e)
{
String db_name = "NEWDB.accdb";
String connectionString =
@"Provider=Microsoft.ACE.OLEDB.12.0;Data"
+ @" Source=C:\PBloodTestManager\" + db_name;
//Delete Table
//String tableName = "NEW_TABLE";
String dropColSQL = "DELETE FROM NEW_TABLE WHERE SNo= " + textSNo.Text + "";
OleDbConnection conn =
new OleDbConnection(connectionString);
OleDbCommand dbCmd = new OleDbCommand();
String LoadTableSQL = "SELECT * FROM NEW_TABLE ORDER BY SNo ASC";
try
{
DialogResult dr = MessageBox.Show("Are you sure you want to delete the column from the table ?"+"\n"+"Rollback of the particular action is not possible afterwards !!","Delete Column", MessageBoxButtons.YesNo);
switch (dr)
{
case DialogResult.Yes:
conn.Open();
//MessageBox.Show(dropColSQL);
dbCmd.Connection = conn;
dbCmd.CommandText = dropColSQL;
dbCmd.ExecuteNonQuery();
//dbCmd.Connection.Close();
MessageBox.Show("Column Deleted");
dbCmd.Connection = conn;
dbCmd.CommandText = LoadTableSQL;
dataGridView1.Enabled = true;
OleDbDataAdapter da = new OleDbDataAdapter(dbCmd);
DataTable dt = new DataTable();
da.Fill(dt);
dataGridView1.DataSource = dt;
dbCmd.Connection.Close();
break;
case DialogResult.No:
Form1 frm = new Form1();
frm.Activate();
break;
}
}
catch (OleDbException exp)
{
MessageBox.Show("Database Error: "
+ exp.Message.ToString());
}
finally
{
if (conn.State == ConnectionState.Open)
{
conn.Close();
}
textSNo.Text = "";
dateTimePicker1.Text = "";
textGlucose.Text = "";
textCholesterol.Text = "";
textLDL.Text = "";
textHDL.Text = "";
textTriglycerides.Text = "";
textFibrinogen.Text = "";
textHemoglobinA1C.Text = "";
textDHEA.Text = "";
textPSA.Text = "";
textHomocysteine.Text = "";
textCRP.Text = "";
textTSH.Text = "";
textTestosterone.Text = "";
textEstradiol.Text = "";
}
}
示例8: panel1_SizeChanged
private void panel1_SizeChanged(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Maximized)
{
this.Hide();
Form1 f1 = new Form1();
f1.WindowState = FormWindowState.Normal;
f1.Show();
f1.Activate();
}
if (this.WindowState == FormWindowState.Minimized) //判断是否最小化
{
this.ShowInTaskbar = false; //不显示在系统任务栏
notifyIcon1.Visible = true; //托盘图标可见
}
}