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


C# Panel.SetBounds方法代码示例

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


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

示例1: CreateMaze

        public void CreateMaze(int _w, int _h)
        {
            var maze = new MazeGenerator(_w, _h, null);

            var w = new BlockMaze(maze);

            for (var y = 0; y < w.Height; y++)
            {
                Console.Write(new string(' ', 8));

                for (var x = 0; x < w.Width; x++)
                {
                    var v = w.Walls[x][y];

                    var p = new Panel();

                    p.SetBounds(16 + x * 16, 16 + y * 16, 15, 15);
                    if (!v)
                    {
                        p.BackColor = Color.White;
                    }
                    else
                    {
                        p.BackColor = Color.Black;
                    }

                    this.Controls.Add(p);



                }
            }

            this.ClientSize = new Size(16 * (w.Width + 2), 16 * (w.Height + 2));
        }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:35,代码来源:Form2.cs

示例2: Task

        private void Task(Panel p1, int i,int count)
        {
            try
            {
                if (p1.InvokeRequired)
                {
                    SetTextCallback d = new SetTextCallback(Task);
                    p1.Invoke(d, new Object[] { p1, i,count });
                }
                else
                {
                    int w = ((PopupContent)panelContainer.Tag).Width;
                    int h = ((PopupContent)panelContainer.Tag).Height;
                    int left = ((PopupContent)panelContainer.Tag).TargetControl.FindForm().Width - w - 20;
                    int top = ((PopupContent)panelContainer.Tag).TargetControl.FindForm().Height - 40;
                    if (p1.Height >= h)
                    {
                        p1.SetBounds(left, top - h,w, h);
                    }
                    else
                    {
                        p1.SetBounds(left, top - i * (int)Convert.ToDouble(h / count), p1.Width, i * (int)Convert.ToDouble(h / count));
                    }

                    if (!p1.Visible)
                    {
                        p1.Show();
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Task函数执行错误");
            }
        }
开发者ID:keep01,项目名称:efwplus_winformframe,代码行数:35,代码来源:Popup.cs

示例3: cbFiltro_SelectedValueChanged

        private void cbFiltro_SelectedValueChanged(object sender, EventArgs e)
        {
            pDinamico.Controls.Clear();
            
            DataTable dt;
            switch (cbFiltro.Text)
            {
                case "Cedula":
                    
                    pDinamico.Controls.Add(lCedula);
                    pDinamico.Controls.Add(tbCedula);

                    
                    break;
                case "Region":
                    
                    break;
                case "VIP":

                    actualizarLista("select i.CustomerID, i.FirstName, i.LastName, SUM(soh.totaldue) as totalCompras from Individual i inner join SalesOrderHeader soh on i.CustomerID=soh.CustomerID group by i.CustomerID, i.FirstName, i.LastName HAVING SUM(soh.totaldue) > (select avg(totaldue) from SalesOrderHeader) order by totalCompras desc;");
                    break;
                case "Categorias":
                    //sql
                    
                     SqlDataAdapter dad = new SqlDataAdapter("SELECT name FROM ProductCategory",con);
                    dt = new DataTable();
                    dad.Fill(dt);
                    DataRow fila = dt.NewRow();
                    fila["Name"]="";
                    dt.Rows.Add(fila);
                    
                    //crear combobox
                    //--Categorias
                     cbCategorias = new ComboBox();
                    cbCategorias.DataSource = dt;
                    
                     cbCategorias.DisplayMember = "Name";
                    cbCategorias.ValueMember = "ProductCategoryId";
                    cbCategorias.SelectedValue = "";
                    cbCategorias.SelectedValueChanged += new System.EventHandler(this.cbCategorias_selectedValueChanged);
                    cbCategorias.SetBounds(0,0,100,20);
                   
                    pDinamico.Controls.Add(cbCategorias);
                    patito = new Panel();
                    patito.SetBounds(120,0,130,50);
                    pDinamico.Controls.Add(patito);

                    
                    actualizarLista("select i.CustomerID, i.FirstName, i.LastName from Individual i inner join SalesOrderHeader soh on soh.CustomerID = i.CustomerID inner join SalesOrderDetail sod on sod.SalesOrderID = soh.SalesOrderID inner join Product p on p.ProductID = sod.ProductID  inner join ProductSubCategory ps on ps.ProductSubCategoryID = p.ProductSubCategoryID inner join ProductCategory pc on pc.ProductCategoryID = ps.ProductCategoryID and pc.ProductCategoryID = (select ProductCategoryID from ProductCategory where Name = '" + cbCategorias.Text + "') group by i.CustomerID, i.FirstName, i.LastName;");
                    break;
                default:

                    actualizarLista( "select i.CustomerID, i.FirstName, i.LastName from Individual i inner join SalesOrderHeader soh on soh.CustomerID = i.CustomerID group by i.CustomerID, i.FirstName, i.LastName");
                    break;
            }
        }
开发者ID:marck0793,项目名称:Clientes,代码行数:56,代码来源:Form1.cs

示例4: FixTabLayout

 private void FixTabLayout(TabPage tp, Panel panel)
 {
     tabs.SelectedTab = tp;
     Application.DoEvents();
     panel.SetBounds(0, 0, tp.Width, tp.Height);
     panel.Anchor = AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
 }
开发者ID:Bradsama,项目名称:padtie,代码行数:7,代码来源:PadSettingsControl.cs

示例5: Frame1

    public Frame1()
    {
        // This code is automatically generated by Visual Cafe when you add
        // components to the visual environment. It instantiates and initializes
        // the components. To modify the code, only use code syntax that matches
        // what Visual Cafe can generate, or Visual Cafe may be unable to back
        // parse your Java file into its visual environment.

        //{{INIT_CONTROLS
        //UPGRADE_ISSUE: Method 'java.awt.Container.setLayout' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaawtContainersetLayout_javaawtLayoutManager'"
        /*
        setLayout(null);*/
        //UPGRADE_TODO: Method 'java.awt.Component.setVisible' was converted to 'System.Windows.Forms.Control.Visible' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtComponentsetVisible_boolean'"
        //UPGRADE_TODO: 'System.Windows.Forms.Application.Run' must be called to start a main form. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1135'"
        Visible = false;
        //UPGRADE_TODO: Method 'java.awt.Component.setSize' was converted to 'System.Windows.Forms.Control.Size' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtComponentsetSize_int_int'"
        Size = new System.Drawing.Size(SupportClass.GetInsets(this)[1] + SupportClass.GetInsets(this)[2] + 755, SupportClass.GetInsets(this)[0] + SupportClass.GetInsets(this)[3] + 589);
        //UPGRADE_TODO: Constructor 'java.awt.Color.Color' was converted to 'System.Drawing.Color.FromArgb' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtColorColor_int'"
        ForeColor = System.Drawing.Color.FromArgb(0);
        openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
        //UPGRADE_ISSUE: Method 'java.awt.FileDialog.setMode' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaawtFileDialogsetMode_int'"
        openFileDialog1.setMode(0);
        openFileDialog1.Title = "Open";
        //$$ openFileDialog1.move(40,277);
        button1 = new System.Windows.Forms.Button();
        SupportClass.CommandManager.SetCommand(button1, "button");
        button1.Text = "Insert";
        button1.SetBounds(SupportClass.GetInsets(this)[1] + 696, SupportClass.GetInsets(this)[0] + 408, 50, 26);
        //UPGRADE_TODO: Constructor 'java.awt.Color.Color' was converted to 'System.Drawing.Color.FromArgb' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtColorColor_int'"
        button1.BackColor = System.Drawing.Color.FromArgb(12632256);
        //UPGRADE_TODO: Method 'java.awt.Container.add' was converted to 'System.Windows.Forms.ContainerControl.Controls.Add' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtContaineradd_javaawtComponent'"
        Controls.Add(button1);
        button2 = new System.Windows.Forms.Button();
        SupportClass.CommandManager.SetCommand(button2, "button");
        button2.Text = "Delete";
        button2.SetBounds(SupportClass.GetInsets(this)[1] + 696, SupportClass.GetInsets(this)[0] + 444, 50, 25);
        //UPGRADE_TODO: Constructor 'java.awt.Color.Color' was converted to 'System.Drawing.Color.FromArgb' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtColorColor_int'"
        button2.BackColor = System.Drawing.Color.FromArgb(12632256);
        //UPGRADE_TODO: Method 'java.awt.Container.add' was converted to 'System.Windows.Forms.ContainerControl.Controls.Add' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtContaineradd_javaawtComponent'"
        Controls.Add(button2);
        button3 = new System.Windows.Forms.Button();
        SupportClass.CommandManager.SetCommand(button3, "button");
        button3.Text = "Search";
        button3.SetBounds(SupportClass.GetInsets(this)[1] + 696, SupportClass.GetInsets(this)[0] + 480, 49, 25);
        //UPGRADE_TODO: Constructor 'java.awt.Color.Color' was converted to 'System.Drawing.Color.FromArgb' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtColorColor_int'"
        button3.BackColor = System.Drawing.Color.FromArgb(12632256);
        //UPGRADE_TODO: Method 'java.awt.Container.add' was converted to 'System.Windows.Forms.ContainerControl.Controls.Add' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtContaineradd_javaawtComponent'"
        Controls.Add(button3);
        button4 = new System.Windows.Forms.Button();
        SupportClass.CommandManager.SetCommand(button4, "button");
        button4.Text = "Pack";
        button4.SetBounds(SupportClass.GetInsets(this)[1] + 696, SupportClass.GetInsets(this)[0] + 516, 49, 26);
        //UPGRADE_TODO: Constructor 'java.awt.Color.Color' was converted to 'System.Drawing.Color.FromArgb' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtColorColor_int'"
        button4.BackColor = System.Drawing.Color.FromArgb(12632256);
        //UPGRADE_TODO: Method 'java.awt.Container.add' was converted to 'System.Windows.Forms.ContainerControl.Controls.Add' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtContaineradd_javaawtComponent'"
        Controls.Add(button4);
        button5 = new System.Windows.Forms.Button();
        SupportClass.CommandManager.SetCommand(button5, "button");
        button5.Text = "Exit";
        button5.SetBounds(SupportClass.GetInsets(this)[1] + 696, SupportClass.GetInsets(this)[0] + 552, 49, 26);
        //UPGRADE_TODO: Constructor 'java.awt.Color.Color' was converted to 'System.Drawing.Color.FromArgb' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtColorColor_int'"
        button5.BackColor = System.Drawing.Color.FromArgb(12632256);
        //UPGRADE_TODO: Method 'java.awt.Container.add' was converted to 'System.Windows.Forms.ContainerControl.Controls.Add' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtContaineradd_javaawtComponent'"
        Controls.Add(button5);
        textField1 = new System.Windows.Forms.TextBox();
        textField1.SetBounds(SupportClass.GetInsets(this)[1] + 612, SupportClass.GetInsets(this)[0] + 408, 74, 26);
        //UPGRADE_TODO: Method 'java.awt.Container.add' was converted to 'System.Windows.Forms.ContainerControl.Controls.Add' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtContaineradd_javaawtComponent'"
        Controls.Add(textField1);
        textField2 = new System.Windows.Forms.TextBox();
        textField2.SetBounds(SupportClass.GetInsets(this)[1] + 612, SupportClass.GetInsets(this)[0] + 444, 73, 25);
        //UPGRADE_TODO: Method 'java.awt.Container.add' was converted to 'System.Windows.Forms.ContainerControl.Controls.Add' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtContaineradd_javaawtComponent'"
        Controls.Add(textField2);
        textField3 = new System.Windows.Forms.TextBox();
        textField3.SetBounds(SupportClass.GetInsets(this)[1] + 612, SupportClass.GetInsets(this)[0] + 480, 74, 25);
        //UPGRADE_TODO: Method 'java.awt.Container.add' was converted to 'System.Windows.Forms.ContainerControl.Controls.Add' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtContaineradd_javaawtComponent'"
        Controls.Add(textField3);
        textField4 = new System.Windows.Forms.TextBox();
        textField4.SetBounds(SupportClass.GetInsets(this)[1] + 612, SupportClass.GetInsets(this)[0] + 516, 73, 25);
        //UPGRADE_TODO: Method 'java.awt.Container.add' was converted to 'System.Windows.Forms.ContainerControl.Controls.Add' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtContaineradd_javaawtComponent'"
        Controls.Add(textField4);
        textField5 = new System.Windows.Forms.TextBox();
        textField5.SetBounds(SupportClass.GetInsets(this)[1] + 612, SupportClass.GetInsets(this)[0] + 552, 72, 25);
        //UPGRADE_TODO: Method 'java.awt.Container.add' was converted to 'System.Windows.Forms.ContainerControl.Controls.Add' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtContaineradd_javaawtComponent'"
        Controls.Add(textField5);
        System.Windows.Forms.Label temp_Label;
        temp_Label = new System.Windows.Forms.Label();
        temp_Label.Text = "Low X";
        label1 = temp_Label;
        label1.SetBounds(SupportClass.GetInsets(this)[1] + 564, SupportClass.GetInsets(this)[0] + 408, 38, 25);
        //UPGRADE_TODO: Method 'java.awt.Container.add' was converted to 'System.Windows.Forms.ContainerControl.Controls.Add' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtContaineradd_javaawtComponent'"
        Controls.Add(label1);
        System.Windows.Forms.Label temp_Label2;
        temp_Label2 = new System.Windows.Forms.Label();
        temp_Label2.Text = "Low Y";
        label2 = temp_Label2;
        label2.SetBounds(SupportClass.GetInsets(this)[1] + 564, SupportClass.GetInsets(this)[0] + 444, 36, 23);
        //UPGRADE_TODO: Method 'java.awt.Container.add' was converted to 'System.Windows.Forms.ContainerControl.Controls.Add' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtContaineradd_javaawtComponent'"
        Controls.Add(label2);
        System.Windows.Forms.Label temp_Label3;
        temp_Label3 = new System.Windows.Forms.Label();
//.........这里部分代码省略.........
开发者ID:wangchj,项目名称:geo-store-sim,代码行数:101,代码来源:Frame1.cs

示例6: Walk

        //int deeplevel;
        //bool needtoresize;
        public void Walk(Node node, int x, int y, int lev)
        {
            if (node != null)
            {
                Panel p = new Panel();

                p.AutoSize = true;
                Label l = new Label();
                int W1 = (int)Math.Round(Width / Math.Pow(2, y - 1));
                int X = (x - 1) * W1;
                int Y = (y - 1) * H1;
                if (node == tree.Current)
                {
                    l.BackColor = Color.Red;
                }
                if (node == tree.Prev)
                {
                    l.BackColor = Color.Green;
                }
                l.Text = node.Question.ToString();//+" "+X+","+Y+"\n"+W1;
                l.AutoSize = true;
                l.Left += W1 / 2;
                l.Top += H1 / 2;

                /*
                if (lev == deeplevel)
                {
                    if (Math.Abs(l.Left - dx) < 2)
                    {
                        needtoresize = true;
                        MessageBox.Show("needtoresize");
                        //NeedToEnlarge(this, new EventArgs());

                    }
                }
                else
                {
                    dx = l.Left + l.Width ;
                }
                 */

                //deeplevel = Math.Max(deeplevel, lev);

                l.TextAlign = ContentAlignment.MiddleCenter;
                l.BorderStyle = BorderStyle.FixedSingle;
                p.Controls.Add(l);
                p.SetBounds(X, Y, W1, H1);

                this.Controls.Add(p);

                Walk(node.Left, x * 2 - 1, y + 1,lev+1);
                Walk(node.Right, x * 2, y + 1,lev+1);
            }
        }
开发者ID:autumnharmony,项目名称:labs,代码行数:56,代码来源:TreeView.cs


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