예제 #1
0
        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));
        }
        private void frmImage_Load(object sender, System.EventArgs e)
        {
            try {
                int scWidth      = Screen.PrimaryScreen.Bounds.Width;
                int scHeight     = Screen.PrimaryScreen.Bounds.Height;
                int borderWidth  = this.Width - this.ClientRectangle.Width;
                int borderHeight = this.Height - this.ClientRectangle.Height;
                int newWidth     = 0;
                int newHeight    = 0;

                //Everything is governed by the size of the picture...
                this.pbImage.Size = new Size(this.pbImage.Image.Size.Width, this.pbImage.Image.Size.Height);
                this.ClientSize   = new Size(this.pbImage.Image.Size.Width, this.pbImage.Image.Size.Height);
                if (this.ClientSize.Width > scWidth)
                {
                    this.scrollH.Visible = true;
                    this.scrollH.Value   = 0;
                    this.scrollH.Minimum = 0;
                    newWidth             = scWidth;
                }
                else
                {
                    this.scrollH.Visible = false;
                    newWidth             = this.ClientSize.Width + borderWidth;
                }
                if (this.ClientSize.Height > scHeight)
                {
                    this.scrollV.Visible = true;
                    this.scrollV.Value   = 0;
                    this.scrollV.Minimum = 0;
                    newHeight            = scHeight;
                }
                else
                {
                    this.scrollV.Visible = false;
                    newHeight            = this.ClientSize.Height + borderHeight;
                }
                this.Size = new Size(newWidth, newHeight);

                //Adjust the viewport for the scroll bars (if necessary)...
                newWidth -= borderWidth;
                if (scrollV.Visible)
                {
                    newWidth = scrollV.Left;
                }
                newHeight -= borderHeight;
                if (scrollH.Visible)
                {
                    newHeight = scrollH.Top;
                }
                pcViewPort.SetBounds(0, 0, newWidth, newHeight);
                if (!scrollH.Visible && !scrollV.Visible)
                {
                    pcViewPort.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom;

                    pbImage.SetBounds(0, 0, newWidth, newHeight);
                    pbImage.Anchor   = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom;
                    pbImage.SizeMode = PictureBoxSizeMode.StretchImage;
                }
                else
                {
                    pcViewPort.Anchor = AnchorStyles.Top | AnchorStyles.Left;

                    pbImage.Anchor   = AnchorStyles.Top | AnchorStyles.Left;
                    pbImage.SizeMode = PictureBoxSizeMode.Normal;
                }

                //Center form...
                this.SetBounds((Screen.PrimaryScreen.Bounds.Width - this.Width) / 2, (Screen.PrimaryScreen.Bounds.Height - this.Height) / 2, 0, 0, BoundsSpecified.X | BoundsSpecified.Y);
            } catch (Exception ex) {
                ShowMsgBox(ex.Message, MsgBoxStyle.OkOnly, this, "Exception");
            }
        }
예제 #3
0
        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函数执行错误");
            }
        }
예제 #4
0
파일: Form1.cs 프로젝트: marck0793/Clientes
        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;
            }
        }
예제 #5
0
 private void OnTabControl_Resize(object sender, EventArgs e)
 {
     // fix the wide screen Tab Control issue by resize ourselfs the panels at the first Tab:
     panelFeeds.SetBounds(0, 0, tabControl.Width - 2 * panelFeeds.Location.X, 0, BoundsSpecified.Width);
 }
예제 #6
0
 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;
 }
예제 #7
0
    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();
        temp_Label3.Text = "High X";
        label3 = temp_Label3;
        label3.SetBounds(SupportClass.GetInsets(this)[1] + 564, SupportClass.GetInsets(this)[0] + 480, 39, 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(label3);
        System.Windows.Forms.Label temp_Label4;
        temp_Label4 = new System.Windows.Forms.Label();
        temp_Label4.Text = "High Y";
        label4 = temp_Label4;
        label4.SetBounds(SupportClass.GetInsets(this)[1] + 564, SupportClass.GetInsets(this)[0] + 516, 37, 27);
        //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(label4);
        System.Windows.Forms.Label temp_Label5;
        temp_Label5 = new System.Windows.Forms.Label();
        temp_Label5.Text = "OID";
        label5 = temp_Label5;
        label5.SetBounds(SupportClass.GetInsets(this)[1] + 564, SupportClass.GetInsets(this)[0] + 552, 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(label5);
        System.Windows.Forms.TextBox temp_TextBox;
        //UPGRADE_TODO: The equivalent in .NET for field 'java.awt.TextArea.SCROLLBARS_VERTICAL_ONLY' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'";;
        temp_TextBox = new System.Windows.Forms.TextBox();
        temp_TextBox.Text = "";
        temp_TextBox.WordWrap = false;
        temp_TextBox.ScrollBars = (System.Windows.Forms.ScrollBars) System.Windows.Forms.ScrollBars.Vertical;
        temp_TextBox.Multiline = true;
        textArea1 = temp_TextBox;
        textArea1.ReadOnly = !false;
        textArea1.SetBounds(SupportClass.GetInsets(this)[1] + 552, SupportClass.GetInsets(this)[0] + 0, 204, 398);
        //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(textArea1);
        //UPGRADE_ISSUE: Class hierarchy differences between 'java.awt.Panel' and 'System.Windows.Forms.Panel' may cause compilation errors. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1186'"
        panel1 = new System.Windows.Forms.Panel();
        //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'"
        /*
        panel1.setLayout(null);*/
        panel1.SetBounds(SupportClass.GetInsets(this)[1] + 0, SupportClass.GetInsets(this)[0] + 0, 553, 589);
        //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(panel1);
        Text = "A Basic Application";
        //}}

        //{{INIT_MENUS
        mainMenuBar = new System.Windows.Forms.MainMenu();
        menu1 = new System.Windows.Forms.MenuItem("File");
        miNew = new System.Windows.Forms.MenuItem("New");
        menu1.MenuItems.Add(miNew);
        miOpen = new System.Windows.Forms.MenuItem("Open...");
        menu1.MenuItems.Add(miOpen);
        miSave = new System.Windows.Forms.MenuItem("Save");
        menu1.MenuItems.Add(miSave);
        miSaveAs = new System.Windows.Forms.MenuItem("Save As...");
        menu1.MenuItems.Add(miSaveAs);
        menu1.MenuItems.Add(new System.Windows.Forms.MenuItem("-"));
        miExit = new System.Windows.Forms.MenuItem("Exit");
        menu1.MenuItems.Add(miExit);
        //mainMenuBar.add(menu1);
        menu2 = new System.Windows.Forms.MenuItem("Edit");
        miCut = new System.Windows.Forms.MenuItem("Cut");
        menu2.MenuItems.Add(miCut);
        miCopy = new System.Windows.Forms.MenuItem("Copy");
        menu2.MenuItems.Add(miCopy);
        miPaste = new System.Windows.Forms.MenuItem("Paste");
        menu2.MenuItems.Add(miPaste);
        //mainMenuBar.add(menu2);
        menu3 = new System.Windows.Forms.MenuItem("Help");
        //UPGRADE_ISSUE: Method 'java.awt.MenuBar.setHelpMenu' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaawtMenuBarsetHelpMenu_javaawtMenu'"
        mainMenuBar.setHelpMenu(menu3);
        miAbout = new System.Windows.Forms.MenuItem("About..");
        menu3.MenuItems.Add(miAbout);
        //mainMenuBar.add(menu3);
        Menu = mainMenuBar;
        //$$ mainMenuBar.move(4,277);
        //}}

        //{{REGISTER_LISTENERS
        SymWindow aSymWindow = new SymWindow(this);
        //UPGRADE_NOTE: Some methods of the 'java.awt.event.WindowListener' class are not used in the .NET Framework. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1308'"
        this.Closing += new System.ComponentModel.CancelEventHandler(aSymWindow.windowClosing);
        SymAction lSymAction = new SymAction(this);
        miOpen.Click += new System.EventHandler(lSymAction.actionPerformed);
        SupportClass.CommandManager.CheckCommand(miOpen);
        miAbout.Click += new System.EventHandler(lSymAction.actionPerformed);
        SupportClass.CommandManager.CheckCommand(miAbout);
        miExit.Click += new System.EventHandler(lSymAction.actionPerformed);
        SupportClass.CommandManager.CheckCommand(miExit);
        SymMouse aSymMouse = new SymMouse(this);
        button4.MouseDown += new System.Windows.Forms.MouseEventHandler(Frame1.mouseDown);
        button4.MouseDown += new System.Windows.Forms.MouseEventHandler(aSymMouse.mousePressed);
        button5.MouseDown += new System.Windows.Forms.MouseEventHandler(Frame1.mouseDown);
        button5.MouseDown += new System.Windows.Forms.MouseEventHandler(aSymMouse.mousePressed);
        button1.MouseDown += new System.Windows.Forms.MouseEventHandler(Frame1.mouseDown);
        button1.MouseDown += new System.Windows.Forms.MouseEventHandler(aSymMouse.mousePressed);
        button2.MouseDown += new System.Windows.Forms.MouseEventHandler(Frame1.mouseDown);
        button2.MouseDown += new System.Windows.Forms.MouseEventHandler(aSymMouse.mousePressed);
        button3.MouseDown += new System.Windows.Forms.MouseEventHandler(Frame1.mouseDown);
        button3.MouseDown += new System.Windows.Forms.MouseEventHandler(aSymMouse.mousePressed);
        //}}
    }
예제 #8
0
        //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);
            }
        }