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


C# Button.SendToBack方法代码示例

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


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

示例1: gameButton

        private void gameButton()
        {
            button = new Button();
            button.Text = "begin";
            button.Height = this.size;
            button.Width = LABELWIDTH;
            button.TextAlign = ContentAlignment.MiddleCenter;
            button.Font = new Font("Arial", 12);
            button.BackColor = Color.Transparent;
            button.Location = new Point(this.platAlly.Location.X + this.platAlly.Size.Width + 20, this.platAlly.Location.Y + LABELWIDTH);
            button.Click += button_Click;
            this.Controls.Add(button);

            Button btnRestart = new Button();
            btnRestart.Text = "RESTART";
            btnRestart.Height = this.size;
            btnRestart.Width = this.size * 3;
            btnRestart.Font = new Font("Arial", 12);
            btnRestart.Location = new Point(size * 27, this.Width / 2);
            btnRestart.SendToBack();
            this.Controls.Add(btnRestart);
            btnRestart.Click += btnRestart_Click;

            button = new Button();
            button.Text = "Join game";
            button.Height = this.size;
            button.Width = LABELWIDTH;
            button.TextAlign = ContentAlignment.MiddleCenter;
            button.Font = new Font("Arial", 12);
            button.BackColor = Color.Transparent;
            button.Location = new Point(this.platAlly.Location.X + this.platAlly.Size.Width + 20, this.platAlly.Location.Y + LABELWIDTH + 50);
            button.Click += button_Click;
            this.Controls.Add(button);

            button = new Button();
            button.Text = "Create game";
            button.Height = this.size;
            button.Width = LABELWIDTH;
            button.TextAlign = ContentAlignment.MiddleCenter;
            button.Font = new Font("Arial", 12);
            button.BackColor = Color.Transparent;
            button.Location = new Point(this.platAlly.Location.X + this.platAlly.Size.Width + 20, this.platAlly.Location.Y + LABELWIDTH + 100);
            button.Click += create_game;     
            this.Controls.Add(button);
        }
开发者ID:LucienCamuglia,项目名称:Battleships,代码行数:45,代码来源:ViewBattleShip.cs

示例2: CrearNodoN

        /// <summary>
        /// Crear los nodos.
        /// </summary>
        /// <param name="numeroDeNodo">El numero de nodo a Crear.</param>
        /// <param name="ejeX">Posicion en el eje X.</param>
        /// <param name="ejeY">Posicion en el eje Y.</param>
        /// <returns>El nodo en las posiciones x,y indicadas</returns>
        public Control CrearNodoN(int numeroDeNodo, int ejeX, int ejeY)
        {
            Button nodo = null;

            switch (numeroDeNodo)
            {
                case 0:
                    nodo = new Button
                               {
                                   //Descripcion de las propiedades
                                   Name = "nodo1",
                                   //Nombre que tendra el Control
                                   Size = new Size(45, 45),
                                   //Tamaño en pixeles
                                   Location = new Point(ejeX, ejeY),
                                   //Posicion en el Panel
                                   Text = "A",
                                   //Texto que contendra
                                   BackColor = Color.Crimson,
                                   //Color del control
                                   ForeColor = Color.White,
                                   //Color del Texto
                               };
                    nodo.SendToBack(); //Pasa al control al fondo de todos los elementos
                    nodo.SendToBack();
                    break;

                case 1:
                    nodo = new Button
                               {
                                   Name = "nodo2",
                                   Size = new Size(45, 45),
                                   Location = new Point(ejeX, ejeY),
                                   Text = "B",
                                   BackColor = Color.Crimson,
                                   ForeColor = Color.White,
                               };
                    nodo.SendToBack();
                    break;

                case 2:
                    nodo = new Button
                               {
                                   Name = "nodo3",
                                   Size = new Size(45, 45),
                                   Location = new Point(ejeX, ejeY),
                                   Text = "C",
                                   BackColor = Color.Crimson,
                                   ForeColor = Color.White,
                               };
                    nodo.SendToBack();
                    nodo.SendToBack();
                    break;

                case 3:
                    nodo = new Button
                               {
                                   Name = "nodo4",
                                   Size = new Size(45, 45),
                                   Location = new Point(ejeX, ejeY),
                                   Text = "D",
                                   BackColor = Color.Crimson,
                                   ForeColor = Color.White,
                               };
                    nodo.SendToBack();
                    nodo.SendToBack();
                    break;

                case 4:
                    nodo = new Button
                               {
                                   Name = "nodo5",
                                   Size = new Size(45, 45),
                                   Location = new Point(ejeX, ejeY),
                                   Text = "E",
                                   BackColor = Color.Crimson,
                                   ForeColor = Color.White,
                               };
                    nodo.SendToBack();
                    nodo.SendToBack();
                    break;

                case 5:
                    nodo = new Button
                               {
                                   Name = "nodo6",
                                   Size = new Size(45, 45),
                                   Location = new Point(ejeX, ejeY),
                                   Text = "F",
                                   BackColor = Color.Crimson,
                                   ForeColor = Color.White,
                               };
                    nodo.SendToBack();
//.........这里部分代码省略.........
开发者ID:Servtes,项目名称:GrafoNator,代码行数:101,代码来源:Nodos.cs


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