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


C# Button.Select方法代码示例

本文整理汇总了C#中System.Windows.Forms.Button.Select方法的典型用法代码示例。如果您正苦于以下问题:C# Button.Select方法的具体用法?C# Button.Select怎么用?C# Button.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.Button的用法示例。


在下文中一共展示了Button.Select方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: editEngineconf_Click

        private void editEngineconf_Click(object sender, EventArgs e)
        {
            // Neues Fenster öffnen
            Form newWindow = new Form();
            newWindow.Size = new System.Drawing.Size(800, 600);

            // Property Grid erstellen
            PropertyGrid newWin = new PropertyGrid();
            newWin.Top = 25;
            newWin.Size = new System.Drawing.Size(800, 600);

            Button saveButton = new Button();
            saveButton.Select();
            saveButton.Text = "Speichern";
            saveButton.Click += new System.EventHandler(saveButton_Click);

            // Füge Property Grid in neues Fenster ein
            newWindow.Controls.Add(newWin);
            newWindow.Controls.Add(saveButton);

            // Wir lesen zuerst die Config Datei ein
            // Dateipfad
            string path = "../Common/engine.conf";

            // Alles in einen string packen
            string text = File.ReadAllText(path);

            dynamic stuff = JsonConvert.DeserializeObject(text);

            Settings conf = new Settings(stuff);

            newWin.SelectedObject = conf;

            newWindow.Show();
        }
开发者ID:gbarnes12,项目名称:skyengine,代码行数:35,代码来源:Form1.cs

示例2: MessageForm

        public MessageForm(string caption, string message, string[] buttons, Icon icon)
        {
            InitializeComponent();

            int width = icon.Width;
            if (icon != null)
            {
                image_box.Image = (Image)icon.ToBitmap();
                int w = image_box.Image.Width - width;
                if (w > 0)
                {
                    this.Width += w;
                    this.message.Left += w;
                }
            }

            this.Text = caption;
            this.message.Text = message;

            for (int i = buttons.Length - 1; i >= 0; i--)
            {
                Button b = new Button();
                b.Tag = i;
                b.Text = buttons[i];
                b.Click += b_Click;
                flowLayoutPanel1.Controls.Add(b);
                if (i == 0)
                    b.Select();
            }
        }
开发者ID:sergeystoyan,项目名称:FhrCliverHost,代码行数:30,代码来源:MessageForm.cs

示例3: SetActive

        public void SetActive(string workStationName)
        {
            SetInactiveLine();

            _currActiveWorkStation = _HH02_WSTs.Find(c => (c.Name == workStationName.Trim()));

            if (_currActiveWorkStation != null)
            {
                _currActiveWorkStation.BackColor = _activeColor;
                _currActiveWorkStation.Select();
                _blinkingTime = 10;
                _tmr.Start();
            }
        }
开发者ID:anthanhcong,项目名称:atc-demand-instruction-form,代码行数:14,代码来源:Layout_HH02_Controller.cs

示例4: MessageForm

        public MessageForm(string caption, Icon icon, string message, string[] buttons, int default_button, Form owner, bool button_auto_size = false)
        {
            InitializeComponent();

            this.MaximizeBox = true;

            Owner = owner;

            int width = icon.Width;
            if (icon != null)
            {
                image_box.Image = (Image)icon.ToBitmap();
                int w = image_box.Image.Width - width;
                if (w > 0)
                {
                    this.Width += w;
                    this.message.Left += w;
                }
            }

            this.Text = caption;
            this.message.Text = message;

            for (int i = buttons.Length - 1; i >= 0; i--)
            {
                Button b = new Button();
                b.Tag = i;
                b.AutoSize = button_auto_size;
                b.Text = buttons[i];
                b.Click += b_Click;
                flowLayoutPanel1.Controls.Add(b);
                if (i == default_button)
                    b.Select();
            }

            //Size s = this.message.GetPreferredSize(new Size(Screen.PrimaryScreen.WorkingArea.Width * 3 / 4, Screen.PrimaryScreen.WorkingArea.Height * 3 / 4));
            //this.Width = this.Width + s.Width - this.message.Width;
            //this.Height = this.Height + s.Height - this.message.Height;
        }         
开发者ID:sergeystoyan,项目名称:CliverBot,代码行数:39,代码来源:MessageForm.cs

示例5: CreateControls

        private void CreateControls(DataTable dtPivot, BrowserState tag)
        {
            tag.Panel.Controls.Clear();

            switch (tag.Mode)
            {
                case BrowseMode.Media:
                    flpMediaTop.Controls.Clear();
                    switch (tag.Level)
                    {
                        case 1:
                            scMedia.SplitterDistance = 1;

                            if (tag.Panel.Controls.Count > 0)
                                tag.Panel.Controls[0].Select();

                            break;
                        case 2:
                            scMedia.SplitterDistance = 100;

                            Button btnBack = new Button();
                            btnBack.Width = flpMediaTop.Width / 8 - 10;
                            btnBack.Text = "Back";
                            btnBack.Height = flpMediaTop.Height - 10;
                            btnBack.Click += new EventHandler(btnBack_Click);
                            btnBack.Tag = BrowseMode.Media;
                            btnBack.Name = BUTTON_BACK;
                            btnBack.GotFocus += new EventHandler(b_GotFocus);
                            btnBack.LostFocus += new EventHandler(b_LostFocus); 
                            flpMediaTop.Controls.Add(btnBack);
                            break;
                    }
                    break;
                case BrowseMode.Recordings:
                    flpRecordingTop.Controls.Clear();
                    switch (tag.Level)
                    {
                        case 1:
                            scRecording.SplitterDistance = 1;

                            if (tag.Panel.Controls.Count > 0)
                                tag.Panel.Controls[0].Select();

                            break;
                        case 2:
                            scRecording.SplitterDistance = 100;

                            Button btnBack = new Button();
                            btnBack.Width = flpRecordingTop.Width / 8 - 10;
                            btnBack.Text = "Back";
                            btnBack.Height = flpRecordingTop.Height - 10;
                            btnBack.Click += new EventHandler(btnBack_Click);
                            btnBack.ForeColor = System.Drawing.Color.Black;
                            btnBack.Tag = BrowseMode.Recordings;
                            btnBack.Name = BUTTON_BACK;
                            btnBack.GotFocus += new EventHandler(b_GotFocus);
                            btnBack.LostFocus += new EventHandler(b_LostFocus); 
                            flpRecordingTop.Controls.Add(btnBack);

                            Label lblTitle = new Label();
                            lblTitle.Text = EscapeControlText(tag.Value);
                            lblTitle.Width = flpRecordingTop.Width / 2 - 10;
                            lblTitle.Height = flpRecordingTop.Height - 10;
                            lblTitle.TextAlign = ContentAlignment.MiddleCenter;
                            lblTitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                            flpRecordingTop.Controls.Add(lblTitle);

                            break;
                    }
                    break;
            }

            for (int i = 0; i < dtPivot.Rows.Count; i++)
            {
                DataRow dr = dtPivot.Rows[i];
                BrowserState nBs = new BrowserState(tag.Sort, tag.Filter, tag.Level, tag.Mode, tag.Panel);


                StringBuilder sbText = new StringBuilder();
                Control b = null;

                switch (tag.Mode)
                {
                    case BrowseMode.Recordings:
                        b = new Button();
                        switch (tag.Level)
                        {
                            case 1:
                                sbText.AppendFormat("{0} - ", dr["title"]);
                                nBs.Value = dr["title"].ToString();
                                b.Size = new Size(tag.Panel.Width / 4 - 10, mfOwner.ps.MBButtonHeight);
                                break;
                            case 2:
                                if (dtPivot.Columns.Contains("episode") && !string.IsNullOrEmpty(dr["episode"].ToString()))
                                    sbText.AppendFormat("{0} - ", dr["episode"]);
                                if (dtPivot.Columns.Contains("description") && !string.IsNullOrEmpty(dr["description"].ToString()))
                                    sbText.AppendFormat("{0} - ", dr["description"]);
                                if (sbText.Length == 0)
                                {
                                    sbText.AppendFormat("{0} - ", dr["title"]);
//.........这里部分代码省略.........
开发者ID:babgvant,项目名称:EVRPlay,代码行数:101,代码来源:MediaBrowser.cs

示例6: initControls

        private void initControls()
        {
            RichTextBox rtb = new RichTextBox();

            rtb.AppendText("DrawEA\n");
            rtb.SelectAll();
            rtb.SelectionFont = new Font(Font.FontFamily, Font.Size*2, FontStyle.Bold);

            rtb.SelectionLength = 0;
            rtb.SelectionStart = rtb.Text.Length;
            rtb.AppendText("Version " + Application.ProductVersion);
            rtb.SelectionLength = rtb.Text.Length - rtb.SelectionStart;
            rtb.SelectionFont = new Font(Font, FontStyle.Italic);

            rtb.ReadOnly = true;
            rtb.BackColor = Color.White;
            rtb.BorderStyle = BorderStyle.None;
            rtb.Location = new Point(50, 10);
            rtb.Size = new Size(200, 50);

            Controls.Add(rtb);

            Button close = new Button();

            close.Text = "x";
            close.Size = new Size(20, 20);
            close.Location = new Point(275, 5);

            close.Click += delegate { Close(); };

            Controls.Add(close);

            LinkLabel lblMail = new LinkLabel();

            lblMail.Text = "© 2006-2008 Andreas K.";
            lblMail.LinkArea = new LinkArea(12, 10);
            lblMail.LinkBehavior = LinkBehavior.HoverUnderline;
            lblMail.LinkClicked += delegate { System.Diagnostics.Process.Start("mailto:\"Andreas Krohn\"<[email protected]>?subject=DrawEA%20Version%20"+Application.ProductVersion); };

            lblMail.AutoSize = true;
            lblMail.Dock = DockStyle.Bottom;

            Controls.Add(lblMail);

            Bitmap bmp = new Bitmap(300, 190);
            Graphics g = Graphics.FromImage(bmp);

            int oldSize = State.STATE_SIZE;
            State.STATE_SIZE = 40;

            State A = new State("A", false, true);
            State B = new State("B", true, false);
            State C = new State("C", false, false);

            A.Destinations.Add(new Switch(A, B, "1", "done"));
            A.Destinations.Add(new Switch(A, C, "0", string.Empty));
            B.Destinations.Add(new Switch(B, B, "0", string.Empty));
            B.Destinations.Add(new Switch(B, B, "1", string.Empty));
            C.Destinations.Add(new Switch(C, A, "1", string.Empty));
            C.Destinations.Add(new Switch(C, C, "0", string.Empty));

            A.Location = new Point(40, 40);
            B.Location = new Point(230, 60);
            C.Location = new Point(160, 140);

            A.CalculateSwitchPoints();
            B.CalculateSwitchPoints();
            C.CalculateSwitchPoints();

            StringFormat sf = new StringFormat {Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center};

            using (Pen borderPen = new Pen(ForeColor, 4f))
            using (Pen switchOutline = new Pen(Color.FromArgb(220, BackColor), 5f))
            using (Pen switchPen = new Pen(ForeColor, 4f)
                                       {
                                           EndCap = LineCap.Custom,
                                           CustomEndCap = new AdjustableArrowCap(3, 3, true)
                                       })
            {
                g.FillRectangle(Brushes.White, 0, 0, bmp.Width, bmp.Height);

                g.CompositingQuality = CompositingQuality.HighQuality;
                g.InterpolationMode = InterpolationMode.HighQualityBilinear;
                g.SmoothingMode = SmoothingMode.HighQuality;

                A.Draw(g, Brushes.White, borderPen, switchPen, Font, sf);
                B.Draw(g, Brushes.White, borderPen, switchPen, Font, sf);
                C.Draw(g, Brushes.White, borderPen, switchPen, Font, sf);
                A.DrawAllSwitches(g, A.CenterPoint(), switchPen, switchOutline, Font, sf, false);
                B.DrawAllSwitches(g, B.CenterPoint(), switchPen, switchOutline, Font, sf, true);
                C.DrawAllSwitches(g, C.CenterPoint(), switchPen, switchOutline, Font, sf, false);
            }

            State.STATE_SIZE = oldSize;

            PictureBox pb = new PictureBox();
            pb.SizeMode = PictureBoxSizeMode.AutoSize;
            pb.Image = bmp;
            pb.Location = new Point(0,60);

//.........这里部分代码省略.........
开发者ID:hamburger1984,项目名称:DrawEA,代码行数:101,代码来源:frmAbout.cs


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