コード例 #1
0
ファイル: test.cs プロジェクト: GMDays/PersonalPage
    public myForm(string title, string name)
    {
        myForm f1 = new myForm(title, name);
        f1.Text = title;

        Panel myPanel = new Panel();
        f1.Controls.Add(myPanel);
        myPanel.BackColor = System.Drawing.Color.Blue;
        myPanel.Height = 400;
        myPanel.Width = 300;
        myPanel.Dock = DockStyle.Bottom;

        Label myLabel = new Label();
        myPanel.Controls.Add(myLabel);
        myLabel.Text = name;

        Panel mySecondPanel = new Panel();
        mySecondPanel.BackColor = System.Drawing.Color.Red;
        mySecondPanel.Dock = DockStyle.Fill;

        Label mySecondLabel = new Label();
        mySecondPanel.Controls.Add(mySecondLabel);
        mySecondLabel.Text = "Comment : ";
        mySecondLabel.Top = 300;
        mySecondLabel.Left = 400;

        TextBox myTbox = new TextBox();
        myTbox.Left = 350;
        myTbox.Top = 250;
        myTbox.Anchor = AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Left;
        myTbox.Width = 200;

        Button myButton = new Button();
    }
コード例 #2
0
ファイル: Engine.cs プロジェクト: RafaelEstevamReis/Simple2D
        public void Show(WindowInfo Info)
        {
            Info.Validate();

            form              = new myForm();
            form.BackColor    = Color.Azure;
            form.AutoValidate = AutoValidate.Disable;
            form.KeyPreview   = true;

            if (Info.FullScreen)
            {
                form.FormBorderStyle = FormBorderStyle.None;
                form.WindowState     = FormWindowState.Maximized;
            }
            else
            {
                form.FormBorderStyle = FormBorderStyle.FixedSingle;
                form.MaximizeBox     = false;
                form.Size            = Info.Size;
            }

            stopThreads = false;

            thdDraw      = new Thread(threadDraw);
            thdDraw.Name = "ThreadDraw";

            thdUpdate      = new Thread(threadUpdate);
            thdUpdate.Name = "ThreadUpdate";

            form.Shown += (object sender, EventArgs e) =>
            {
                if (Setup != null)
                {
                    Setup(this, form);
                }

                thdDraw.Start();
                thdUpdate.Start();
            };
            form.Paint += (object sender, PaintEventArgs e) =>
            {
                executeUpdate(e);
            };
            form.KeyDown += form_KeyDown;
            form.KeyUp   += form_KeyUp;
            resetKeyStatus();

            swTotal.Start();
            Application.Run(form);
            stopThreads = true;
        }
コード例 #3
0
ファイル: Principal.cs プロジェクト: RJRC/ExsonProject1.0
        /// <summary>
        /// The openForm method
        /// Open a form.
        /// </summary>
        private void openForm <myForm>() where myForm : Form, new ()
        {
            //find in the colection the form
            Form formPanel = panelFill.Controls.OfType <myForm>().FirstOrDefault();

            //if the form does not exist, a new instance is created
            if (formPanel == null)
            {
                formPanel          = new myForm();
                formPanel.TopLevel = false;
                formPanel.Dock     = DockStyle.Fill;
                panelFill.Controls.Add(formPanel);
                panelFill.Tag = formPanel;
                formPanel.Show();
                formPanel.BringToFront();
            }
            //If the form exists, it is bring to the front
            else
            {
                if (formPanel.Name == "Home" || formPanel.Name == "Customer" || formPanel.Name == "DashBoard" || formPanel.Name == "Reports")
                {
                    // close the panel and open a new panel with the new data
                    formPanel.Close();

                    if (formPanel.Name == "Home")
                    {
                        openForm <Home>();
                    }
                    else if (formPanel.Name == "Customer")
                    {
                        openForm <Customer>();
                    }
                    else if (formPanel.Name == "DashBoard")
                    {
                        openForm <DashBoard>();
                    }
                    else if (formPanel.Name == "Reports")
                    {
                        openForm <Reports>();
                    }
                }
                else
                {
                    formPanel.BringToFront();
                }
            }
        }
コード例 #4
0
    public myForm(string title, string name)
    {
        myForm f1 = new myForm(title, name);

        f1.Text = title;

        Panel myPanel = new Panel();

        f1.Controls.Add(myPanel);
        myPanel.BackColor = System.Drawing.Color.Blue;
        myPanel.Height    = 400;
        myPanel.Width     = 300;
        myPanel.Dock      = DockStyle.Bottom;

        Label myLabel = new Label();

        myPanel.Controls.Add(myLabel);
        myLabel.Text = name;

        Panel mySecondPanel = new Panel();

        mySecondPanel.BackColor = System.Drawing.Color.Red;
        mySecondPanel.Dock      = DockStyle.Fill;

        Label mySecondLabel = new Label();

        mySecondPanel.Controls.Add(mySecondLabel);
        mySecondLabel.Text = "Comment : ";
        mySecondLabel.Top  = 300;
        mySecondLabel.Left = 400;

        TextBox myTbox = new TextBox();

        myTbox.Left   = 350;
        myTbox.Top    = 250;
        myTbox.Anchor = AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Left;
        myTbox.Width  = 200;

        Button myButton = new Button();
    }