当前位置: 首页>>代码示例>>C#>>正文


C# Form1.Activate方法代码示例

本文整理汇总了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);
        }
开发者ID:humungus72,项目名称:surespotDesktop,代码行数:25,代码来源:Program.cs

示例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);
 }
开发者ID:ocept,项目名称:g3,代码行数:10,代码来源:mainMenu.cs

示例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);
        }
开发者ID:kenmarst,项目名称:SerialPort,代码行数:54,代码来源:Program.cs

示例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();
        }
开发者ID:BrandonLaRue,项目名称:FirstPrograms,代码行数:16,代码来源:Program.cs

示例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();
 }
开发者ID:KalitaAleks,项目名称:Viselnikgame,代码行数:11,代码来源:Form4.cs

示例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;
                }
            }
        }
开发者ID:asrinand,项目名称:Blood-Test-Manager,代码行数:78,代码来源:Form1.cs

示例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 = "";
            }
        }
开发者ID:asrinand,项目名称:Blood-Test-Manager,代码行数:77,代码来源:Form1.cs

示例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;  //托盘图标可见
 
            }


        }
开发者ID:wshxbqq,项目名称:JDF-UI,代码行数:20,代码来源:Form2.cs


注:本文中的Form1.Activate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。