public ProjectEffortManagement()
        {
            InitializeComponent();
            b = 0;

            warningLabel.Text = "";

            InfoTable2.ColumnCount = 6;
            InfoTable2.RowCount    = 100;
            InfoTable2.AutoSize    = true;
            //InfoTable2.Dock = DockStyle.Left;
            InfoTable2.GrowStyle = TableLayoutPanelGrowStyle.AddRows;

            InfoTable2.AutoSizeMode = AutoSizeMode.GrowOnly;
            temppanel.AutoScroll    = true;
            temppanel.Dock          = DockStyle.Fill;
            temppanel.AutoSize      = true;

            if (!panel1.Contains(temppanel))
            {
                panel1.Controls.Add(temppanel);
                temppanel.BringToFront();
            }
            else
            {
                temppanel.BringToFront();
            }


            if (!temppanel.Contains(InfoTable2))
            {
                temppanel.Controls.Add(InfoTable2);
                InfoTable2.BringToFront();
            }
            else
            {
                InfoTable2.BringToFront();
            }

            //reportType.Text = Project.Instance.getDateType();
            CurrentDatalabel.Text = date.Month.ToString() + "/" + date.Day.ToString() + "/" + date.Year.ToString();


            PieChart.Series["Series1"].Points[0].SetValueXY("Management", 0);
            PieChart.Series["Series1"].Points[1].SetValueXY("Requirements", 0);
            PieChart.Series["Series1"].Points[2].SetValueXY("Design", 0);
            PieChart.Series["Series1"].Points[3].SetValueXY("Implementation", 0);
            PieChart.Series["Series1"].Points[4].SetValueXY("Testing", 0);

            //ProjectEffortManagement.Instance.clearAndFillTable();
            //ProjectEffortManagement.Instance.add();
        }
        private void UpdateUI()
        {
            SuspendLayout();

            // Show the file selection if no data provider was returned.
            DwordDataProvider dataProvider = GetDataProvider(_categoryRows.Select(x => x.SelectedCategory).ToArray());

            _tlpFile.Visible          = dataProvider == null;
            _binDataGrid.Visible      = dataProvider != null;
            _binDataGrid.DataProvider = dataProvider;

            // Hide Save buttons if no file is open.
            bool fileOpen = BinFile != null;

            _fbSave.Visible   = fileOpen;
            _fbSaveAs.Visible = fileOpen;

            // Fix Windows Forms' hilariously uncontrollable dock order.
            foreach (CategoryRow categoryRow in _categoryRows)
            {
                categoryRow.BringToFront();
            }
            _tlpFile.BringToFront();
            _binDataGrid.BringToFront();

            // Focus the data grid if it is visible.
            if (_binDataGrid.Visible)
            {
                _binDataGrid.Focus();
            }

            ResumeLayout();
        }
Exemplo n.º 3
0
        private void Gbtn_Click(object sender, EventArgs e)
        {
            GlassButton      gbtn = sender as GlassButton;
            TableLayoutPanel flp  = gbtn.Tag as TableLayoutPanel;
            //FlowLayoutPanel flp = gbtn.Tag as FlowLayoutPanel;
            Panel panel = flp.Tag as Panel;

            panel.BringToFront();
            flp.BringToFront();
            foreach (Control item in flp.Controls)
            {
                if (item is TableLayoutPanel)
                {
                    foreach (var lb in item.Controls)
                    {
                        if (lb is Label)
                        {
                            Label l = lb as Label;
                            if (l.Tag is Field)
                            {
                                (l.Tag as Field).RefreshPanel2();
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 4
0
 private void Links_playing_Tick(object sender, EventArgs e)
 {
     if (button_frame != null && LinkImages.Count > 0)
     {
         LinkPlayerIndex++;
         if (LinkPlayerIndex > (button_frame.ColumnCount - 1))
         {
             LinkPlayerIndex = 0;
         }
         Button LastButton = button_frame.GetControlFromPosition(SelectedButtonIndex, 0) as Button;
         LastButton.BackgroundImage = null;
         SelectedButtonIndex        = LinkPlayerIndex;
         Button CurrentButton = button_frame.GetControlFromPosition(LinkPlayerIndex, 0) as Button;
         CurrentButton.BackgroundImage = btnImg;
         LinkImages[LinkPlayerIndex].BringToFront();
         button_frame.BringToFront();
     }
 }
Exemplo n.º 5
0
        //组模块标题label点击事件
        private void Lbtitle_DoubleClick(object sender, EventArgs e)
        {
            Control lbtitle = sender as Control;
            //lbAll.Text = lbtitle.Text;
            TableLayoutPanel flp     = lbtitle.Tag as TableLayoutPanel;
            List <Sensor>    sensors = (List <Sensor>)flp.Tag;

            foreach (Sensor ss in sensors)
            {
                foreach (Field item in ss.Model.Fields)
                {
                    if (item.Realtime)
                    {
                        flp.Controls.Add(item.ChartPanel);
                        //flp.Controls.Add(item.Chart);
                    }
                }
            }
            flp.BringToFront();
        }
Exemplo n.º 6
0
        private void SetFightersStats(GameModel game, List <Fighter> fighters, int x)
        {
            Action c = () =>
            {
                Controls.RemoveByKey(x.ToString() + "statsTable");
                var table = new TableLayoutPanel();
                table.RowCount    = fighters.Count * 3;
                table.Width       = 30;
                table.Height      = fighters.Count * 100;
                table.ColumnCount = 1;
                table.Location    = new Point(x, 0);
                table.Name        = x.ToString() + "statsTable";
                for (var i = 0; i < fighters.Count; i++)
                {
                    var healthLabel = new Label();
                    healthLabel.ForeColor      = Color.Red;
                    healthLabel.Width          = 25;
                    fighters[i].HealthChanged += f => healthLabel.Text = f.Health.ToString();
                    healthLabel.Text           = fighters[i].Health.ToString();
                    table.Controls.Add(healthLabel);
                    var manaLabel = new Label();
                    manaLabel.ForeColor      = Color.Blue;
                    manaLabel.Width          = 25;
                    fighters[i].ManaChanged += f => manaLabel.Text = f.Mana.ToString();
                    manaLabel.Text           = fighters[i].Mana.ToString();
                    table.Controls.Add(manaLabel);
                    table.Controls.Add(new Label()
                    {
                        Height = 70
                    });
                }
                Controls.Add(table);
                SetFightersPictures(game, fighters, x);
                table.BringToFront();
                table.BackColor = Color.FromArgb(1, 0, 255, 100);
            };

            c();
            game.Death += c;
        }
Exemplo n.º 7
0
        public WinFlyoutMenu(Button button, TableLayoutPanel menu, Panel buttonBar, FlyoutAttachment attachment, float pointSize, bool fixedWidth, Padding padding,
                             Color cMainButtonText, Color cMainButtonDeselected, Color cMainButtonSelected, Color cMenuButtonText, Color cMenuButtonDeselected, Color cMenuButtonSelected)
            : base(button, cMainButtonText, cMainButtonDeselected, cMainButtonSelected)
        {
            this.menu          = menu;
            this.namedControls = new Dictionary <string, KButton>();
            this.menu.Margin   = new Padding(0);
            this.menu.Padding  = padding;
            this.buttonBar     = buttonBar;
            this.autoClose     = false;
            this.pointSize     = pointSize;
            this.fixedWidth    = fixedWidth;
            this.attachment    = attachment;

            this.cMenuButtonText       = cMenuButtonText;
            this.cMenuButtonDeselected = cMenuButtonDeselected;
            this.cMenuButtonSelected   = cMenuButtonSelected;
            menu.BackColor             = cMenuButtonDeselected;
            menu.AutoSize     = true;
            menu.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            menu.AutoScroll   = false; // or it will flow horizontally and add a scrollbar
            menu.Visible      = false;
            menu.BringToFront();
        }
Exemplo n.º 8
0
        private void NewPlan()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TemplatesControl));
            TableLayoutPanel xtableLayoutPanel2 = new TableLayoutPanel();
            TextBox          xtextBox2          = new TextBox();
            TextBox          xtextBox1          = new TextBox();
            Button           xbutton2           = new Button();

            //
            // tableLayoutPanel2
            //
            xtableLayoutPanel2.BackColor   = System.Drawing.Color.FromArgb(((int)(((byte)(43)))), ((int)(((byte)(43)))), ((int)(((byte)(43)))));
            xtableLayoutPanel2.ColumnCount = 3;
            xtableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33F));
            xtableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 66.67F));
            xtableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
            xtableLayoutPanel2.Controls.Add(xtextBox2, 1, 0);
            xtableLayoutPanel2.Controls.Add(xtextBox1, 0, 0);
            xtableLayoutPanel2.Controls.Add(xbutton2, 2, 0);
            xtableLayoutPanel2.Dock     = System.Windows.Forms.DockStyle.Top;
            xtableLayoutPanel2.Location = new System.Drawing.Point(5, 35);
            xtableLayoutPanel2.Name     = "tableLayoutPanel2";
            xtableLayoutPanel2.RowCount = 1;
            xtableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
            xtableLayoutPanel2.Size     = new System.Drawing.Size(440, 30);
            xtableLayoutPanel2.TabIndex = 2;
            //
            // textBox1
            //
            xtextBox1.Anchor      = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            xtextBox1.BackColor   = System.Drawing.Color.FromArgb(((int)(((byte)(43)))), ((int)(((byte)(43)))), ((int)(((byte)(43)))));
            xtextBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            xtextBox1.Font        = new System.Drawing.Font("Microsoft Sans Serif", 10F);
            xtextBox1.ForeColor   = System.Drawing.Color.DarkGray;
            xtextBox1.Location    = new System.Drawing.Point(3, 3);
            xtextBox1.MaxLength   = 20;
            xtextBox1.Name        = "textBox1";
            xtextBox1.Size        = new System.Drawing.Size(134, 23);
            xtextBox1.TabIndex    = 8;
            //
            // textBox2
            //
            xtextBox2.Anchor      = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            xtextBox2.BackColor   = System.Drawing.Color.FromArgb(((int)(((byte)(43)))), ((int)(((byte)(43)))), ((int)(((byte)(43)))));
            xtextBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            xtextBox2.Font        = new System.Drawing.Font("Microsoft Sans Serif", 10F);
            xtextBox2.ForeColor   = System.Drawing.Color.DarkGray;
            xtextBox2.Location    = new System.Drawing.Point(143, 7);
            xtextBox2.MaxLength   = 20;
            xtextBox2.Name        = "textBox2";
            xtextBox2.Size        = new System.Drawing.Size(274, 23);
            xtextBox2.TabIndex    = 9;
            //
            // button2
            //
            xbutton2.Cursor = System.Windows.Forms.Cursors.Hand;
            xbutton2.Dock   = System.Windows.Forms.DockStyle.Right;
            xbutton2.FlatAppearance.BorderSize = 0;
            xbutton2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            xbutton2.Image     = ((System.Drawing.Image)(resources.GetObject("button2.Image")));
            xbutton2.Location  = new System.Drawing.Point(421, 0);
            xbutton2.Margin    = new System.Windows.Forms.Padding(5);
            xbutton2.Name      = "button2";
            xbutton2.Size      = new System.Drawing.Size(30, 30);
            xbutton2.TabIndex  = 5;
            xbutton2.UseVisualStyleBackColor = true;
            xbutton2.Click += new System.EventHandler(this.button2_Click);

            panel1.Controls.Add(xtableLayoutPanel2);
            xtableLayoutPanel2.BringToFront();
            xtextBox1.Focus();
        }
Exemplo n.º 9
0
        private void TemplatesControl_Load(object sender, EventArgs e)
        {
            MethodInvoker methodInvokerDelegate = async delegate()
            {
                var sss = await API.GetPresetss(Token, "");

                foreach (var item in sss)
                {
                    System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TemplatesControl));
                    TableLayoutPanel xtableLayoutPanel2 = new TableLayoutPanel();
                    Label            xlabel2            = new Label();
                    Label            xlabel1            = new Label();
                    Button           xbutton2           = new Button();
                    //
                    // tableLayoutPanel2
                    //
                    xtableLayoutPanel2.BackColor   = System.Drawing.Color.FromArgb(((int)(((byte)(43)))), ((int)(((byte)(43)))), ((int)(((byte)(43)))));
                    xtableLayoutPanel2.ColumnCount = 3;
                    xtableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33F));
                    xtableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 66.67F));
                    xtableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
                    xtableLayoutPanel2.Controls.Add(xlabel2, 1, 0);
                    xtableLayoutPanel2.Controls.Add(xlabel1, 0, 0);
                    xtableLayoutPanel2.Controls.Add(xbutton2, 2, 0);
                    xtableLayoutPanel2.Dock     = System.Windows.Forms.DockStyle.Top;
                    xtableLayoutPanel2.Location = new System.Drawing.Point(5, 35);
                    xtableLayoutPanel2.Name     = "tableLayoutPanel2";
                    xtableLayoutPanel2.RowCount = 1;
                    xtableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
                    xtableLayoutPanel2.Size     = new System.Drawing.Size(440, 30);
                    xtableLayoutPanel2.TabIndex = 2;
                    //
                    // label2
                    //
                    xlabel2.Dock        = System.Windows.Forms.DockStyle.Fill;
                    xlabel2.FlatStyle   = System.Windows.Forms.FlatStyle.Flat;
                    xlabel2.Font        = new System.Drawing.Font("Microsoft Sans Serif", 10F);
                    xlabel2.ForeColor   = System.Drawing.Color.Gray;
                    xlabel2.Location    = new System.Drawing.Point(143, 0);
                    xlabel2.Name        = "label2";
                    xlabel2.Padding     = new System.Windows.Forms.Padding(6, 0, 0, 0);
                    xlabel2.RightToLeft = System.Windows.Forms.RightToLeft.No;
                    xlabel2.Size        = new System.Drawing.Size(274, 30);
                    xlabel2.TabIndex    = 7;
                    xlabel2.Text        = item.Feleds;
                    xlabel2.TextAlign   = System.Drawing.ContentAlignment.MiddleLeft;
                    //
                    // label1
                    //
                    xlabel1.Dock        = System.Windows.Forms.DockStyle.Fill;
                    xlabel1.FlatStyle   = System.Windows.Forms.FlatStyle.Flat;
                    xlabel1.Font        = new System.Drawing.Font("Microsoft Sans Serif", 12F);
                    xlabel1.ForeColor   = System.Drawing.Color.DarkGray;
                    xlabel1.Location    = new System.Drawing.Point(3, 0);
                    xlabel1.Name        = "label1";
                    xlabel1.Padding     = new System.Windows.Forms.Padding(6, 0, 0, 0);
                    xlabel1.RightToLeft = System.Windows.Forms.RightToLeft.No;
                    xlabel1.Size        = new System.Drawing.Size(134, 30);
                    xlabel1.TabIndex    = 6;
                    xlabel1.Text        = item.Name;
                    xlabel1.TextAlign   = System.Drawing.ContentAlignment.MiddleLeft;
                    keyValuePairs.Add(xlabel1, item.ID);
                    //
                    // button2
                    //
                    xbutton2.Cursor = System.Windows.Forms.Cursors.Hand;
                    xbutton2.Cursor = System.Windows.Forms.Cursors.Hand;
                    xbutton2.Dock   = System.Windows.Forms.DockStyle.Right;
                    xbutton2.FlatAppearance.BorderSize = 0;
                    xbutton2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
                    xbutton2.Image     = ((System.Drawing.Image)(resources.GetObject("button7.Image")));
                    xbutton2.Location  = new System.Drawing.Point(421, 0);
                    xbutton2.Margin    = new System.Windows.Forms.Padding(5);
                    xbutton2.Name      = "button7";
                    xbutton2.Size      = new System.Drawing.Size(24, 30);
                    xbutton2.TabIndex  = 5;
                    xbutton2.UseVisualStyleBackColor = true;
                    xbutton2.Click -= new System.EventHandler(this.button2_Click);
                    xbutton2.Click += new System.EventHandler(this.button8_ClickAsync);

                    panel1.Controls.Add(xtableLayoutPanel2);
                    xtableLayoutPanel2.BringToFront();
                }
                this.Cursor = Cursors.Default;
            };

            if (this.InvokeRequired)
            {
                this.Invoke(methodInvokerDelegate);
            }
            else
            {
                methodInvokerDelegate();
            }
        }
Exemplo n.º 10
0
        private void Init()
        {
            this.BeginInvoke((Action)(() => {
                Meth.HandleTheme(this);

                Dotnetrix_Samples.TabControl Tabs = new Dotnetrix_Samples.TabControl();
                Tabs.Dock = DockStyle.Fill;
                Tabs.AutoSize = true;
                Meth.HandleTheme(Tabs);

                Panel[] Pages = new Panel[] {
                    new Pages.Home(),
                    new Pages.User(),
                    new Pages.Share(),
                    new Pages.Backups(),
                    new Pages.Collabs(),
                    new Pages.LevelEdit(),
                    new Pages.SettingPage()
                };

                foreach (Panel Page in Pages)
                {
                    TabPage Tab = new TabPage();
                    Tab.Controls.Add(Page);
                    Tab.Text = Page.Name;
                    Meth.HandleTheme(Tab);
                    Tabs.Controls.Add(Tab);
                }

                TableLayoutPanel FileDropOverlay = new TableLayoutPanel();
                FileDropOverlay.Size = this.Size;
                FileDropOverlay.Location = new Point(0, 0);
                FileDropOverlay.Controls.Add(new Elem.Text("Drop imports / backups here!"));
                FileDropOverlay.Controls.Add(new Elem.BigNewLine());
                FileDropOverlay.Controls.Add(new Elem.Text($"Supported level formats: {GDTools.Ext.LevelList}\r\nSupported backup formats: Folder, .zip, {GDTools.Ext.Backup}"));
                FileDropOverlay.Visible = false;
                FileDropOverlay.BringToFront();

                this.Controls.Add(FileDropOverlay);
                this.Controls.Add(Tabs);

                this.DragEnter += (s, e) => {
                    if (e.Data.GetDataPresent(DataFormats.FileDrop))
                    {
                        e.Effect = DragDropEffects.All;
                        FileDropOverlay.Visible = true;
                    }
                };
                this.DragLeave += (s, e) => {
                    FileDropOverlay.Visible = false;
                };
                this.DragDrop += (s, e) => {
                    string[] drops = (string[])e.Data.GetData(DataFormats.FileDrop, false);
                    foreach (string drop in drops)
                    {
                        if (File.GetAttributes(drop).HasFlag(FileAttributes.Directory))
                        {
                            ((Pages.Backups)Pages[Array.FindIndex(Pages, x => x.Name == "Backups")]).ImportBackup(drop);
                        }
                        else
                        {
                            foreach (string Ext in GDTools.Ext.ExtArray.Levels)
                            {
                                if (drop.EndsWith(Ext))
                                {
                                    ((Pages.Share)Pages[Array.FindIndex(Pages, x => x.Name == "Sharing")]).AddImport(drop);
                                }
                            }
                            foreach (string Ext in GDTools.Ext.ExtArray.Backups)
                            {
                                if (drop.EndsWith(Ext))
                                {
                                    ((Pages.Backups)Pages[Array.FindIndex(Pages, x => x.Name == "Backups")]).ImportBackup(drop);
                                }
                            }
                        }
                    }
                    FileDropOverlay.Visible = false;
                };
                AllowDrop = true;

                Task.Run <bool>(() => {
                    while (!GDTools.CheckIfGDIsOpen())
                    {
                        Thread.Sleep(GDTools._GDCheckLoopTime);
                    }

                    this.AwaitGDClose();

                    return(true);
                });
            }));
        }
Exemplo n.º 11
0
        private void f_Load_PChitiet()
        {
            try
            {
                p.Controls.Clear();
                Label   alb;
                TextBox atb;

                m_table                 = new TableLayoutPanel();
                m_table.Name            = "tableLayoutPanel_01";
                m_table.Text            = "?";
                m_table.AutoScroll      = true;
                m_table.BorderStyle     = BorderStyle.None;
                m_table.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.None;
                //  m_table.BackColor = Color.Honeydew;

                m_table.Padding  = new System.Windows.Forms.Padding(0, 0, 0, 0);
                m_table.AutoSize = true;

                m_table.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.AutoSize));
                m_table.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.AutoSize));

                int ai = 0, arow = 0, acol = 0;
                foreach (DataRow r in dtnhom.Rows)
                {
                    ai++;
                    m_table.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 22F));

                    alb           = new Label();
                    alb.Name      = "lbma_" + r["ma"].ToString();
                    alb.Text      = r["ten"].ToString().Trim() + ":";
                    alb.Font      = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                    alb.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Right | System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)));
                    alb.TextAlign = ContentAlignment.MiddleRight;
                    alb.Width     = 110;
                    alb.Left      = 1;
                    m_table.Controls.Add(alb, acol, arow);

                    atb           = new TextBox();
                    atb.Name      = "tbma_" + r["ma"].ToString();
                    atb.Text      = "";
                    atb.Enabled   = false;
                    atb.BackColor = Color.White;
                    atb.Width     = 90;

                    atb.Leave     += new System.EventHandler(this.f_Control_Leave);
                    atb.Enter     += new System.EventHandler(this.f_Control_Enter);
                    atb.KeyDown   += new System.Windows.Forms.KeyEventHandler(this.f_Control_KeyDown);
                    atb.Validated += new System.EventHandler(this.txt_Validated);
                    atb.KeyPress  += new System.Windows.Forms.KeyPressEventHandler(this.f_Control_Keypress);

                    atb.ReadOnly  = false;
                    atb.TextAlign = HorizontalAlignment.Right;
                    m_table.Controls.Add(atb, acol + 1, arow);
                    arow++;
                }
                m_table.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.AutoSize));
                alb           = new Label();
                alb.Name      = "_blank";
                alb.Text      = "";
                alb.AutoSize  = false;
                alb.Font      = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                alb.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right | System.Windows.Forms.AnchorStyles.Bottom)));
                alb.TextAlign = ContentAlignment.MiddleRight;
                m_table.Controls.Add(alb, 0, ai);

                p.Controls.Add(m_table);
                m_table.BringToFront();
            }
            catch
            {
            }
            finally
            {
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// 设置轮播图
        /// </summary>
        private void SetCarouselmap()
        {
            #region 设置轮播图数据
            //移除所有网址链接
            link_page.Controls.Clear();
            //添加图片文件至链表
            LinkImages.Clear();

            for (int i = 0; i < ImageLinksPathes.Count; i++)
            {
                if (File.Exists(ImageLinksPathes[i]) && (IsUrl.Match(UrlInfo[i]).Success || IsUrlWithoutHttp.Match(UrlInfo[i]).Success))
                {
                    PictureBox a_picture = new PictureBox()
                    {
                        BackgroundImage       = Image.FromFile(ImageLinksPathes[i]),
                        BackgroundImageLayout = ImageLayout.Stretch,
                        Location = new Point(0, 0),
                        Dock     = DockStyle.Fill,
                        Size     = link_page.Size
                    };
                    link_tip.SetToolTip(a_picture, ImageLinksDescription[i]);
                    int currentIndex = i;
                    a_picture.Cursor = Cursors.Hand;
                    a_picture.Click += (a, b) => {
                        Process.Start(UrlInfo[currentIndex]);
                    };
                    LinkImages.Add(a_picture);
                    //创建图片文件
                    if (!File.Exists(Application.StartupPath + "\\UrlLinks\\" + ImageLinksDescription[i] + ".png"))
                    {
                        Image      a_image   = a_picture.BackgroundImage;
                        FileStream img_steam = new FileStream(Application.StartupPath + "\\UrlLinks\\" + ImageLinksDescription[i] + ".png", FileMode.Create);
                        a_image.Save(img_steam, ImageFormat.Png);
                    }
                    //创建链接文本文件
                    if (!File.Exists(Application.StartupPath + "\\UrlLinks\\" + ImageLinksDescription[i] + ".txt"))
                    {
                        File.WriteAllText(Application.StartupPath + "\\UrlLinks\\" + ImageLinksDescription[i] + ".txt", UrlInfo[currentIndex]);
                    }
                }
            }

            //添加图像框和按钮系统到链接页面
            //新建按钮框
            button_frame = new TableLayoutPanel
            {
                ColumnCount     = LinkImages.Count,
                RowCount        = 1,
                BackColor       = Color.Transparent,
                CellBorderStyle = TableLayoutPanelCellBorderStyle.None,
                Location        = new Point(link_page.Width / 2 - (LinkImages.Count * 25 / 2), link_page.Height - 60)
            };

            #region 实例化按钮
            for (int i = 0; i < LinkImages.Count; i++)
            {
                link_page.Controls.Add(LinkImages[i]);
                Button img_btn = new Button()
                {
                    Size   = new Size(25, 25),
                    Anchor = AnchorStyles.Left,
                    BackgroundImageLayout = ImageLayout.Stretch,
                    BackgroundImage       = i == 0 ? btnImg : null,
                    Cursor = Cursors.Hand
                };
                int currentIndex = i;
                //绑定点击事件
                img_btn.Click += (a, b) => {
                    click_sound.Play();
                    Button LastButton = button_frame.GetControlFromPosition(SelectedButtonIndex, 0) as Button;
                    LastButton.BackgroundImage = null;
                    SelectedButtonIndex        = currentIndex;
                    LinkImages[currentIndex].BringToFront();
                    img_btn.BackgroundImage = btnImg;
                    button_frame.BringToFront();
                    Timer stop = new Timer()
                    {
                        Interval = 1000,
                        Enabled  = true
                    };
                    links_playing.Enabled = false;
                    stop.Tick            += (c, d) => {
                        LinkPlayerIndex       = currentIndex;
                        links_playing.Enabled = true;
                        stop.Dispose();
                    };
                };
                button_frame.Controls.Add(img_btn, i, 0);
            }
            #endregion

            button_frame.Size = new Size(LinkImages.Count * 30 + 5, 30);
            link_page.Controls.Add(button_frame);
            button_frame.BringToFront();
            //轮播图速度
            links_playing.Interval = cbhk_properties.CarouseMapSpeed;
            #endregion
        }
Exemplo n.º 13
0
        public IValue answer; // значение переменной устанавливается после закрытия диалога

        QueryBoxWithTimeOut(string queryText, CLREnumValueWrapper <InnerQuestionDialogModeEnum> buttons, int timeOut, CLREnumValueWrapper <InnerDialogReturnCodeEnum> defaultButton, string title, CLREnumValueWrapper <InnerDialogReturnCodeEnum> timeOutButton)
        {
            _timeOut     = timeOut;
            _timeCounter = _timeOut;

            _form = new Form();

            _form.Height          = 140;
            _form.Width           = 200;
            _form.Text            = title;
            _form.StartPosition   = FormStartPosition.CenterScreen;
            _form.MinimumSize     = new Size(200, 140);
            _form.MaximizeBox     = false;
            _form.MinimizeBox     = false;
            _form.ControlBox      = false;
            _form.FormBorderStyle = FormBorderStyle.FixedDialog;

            TableLayoutPanel CommonPanel = new TableLayoutPanel();

            CommonPanel.ColumnCount = 1;
            CommonPanel.RowCount    = 2;
            CommonPanel.AutoSize    = true;
            _form.Controls.Add(CommonPanel);

            // Label
            _queryLabel           = new Label();
            _queryLabel.Text      = queryText;
            _queryLabel.Padding   = new Padding(10, 10, 10, 10);
            _queryLabel.TextAlign = ContentAlignment.MiddleCenter;
            _queryLabel.AutoSize  = true;

            Panel panel = new Panel();

            panel.Dock     = DockStyle.Top;
            panel.AutoSize = true;
            panel.Controls.Add(_queryLabel);
            CommonPanel.Controls.Add(panel, 0, 0);
            panel.BringToFront();
            panel.Anchor = AnchorStyles.None;

            // Buttons

            _formButtons = new Dictionary <string, InnerDialogReturnCodeEnum>();

            _buttonsPanel = new TableLayoutPanel();

            _buttonsPanel.RowStyles.Clear();
            _buttonsPanel.ColumnStyles.Clear();

            _buttonsPanel.Height   = 20;
            _buttonsPanel.Padding  = new Padding(20, 0, 20, 0);
            _buttonsPanel.Dock     = DockStyle.Bottom;
            _buttonsPanel.AutoSize = true;
            _buttonsPanel.RowStyles.Add(new RowStyle(SizeType.AutoSize));
            _buttonsPanel.Anchor = AnchorStyles.None;
            CommonPanel.Controls.Add(_buttonsPanel, 0, 1);
            _buttonsPanel.BringToFront();

            _buttonsPanel.RowCount = 1;
            switch ((InnerQuestionDialogModeEnum)buttons.UnderlyingObject)
            {
            case InnerQuestionDialogModeEnum.YesNo:
                AddButton(_buttonsPanel, "Yes", "Да", InnerDialogReturnCodeEnum.Yes);
                AddButton(_buttonsPanel, "No", "Нет", InnerDialogReturnCodeEnum.No);
                break;

            case InnerQuestionDialogModeEnum.YesNoCancel:
                AddButton(_buttonsPanel, "Yes", "Да", InnerDialogReturnCodeEnum.Yes);
                AddButton(_buttonsPanel, "No", "Нет", InnerDialogReturnCodeEnum.No);
                AddButton(_buttonsPanel, "Cancel", "Отмена", InnerDialogReturnCodeEnum.Cancel);
                break;

            case InnerQuestionDialogModeEnum.OK:
                AddButton(_buttonsPanel, "OK", "ОК", InnerDialogReturnCodeEnum.OK);
                break;

            case InnerQuestionDialogModeEnum.OKCancel:
                AddButton(_buttonsPanel, "OK", "ОК", InnerDialogReturnCodeEnum.OK);
                AddButton(_buttonsPanel, "Cancel", "Отмена", InnerDialogReturnCodeEnum.Cancel);
                break;

            case InnerQuestionDialogModeEnum.RetryCancel:
                AddButton(_buttonsPanel, "Retry", "Повторить", InnerDialogReturnCodeEnum.Retry);
                AddButton(_buttonsPanel, "Cancel", "Отмена", InnerDialogReturnCodeEnum.Cancel);
                break;

            case InnerQuestionDialogModeEnum.AbortRetryIgnore:
                AddButton(_buttonsPanel, "Abort", "Прервать", InnerDialogReturnCodeEnum.Abort);
                AddButton(_buttonsPanel, "Retry", "Повторить", InnerDialogReturnCodeEnum.Retry);
                AddButton(_buttonsPanel, "Ignore", "Пропустить", InnerDialogReturnCodeEnum.Ignore);
                break;

            default:
                Console.WriteLine("Передано неизвестное значение типа РежимДиалогаВопрос");
                return;
            }

            _buttonsPanel.ColumnCount = _buttonsPanel.Controls.Count;

            string timeOutButtonName = "";

            if (_buttonsPanel.Controls.Count > 0)
            {
                if (defaultButton == null)
                {
                    _defaultButton = _formButtons[_buttonsPanel.Controls[0].Name];
                }
                else
                {
                    _defaultButton = _formButtons[defaultButton.UnderlyingObject.ToString()];
                }

                if (timeOutButton == null)
                {
                    _timeOutButton    = _formButtons[_buttonsPanel.Controls[0].Name];
                    timeOutButtonName = _buttonsPanel.Controls[0].Text;
                }
                else
                {
                    _timeOutButton    = _formButtons[timeOutButton.UnderlyingObject.ToString()];
                    timeOutButtonName = _buttonsPanel.Controls.Find(timeOutButton.UnderlyingObject.ToString(), false)[0].Text;
                }
            }

            using (Graphics g = _form.CreateGraphics())
            {
                SizeF size = g.MeasureString(queryText, _queryLabel.Font);
                // С механизмом выравнивания элементов надо что-то делать, слишком много химии и волшебных чисел
                _form.Width = Math.Max((int)Math.Ceiling(size.Width) + _queryLabel.Padding.Horizontal, _formButtons.Count * (BUTTON_MIN_WIDTH + BUTTON_PADDING * 2) + (timeOut > 0 ? BUTTON_MIN_WIDTH / 2 + 60: BUTTON_MIN_WIDTH / 2));
            }

            if (_timeOut != 0)
            {
                // Создадим два таймера,
                //один для срабатывания события окончания ожидания
                _timeoutTimer = new System.Threading.Timer(OnTimerElapsed,
                                                           null, _timeOut * 1000, System.Threading.Timeout.Infinite);

                // и еще один, для посекундного оповещения об истичении времени
                _tickTimer = new System.Threading.Timer(OnTickTimer, timeOutButtonName, 0, 1000);
            }

            // Установим фокус на кнопку по умолчанию
            Control defaulButtonControl = _buttonsPanel.Controls.Find(_defaultButton.ToString(), false)[0];

            defaulButtonControl.Focus();
            defaulButtonControl.Select();

            using (_timeoutTimer)
                _form.ShowDialog(null);
        }
Exemplo n.º 14
0
        public void CreateControls(Review review, int num)
        {
            switch (num)
            {
            case 0:
                //パネルインスタンス
                PictureBox wani = new PictureBox();
                //名前
                wani.Name = "waniChara";
                //サイズ設定
                wani.SizeMode = PictureBoxSizeMode.Zoom;
                //サイズ
                wani.Size = new Size(200, 200);
                //画像
                if (talkflg == false)
                {
                    wani.Image = Image.FromFile(FilePath + "\\images\\Idle.gif");
                }
                else if (talkflg == true)
                {
                    wani.Image = Image.FromFile(FilePath + "\\images\\talk.gif");
                }
                //色
                wani.BackColor = Color.FromName("Transparent");
                //座標
                wani.Location = new Point(641, 388);
                //作業領域に追加
                panel4.Controls.Add(wani);
                //最前面に設定
                wani.BringToFront();
                break;

            //------------------------------------------------
            case 1:
                //フローチャートの肉部品の追加
                PictureBox meat = new PictureBox();
                //フローチャートのなまず部品の追加
                PictureBox catfish = new PictureBox();
                //フローチャートのかに部品の追加
                PictureBox crab = new PictureBox();
                //フローチャートの貝部分の追加
                PictureBox shell = new PictureBox();
                //フローチャートの上部分の追加(上顎)
                PictureBox upF = new PictureBox();
                //ラベル
                Label upL      = new Label();
                Label bottomL  = new Label();
                Label meatL    = new Label();
                Label catfishL = new Label();
                Label crabL    = new Label();
                Label shellL   = new Label();
                Font  font     = new Font("コーポレート・ロゴ(ラウンド)", 18);
                //フローチャートの下部部の追加(下顎)
                PictureBox bottomF = new PictureBox();
                //迷路部分の追加
                TableLayoutPanel field = new TableLayoutPanel();
                //キャラクターの追加
                PictureBox chara = new PictureBox();
                //ドクロの追加
                PictureBox skull = new PictureBox();
                //爆弾の追加
                PictureBox bomb  = new PictureBox();
                PictureBox bomb2 = new PictureBox();

                //肉部品設定
                meat.Name       = "meat_0";
                meat.Size       = new Size(270, 79);
                meat.SizeMode   = PictureBoxSizeMode.StretchImage;
                meat.Location   = new Point(45, 90);
                meat.BackColor  = Color.FromName("White");
                meat.Image      = Image.FromFile(review.FilePath + "\\images\\flowchart\\meat.png");
                meat.Parent     = panel4;
                meat.MouseDown += new MouseEventHandler(this.Control_MouseDown);
                meat.MouseMove += new MouseEventHandler(this.Control_MouseMove);
                meat.MouseUp   += new MouseEventHandler(this.Control_MouseUp);
                //肉部品ラベル設定
                meatL.Text      = "うえ";
                meatL.Font      = new Font(font.FontFamily, 18);
                meatL.ForeColor = Color.White;
                meatL.BackColor = Color.Transparent;
                meatL.Size      = new Size(50, 30);
                meatL.Location  = new Point(110, 30);

                //貝部品設定
                shell.Name       = "shell_0";
                shell.Size       = new Size(270, 79);
                shell.SizeMode   = PictureBoxSizeMode.StretchImage;
                shell.Location   = new Point(45, 175);
                shell.BackColor  = Color.FromName("White");
                shell.Image      = Image.FromFile(review.FilePath + "\\images\\flowchart\\shell.png");
                shell.Parent     = panel4;
                shell.MouseDown += new MouseEventHandler(this.Control_MouseDown);
                shell.MouseMove += new MouseEventHandler(this.Control_MouseMove);
                shell.MouseUp   += new MouseEventHandler(this.Control_MouseUp);
                //貝ラベル設定
                shellL.Text      = "うえ";
                shellL.Font      = new Font(font.FontFamily, 18);
                shellL.ForeColor = Color.Black;
                shellL.BackColor = Color.Transparent;
                shellL.Size      = new Size(50, 30);
                shellL.Location  = new Point(110, 20);

                //なまず部品設定
                catfish.Name       = "catfish_0";
                catfish.Size       = new Size(270, 79);
                catfish.SizeMode   = PictureBoxSizeMode.StretchImage;
                catfish.Location   = new Point(45, 260);
                catfish.BackColor  = Color.FromName("White");
                catfish.Image      = Image.FromFile(review.FilePath + "\\images\\flowchart\\catfish.png");
                catfish.Parent     = panel4;
                catfish.MouseDown += new MouseEventHandler(this.Control_MouseDown);
                catfish.MouseMove += new MouseEventHandler(this.Control_MouseMove);
                catfish.MouseUp   += new MouseEventHandler(this.Control_MouseUp);
                //なまずラベル設定
                catfishL.Text      = "みぎ";
                catfishL.Font      = new Font(font.FontFamily, 18);
                catfishL.ForeColor = Color.White;
                catfishL.BackColor = Color.Transparent;
                catfishL.Size      = new Size(60, 30);
                catfishL.Location  = new Point(110, 20);

                //かに部品設定
                crab.Name       = "crab_0";
                crab.Size       = new Size(270, 79);
                crab.SizeMode   = PictureBoxSizeMode.StretchImage;
                crab.Location   = new Point(45, 345);
                crab.BackColor  = Color.FromName("White");
                crab.Image      = Image.FromFile(review.FilePath + "\\images\\flowchart\\crab.png");
                crab.Parent     = panel4;
                crab.MouseDown += new MouseEventHandler(this.Control_MouseDown);
                crab.MouseMove += new MouseEventHandler(this.Control_MouseMove);
                crab.MouseUp   += new MouseEventHandler(this.Control_MouseUp);
                //かにラベル設定
                crabL.Text      = "みぎ";
                crabL.Font      = new Font(font.FontFamily, 18);
                crabL.ForeColor = Color.White;
                crabL.BackColor = Color.Transparent;
                crabL.Size      = new Size(60, 30);
                crabL.Location  = new Point(110, 40);


                //フローチャートの上部分設定
                upF.Name      = "upFlow";
                upF.Size      = new Size(230, 105);
                upF.SizeMode  = PictureBoxSizeMode.StretchImage;
                upF.Location  = new Point(36, 40);
                upF.BackColor = Color.FromName("White");
                upF.Image     = Image.FromFile(review.FilePath + "\\images\\flowchart\\up.png");
                //上部分のラベル設定
                upL.Text      = "はじめ";
                upL.Font      = new Font(font.FontFamily, 18);
                upL.Size      = new Size(80, 30);
                upL.Location  = new Point(110, 72);
                upL.BackColor = Color.FromArgb(170, 218, 24);
                upL.Parent    = upF;

                //フローチャートの下部分設定
                bottomF.Name      = "bottomFlow";
                bottomF.Size      = new Size(230, 105);
                bottomF.SizeMode  = PictureBoxSizeMode.StretchImage;
                bottomF.Location  = new Point(36, 485);
                bottomF.BackColor = Color.FromName("White");
                bottomF.Image     = Image.FromFile(review.FilePath + "\\images\\flowchart\\bottom.png");
                //下部分のラベル設定
                bottomL.Text      = "おわり";
                bottomL.Font      = new Font(upL.Font.FontFamily, 20);
                bottomL.Size      = new Size(80, 30);
                bottomL.Location  = new Point(115, 540);
                bottomL.BackColor = Color.FromArgb(170, 218, 24);
                bottomL.Parent    = bottomF;

                //キャラクター設定
                chara.Name      = "chara";
                chara.Size      = new Size(110, 98);
                chara.SizeMode  = PictureBoxSizeMode.Zoom;
                chara.Image     = Image.FromFile(review.FilePath + "\\images\\Run.gif");
                chara.BackColor = Color.Transparent;

                //どくろ設定
                skull.Name      = "skull1";
                skull.Size      = new Size(110, 98);
                skull.SizeMode  = PictureBoxSizeMode.Zoom;
                skull.Image     = Image.FromFile(review.FilePath + "\\images\\flowchart\\skull.png");
                skull.BackColor = Color.Transparent;

                //爆弾設定
                bomb.Name      = "bomb1";
                bomb.Size      = new Size(110, 98);
                bomb.SizeMode  = PictureBoxSizeMode.Zoom;
                bomb.Image     = Image.FromFile(review.FilePath + "\\images\\flowchart\\bomb.png");
                bomb.BackColor = Color.Transparent;

                bomb2.Name      = "bomb2";
                bomb2.Size      = new Size(110, 98);
                bomb2.SizeMode  = PictureBoxSizeMode.Zoom;
                bomb2.Image     = Image.FromFile(review.FilePath + "\\images\\flowchart\\bomb.png");
                bomb2.BackColor = Color.Transparent;

                //迷路部分(TableLayoutPanel)設定
                field.Name                  = "rabyrinth";
                field.Size                  = new Size(470, 470);
                field.Location              = new Point(360, 40);
                field.BackgroundImage       = Image.FromFile(review.FilePath + "\\images\\flowchart\\ground.png");
                field.BackgroundImageLayout = ImageLayout.Zoom;
                for (int i = 0; i < 4; i++)
                {
                    field.RowCount++;
                    field.RowStyles.Insert(i, new RowStyle(SizeType.Percent, 50));
                    field.ColumnCount++;
                    field.ColumnStyles.Insert(i, new ColumnStyle(SizeType.Percent, 50));
                }
                //スタート地点にキャラクターを配置
                field.Controls.Add(chara, 0, 3);
                //障害物を配置
                field.Controls.Add(skull, 0, 0);
                field.Controls.Add(bomb, 2, 1);
                field.Controls.Add(bomb2, 2, 3);
                //迷路部品を追加
                review.panel4.Controls.Add(field);
                field.BringToFront();
                //各部品を追加
                review.panel4.Controls.Add(upF);
                review.panel4.Controls.Add(upL);
                review.panel4.Controls.Add(bottomF);
                review.panel4.Controls.Add(bottomL);
                review.Controls.Add(meat);
                review.Controls.Add(meatL);
                review.Controls.Add(catfish);
                review.Controls.Add(catfishL);
                review.Controls.Add(crab);
                review.Controls.Add(crabL);
                review.Controls.Add(shell);
                review.Controls.Add(shellL);

                meatL.Parent    = meat;
                catfishL.Parent = catfish;
                crabL.Parent    = crab;
                shellL.Parent   = shell;
                upF.BringToFront();
                upL.BringToFront();
                bottomF.BringToFront();
                bottomL.BringToFront();
                meat.BringToFront();
                meatL.BringToFront();
                catfish.BringToFront();
                catfishL.BringToFront();
                crab.BringToFront();
                crabL.BringToFront();
                shell.BringToFront();
                shellL.BringToFront();


                break;

            //--------------------------------------------------------
            //--------------------------------------------------------
            case 2:
                //各コントロールの宣言
                //犬ブロック
                PictureBox dog = new PictureBox();
                //ネコブロック
                PictureBox cat = new PictureBox();
                //はじめネコブロック
                PictureBox Scat = new PictureBox();
                //ループネコブロック
                PictureBox Lcat = new PictureBox();
                //ループネコブロック説明ラベル
                Label LcatL = new Label();
                font = new Font("コーポレート・ロゴ(ラウンド)", 18);
                //はじめネコブロック設定
                Scat.Size     = new Size(400, 580);
                Scat.SizeMode = PictureBoxSizeMode.StretchImage;
                Scat.Name     = "Scat";
                Scat.Location = new Point(10, 10);
                Scat.Image    = Image.FromFile(FilePath + "\\images\\docat\\Scat.png");

                //ループネコブロック設定
                Lcat.Size        = new Size(260, 240);
                Lcat.SizeMode    = PictureBoxSizeMode.StretchImage;
                Lcat.Name        = "Lcat";
                Lcat.Location    = new Point(35, 115);
                Lcat.Image       = Image.FromFile(FilePath + "\\images\\docat\\Lcat.png");
                Lcat.BackColor   = Color.White;
                Lcat.MouseDown  += new MouseEventHandler(this.Control_MouseDown);
                Lcat.MouseMove  += new MouseEventHandler(this.Control_MouseMove);
                Lcat.MouseUp    += new MouseEventHandler(this.Control_MouseUp);
                Lcat.MouseHover += new EventHandler(this.Control_MouseHover);

                //ループネコブロック説明ラベル設定
                LcatL.Name      = "LcatL";
                LcatL.Parent    = Lcat;
                LcatL.Text      = "くりかえし";
                LcatL.Size      = new Size(125, 28);
                LcatL.Font      = new Font(font.FontFamily, 20);
                LcatL.BackColor = Color.Transparent;
                LcatL.Location  = new Point(40, 10);

                //ネコブロック設定
                cat.Size        = new Size(260, 120);
                cat.SizeMode    = PictureBoxSizeMode.StretchImage;
                cat.Name        = "cat";
                cat.Location    = new Point(35, 360);
                cat.Image       = Image.FromFile(FilePath + "\\images\\docat\\cat.png");
                cat.BackColor   = Color.Transparent;
                cat.MouseDown  += new MouseEventHandler(this.Control_MouseDown);
                cat.MouseMove  += new MouseEventHandler(this.Control_MouseMove);
                cat.MouseUp    += new MouseEventHandler(this.Control_MouseUp);
                cat.MouseHover += new EventHandler(this.Control_MouseHover);

                //イヌブロック設定
                dog.Size        = new Size(260, 120);
                dog.SizeMode    = PictureBoxSizeMode.StretchImage;
                dog.Name        = "dog";
                dog.Location    = new Point(35, 485);
                dog.Image       = Image.FromFile(FilePath + "\\images\\docat\\dog.png");
                dog.BackColor   = Color.Transparent;
                dog.MouseDown  += new MouseEventHandler(this.Control_MouseDown);
                dog.MouseMove  += new MouseEventHandler(this.Control_MouseMove);
                dog.MouseUp    += new MouseEventHandler(this.Control_MouseUp);
                dog.MouseHover += new EventHandler(this.Control_MouseHover);

                //コントロールの追加
                panel4.Controls.Add(Scat);
                Controls.Add(Lcat);
                Controls.Add(cat);
                Controls.Add(dog);
                //コントロールの最前面配置
                Scat.BringToFront();
                Lcat.BringToFront();
                cat.BringToFront();
                dog.BringToFront();
                break;

            //--------------------------------------------------------
            case 20:
                //吹き出し
                PictureBox huki = new PictureBox();
                huki.Size      = hukiS;
                huki.Name      = "huki";
                huki.SizeMode  = PictureBoxSizeMode.StretchImage;
                huki.Location  = new Point(385, 125);
                huki.BackColor = Color.Transparent;
                huki.Image     = Image.FromFile(FilePath + "\\images\\docat\\hukidashi.png");
                panel4.Controls.Add(huki);
                huki.BringToFront();
                break;

            case 21:
                //2問目のイヌネコカードの生成
                //ネコ
                PictureBox catC = new PictureBox();
                //ネコ
                cardCount[1]++;
                catC.Name      = "catC_" + cardCount[1];
                catC.Size      = new Size(65, 80);
                catC.SizeMode  = PictureBoxSizeMode.StretchImage;
                catC.BackColor = Color.Transparent;
                catC.Location  = docatP;
                catC.Image     = Image.FromFile(FilePath + "\\images\\docat\\catC.png");

                docatP = new Point(docatP.X + 70, docatP.Y);

                //追加
                panel4.Controls.Add(catC);
                //最前面配置
                catC.BringToFront();
                break;

            case 22:
                //2問目のイヌネコカードの生成
                //イヌ
                PictureBox dogC = new PictureBox();
                //イヌ
                cardCount[0]++;
                dogC.Name      = "dogC_" + cardCount[0];
                dogC.Size      = new Size(65, 80);
                dogC.SizeMode  = PictureBoxSizeMode.StretchImage;
                dogC.BackColor = Color.Transparent;
                dogC.Location  = docatP;
                dogC.Image     = Image.FromFile(FilePath + "\\images\\docat\\dogC.png");

                docatP = new Point(docatP.X + 70, docatP.Y);

                //追加
                panel4.Controls.Add(dogC);
                //最前面配置
                dogC.BringToFront();
                break;

            default:
                break;
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// Initializes a new instance of the StashPanel class.  Hard coded to 4 stash buttons and no autosort buttons.
        /// </summary>
        /// <param name="dragInfo">ItemDragInfo instance</param>
        /// <param name="panelSize">Size of the panel in cells</param>
        /// <param name="tooltip">ToolTip instance</param>
        public StashPanel(ItemDragInfo dragInfo, Size panelSize, IServiceProvider serviceProvider) : base(dragInfo, 4, panelSize, 0, AutoMoveLocation.Stash, serviceProvider)
        {
            SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);

            this.equipmentPanel = new EquipmentPanel(16, 14, dragInfo, AutoMoveLocation.Stash, serviceProvider);
            this.Controls.Add(this.equipmentPanel);
            this.equipmentPanel.OnNewItemHighlighted    += new EventHandler <SackPanelEventArgs>(this.NewItemHighlightedCallback);
            this.equipmentPanel.OnAutoMoveItem          += new EventHandler <SackPanelEventArgs>(this.AutoMoveItemCallback);
            this.equipmentPanel.OnActivateSearch        += new EventHandler <SackPanelEventArgs>(this.ActivateSearchCallback);
            this.equipmentPanel.OnItemSelected          += new EventHandler <SackPanelEventArgs>(this.ItemSelectedCallback);
            this.equipmentPanel.OnClearAllItemsSelected += new EventHandler <SackPanelEventArgs>(this.ClearAllItemsSelectedCallback);
            this.equipmentPanel.OnResizeForm            += new EventHandler <ResizeEventArgs>(this.ResizeFormCallback);

            this.Text           = Resources.StashPanelText;
            this.NoPlayerString = Resources.StashPanelText;
            this.Size           = new Size(
                (panelSize.Width * UIService.ItemUnitSize) + Convert.ToInt32(10.0F * UIService.Scale) + BorderPad,
                (panelSize.Height * UIService.ItemUnitSize) + Convert.ToInt32(60.0F * UIService.Scale) + BorderPad);
            this.Paint += new PaintEventHandler(this.PaintCallback);

            this.BagSackPanel.SetLocation(new Point(BorderPad, this.Size.Height - (this.BagSackPanel.Size.Height + BorderPad)));
            this.BagSackPanel.MaxSacks = 1;
            this.BagSackPanel.Anchor   = AnchorStyles.None;

            //this.EquipmentBackground = Resources.Equipment_bg_new;
            this.background      = this.EquipmentBackground = Resources.equipment_bg_and_char;
            this.StashBackground = Resources.caravan_bg;

            // Set up the inital font size
            if (UIService.Scale != 1.0F)
            {
                this.Font = new Font(this.Font.FontFamily, this.Font.SizeInPoints * UIService.Scale, this.Font.Style);
            }

            // Now that the buttons are set we can move the panel
            this.BagSackPanel.SetLocation(new Point(
                                              BorderPad,
                                              this.BagButtons[0].Location.Y + this.BagButtons[0].Size.Height + UIService.HalfUnitSize));

            int offsetX = (panelSize.Width - this.equipmentPanel.SackSize.Width) * UIService.HalfUnitSize;

            if (offsetX < 0)
            {
                offsetX = 0;
            }

            int offsetY = (panelSize.Height - this.equipmentPanel.SackSize.Height) * UIService.HalfUnitSize;

            if (offsetY < 0)
            {
                offsetY = 0;
            }

            this.equipmentPanel.SetLocation(new Point(
                                                offsetX,
                                                this.BagButtons[0].Location.Y + this.BagButtons[0].Size.Height + offsetY));

            this.maxPanelSize = panelSize;

            this.BagSackPanel.Visible = false;
            this.BagSackPanel.Enabled = false;

            #region Init Player Panel

            // Based on testing at scale 1
            var table = new TableLayoutPanel()
            {
                Location = new Point(
                    PLAYERINFO_TOPRIGHT - PLAYERINFO_WIDTH
                    , PLAYERINFO_TOPHEIGHT
                    ),
                Size = new Size(PLAYERINFO_WIDTH, PLAYERINFO_HEIGHT),
                //CellBorderStyle = TableLayoutPanelCellBorderStyle.Single,
                Margin    = new Padding(0),
                Padding   = new Padding(1),
                BackColor = Color.Transparent,
            };
            table.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 60F));
            table.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 40F));

            this.Controls.Add(table);
            this.PlayerPanel = table;

            table.BringToFront();

            this.equipmentPanel.VisibleChanged += EquipmentPanel_VisibleChanged;

            #endregion
        }
Exemplo n.º 16
0
Arquivo: Plane.cs Projeto: op07n/CS363
        private void tableMaker()
        {
            //f.InitializeComponent();

            TextBox txtIDTitle  = new System.Windows.Forms.TextBox();
            TextBox txtID       = new System.Windows.Forms.TextBox();
            TextBox txtSpdTitle = new System.Windows.Forms.TextBox();

            txtSpd       = new System.Windows.Forms.TextBox();
            txtCurSpd    = new System.Windows.Forms.TextBox();
            tblPlaneInfo = new System.Windows.Forms.TableLayoutPanel();
            TableLayoutPanel tblTurnDirection = new System.Windows.Forms.TableLayoutPanel();

            txtAlt    = new System.Windows.Forms.TextBox();
            txtCurAlt = new System.Windows.Forms.TextBox();
            TextBox txtAltTitle = new System.Windows.Forms.TextBox();

            txtHead    = new System.Windows.Forms.TextBox();
            txtCurHead = new System.Windows.Forms.TextBox();
            TextBox txtHeadTitle = new System.Windows.Forms.TextBox();

            btnSendCmd = new System.Windows.Forms.Button();
            rbCW       = new System.Windows.Forms.RadioButton();
            rbCCW      = new System.Windows.Forms.RadioButton();
            TextBox txtTurnTitle    = new System.Windows.Forms.TextBox();
            TextBox txtCurrentTitle = new System.Windows.Forms.TextBox();
            TextBox txtNewTitle     = new System.Windows.Forms.TextBox();

            tblPlaneInfo.SuspendLayout();
            f.SuspendLayout();
            //
            // tblPlaneInfo
            //
            tblPlaneInfo.ColumnCount = 3;
            tblPlaneInfo.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
            tblPlaneInfo.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
            tblPlaneInfo.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
            tblPlaneInfo.Controls.Add(txtID, 1, 0);
            tblPlaneInfo.SetColumnSpan(txtID, 2);
            tblPlaneInfo.Controls.Add(txtIDTitle, 0, 0);
            tblPlaneInfo.Controls.Add(txtCurrentTitle, 1, 1);
            tblPlaneInfo.Controls.Add(txtNewTitle, 2, 1);
            tblPlaneInfo.Controls.Add(txtSpdTitle, 0, 2);
            tblPlaneInfo.Controls.Add(txtCurSpd, 1, 2);
            tblPlaneInfo.Controls.Add(txtSpd, 2, 2);
            tblPlaneInfo.Controls.Add(txtAltTitle, 0, 3);
            tblPlaneInfo.Controls.Add(txtCurAlt, 1, 3);
            tblPlaneInfo.Controls.Add(txtAlt, 2, 3);
            tblPlaneInfo.Controls.Add(txtHeadTitle, 0, 4);
            tblPlaneInfo.Controls.Add(txtCurHead, 1, 4);
            tblPlaneInfo.Controls.Add(txtHead, 2, 4);
            tblPlaneInfo.Controls.Add(txtTurnTitle, 0, 5);
            tblPlaneInfo.Controls.Add(tblTurnDirection, 1, 5); //FIXME: Add layoutTable with two radio buttons for CW and CCW turns.  Also, add "Turn Direction" title to first column!
            tblPlaneInfo.SetColumnSpan(tblTurnDirection, 2);
            tblPlaneInfo.Controls.Add(btnSendCmd, 1, 6);
            tblPlaneInfo.SetColumnSpan(btnSendCmd, 2);
            tblPlaneInfo.Name     = "tblPlaneInfo";
            tblPlaneInfo.RowCount = 7;
            tblPlaneInfo.RowStyles.Add(new System.Windows.Forms.RowStyle());
            tblPlaneInfo.RowStyles.Add(new System.Windows.Forms.RowStyle());
            tblPlaneInfo.RowStyles.Add(new System.Windows.Forms.RowStyle());
            tblPlaneInfo.RowStyles.Add(new System.Windows.Forms.RowStyle());
            tblPlaneInfo.RowStyles.Add(new System.Windows.Forms.RowStyle());
            tblPlaneInfo.RowStyles.Add(new System.Windows.Forms.RowStyle());
            tblPlaneInfo.RowStyles.Add(new System.Windows.Forms.RowStyle());
            tblPlaneInfo.Size      = new System.Drawing.Size(300, 205); //Original 217,141
            tblPlaneInfo.Location  = new System.Drawing.Point(15, f.ClientSize.Height - tblPlaneInfo.Bottom - 10);
            tblPlaneInfo.TabIndex  = 0;
            tblPlaneInfo.BackColor = System.Drawing.SystemColors.ControlDark;
            //
            // txtIDTitle
            //
            txtIDTitle.Location  = new System.Drawing.Point(3, 3);
            txtIDTitle.Name      = "txtIDTitle";
            txtIDTitle.ReadOnly  = true;
            txtIDTitle.Size      = new System.Drawing.Size(75, 30);
            txtIDTitle.TabIndex  = 1;
            txtIDTitle.Text      = "ID";
            txtIDTitle.BackColor = System.Drawing.SystemColors.ControlDark;
            txtIDTitle.Font      = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            txtIDTitle.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            //
            // txtID
            //
            txtID.Location  = new System.Drawing.Point(78, 3);
            txtID.Name      = "txtID";
            txtID.ReadOnly  = true;
            txtID.Size      = new System.Drawing.Size(207, 30);
            txtID.TabIndex  = 2;
            txtID.Text      = ID;
            txtID.BackColor = System.Drawing.SystemColors.ControlDark;
            txtID.Font      = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            txtID.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            //
            // txtCurrentTitle
            //
            txtCurrentTitle.Location    = new System.Drawing.Point(78, 35);
            txtCurrentTitle.Name        = "txtCurrentTitle";
            txtCurrentTitle.ReadOnly    = true;
            txtCurrentTitle.Size        = new System.Drawing.Size(100, 30);
            txtCurrentTitle.Text        = "Current";
            txtCurrentTitle.TextAlign   = System.Windows.Forms.HorizontalAlignment.Center;
            txtCurrentTitle.BackColor   = System.Drawing.SystemColors.ControlDark;
            txtCurrentTitle.Font        = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            txtCurrentTitle.BorderStyle = BorderStyle.None;
            //
            // txtNewTitle
            //
            txtNewTitle.Location    = new System.Drawing.Point(161, 35);
            txtNewTitle.Name        = "txtNewTitle";
            txtNewTitle.ReadOnly    = true;
            txtNewTitle.Size        = new System.Drawing.Size(100, 30);
            txtNewTitle.Text        = "New";
            txtNewTitle.TextAlign   = System.Windows.Forms.HorizontalAlignment.Center;
            txtNewTitle.BackColor   = System.Drawing.SystemColors.ControlDark;
            txtNewTitle.Font        = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            txtNewTitle.BorderStyle = BorderStyle.None;
            //
            // txtSpdTitle
            //
            txtSpdTitle.Location    = new System.Drawing.Point(3, 35);
            txtSpdTitle.Name        = "txtSpdTitle";
            txtSpdTitle.ReadOnly    = true;
            txtSpdTitle.Size        = new System.Drawing.Size(75, 30);
            txtSpdTitle.TabIndex    = 3;
            txtSpdTitle.Text        = "Speed";
            txtSpdTitle.BackColor   = System.Drawing.SystemColors.ControlDark;
            txtSpdTitle.Font        = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            txtSpdTitle.BorderStyle = BorderStyle.None;
            //
            // txtSpd
            //
            txtSpd.Location    = new System.Drawing.Point(161, 35);
            txtSpd.Name        = "txtSpd";
            txtSpd.Size        = new System.Drawing.Size(100, 30);
            txtSpd.TabIndex    = 4;
            txtSpd.BackColor   = System.Drawing.SystemColors.ControlDark;
            txtSpd.TextAlign   = System.Windows.Forms.HorizontalAlignment.Center;
            txtSpd.BorderStyle = BorderStyle.FixedSingle;
            txtSpd.Font        = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            //txtSpd.Text = speed.ToString();
            //txtSpd.LostFocus += new EventHandler(this.txtSpd_LostFocus);
            //
            // txtCurSpd
            //
            txtCurSpd.Location    = new System.Drawing.Point(78, 35);
            txtCurSpd.Name        = "txtCurSpd";
            txtCurSpd.ReadOnly    = true;
            txtCurSpd.Size        = new System.Drawing.Size(100, 30);
            txtCurSpd.TabIndex    = 4;
            txtCurSpd.BackColor   = System.Drawing.SystemColors.ControlDark;
            txtCurSpd.TextAlign   = System.Windows.Forms.HorizontalAlignment.Center;
            txtCurSpd.BorderStyle = BorderStyle.FixedSingle;
            txtCurSpd.Font        = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            txtCurSpd.Text        = speed.ToString();
            //
            //tblTurnDirection
            //
            tblTurnDirection.ColumnCount = 2;
            tblTurnDirection.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
            tblTurnDirection.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
            tblTurnDirection.Name     = "tblTurnDirection";
            tblTurnDirection.RowCount = 1;
            tblTurnDirection.RowStyles.Add(new System.Windows.Forms.RowStyle());
            tblTurnDirection.Controls.Add(rbCW, 0, 0);
            tblTurnDirection.Controls.Add(rbCCW, 1, 0);
            tblTurnDirection.Location  = new System.Drawing.Point(78, 131);
            tblTurnDirection.Size      = new System.Drawing.Size(132, 27);
            tblTurnDirection.BackColor = System.Drawing.SystemColors.ControlDark;
            //
            //rbCW
            //
            rbCW.AutoSize = true;
            rbCW.Location = new System.Drawing.Point(1, 1);
            rbCW.Size     = new System.Drawing.Size(50, 27);
            rbCW.Text     = "CW";
            rbCW.Font     = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            //
            //rbCCW
            //
            rbCCW.AutoSize = true;
            rbCCW.Location = new System.Drawing.Point(35, 1);
            rbCCW.Size     = new System.Drawing.Size(50, 27);
            rbCCW.Text     = "CCW";
            rbCCW.Font     = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            //
            //txtTurnTitle
            //
            txtTurnTitle.Location    = new System.Drawing.Point(3, 133);
            txtTurnTitle.Name        = "txtTurnTitle";
            txtTurnTitle.Text        = "Turn Direction";
            txtTurnTitle.ReadOnly    = true;
            txtTurnTitle.Size        = new System.Drawing.Size(80, 30);
            txtTurnTitle.BackColor   = System.Drawing.SystemColors.ControlDark;
            txtTurnTitle.BorderStyle = BorderStyle.None;
            txtTurnTitle.Font        = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            //
            // txtAlt
            //
            txtAlt.Location    = new System.Drawing.Point(161, 67);
            txtAlt.Name        = "txtAlt";
            txtAlt.Size        = new System.Drawing.Size(100, 30);
            txtAlt.TabIndex    = 5;
            txtAlt.BackColor   = System.Drawing.SystemColors.ControlDark;
            txtAlt.TextAlign   = System.Windows.Forms.HorizontalAlignment.Center;
            txtAlt.BorderStyle = BorderStyle.FixedSingle;
            txtAlt.Font        = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            //txtAlt.Text = altitude.ToString();
            //txtAlt.LostFocus += new EventHandler(this.txtAlt_LostFocus);
            //
            // txtCurAlt
            //
            txtCurAlt.Location    = new System.Drawing.Point(78, 67);
            txtCurAlt.Name        = "txtCurAlt";
            txtCurAlt.ReadOnly    = true;
            txtCurAlt.Size        = new System.Drawing.Size(100, 30);
            txtCurAlt.TabIndex    = 5;
            txtCurAlt.BackColor   = System.Drawing.SystemColors.ControlDark;
            txtCurAlt.TextAlign   = System.Windows.Forms.HorizontalAlignment.Center;
            txtCurAlt.BorderStyle = BorderStyle.FixedSingle;
            txtCurAlt.Font        = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            txtCurAlt.Text        = altitude.ToString();
            //
            // txtAltTitle
            //
            txtAltTitle.Location    = new System.Drawing.Point(3, 67);
            txtAltTitle.Name        = "txtAltTitle";
            txtAltTitle.ReadOnly    = true;
            txtAltTitle.Size        = new System.Drawing.Size(75, 30);
            txtAltTitle.TabIndex    = 6;
            txtAltTitle.Text        = "Altitude";
            txtAltTitle.BackColor   = System.Drawing.SystemColors.ControlDark;
            txtAltTitle.BorderStyle = BorderStyle.None;
            txtAltTitle.Font        = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            //
            // txtHead
            //
            txtHead.Location    = new System.Drawing.Point(161, 99);
            txtHead.Name        = "txtHead";
            txtHead.Size        = new System.Drawing.Size(100, 30);
            txtHead.TabIndex    = 7;
            txtHead.BackColor   = System.Drawing.SystemColors.ControlDark;
            txtHead.TextAlign   = System.Windows.Forms.HorizontalAlignment.Center;
            txtHead.BorderStyle = BorderStyle.FixedSingle;
            txtHead.Font        = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            //txtHead.Text = heading.ToString();
            //txtHead.LostFocus += new EventHandler(this.txtHead_LostFocus);
            //
            // txtCurHead
            //
            txtCurHead.Location    = new System.Drawing.Point(78, 99);
            txtCurHead.Name        = "txtCurHead";
            txtCurHead.ReadOnly    = true;
            txtCurHead.Size        = new System.Drawing.Size(100, 30);
            txtCurHead.TabIndex    = 7;
            txtCurHead.BackColor   = System.Drawing.SystemColors.ControlDark;
            txtCurHead.TextAlign   = System.Windows.Forms.HorizontalAlignment.Center;
            txtCurHead.BorderStyle = BorderStyle.FixedSingle;
            txtCurHead.Font        = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            txtCurHead.Text        = heading.ToString();
            //
            // txtHeadTitle
            //
            txtHeadTitle.Location    = new System.Drawing.Point(3, 99);
            txtHeadTitle.Name        = "txtHeadTitle";
            txtHeadTitle.ReadOnly    = true;
            txtHeadTitle.Size        = new System.Drawing.Size(75, 30);
            txtHeadTitle.TabIndex    = 8;
            txtHeadTitle.Text        = "Heading";
            txtHeadTitle.BackColor   = System.Drawing.SystemColors.ControlDark;
            txtHeadTitle.Font        = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            txtHeadTitle.BorderStyle = BorderStyle.None;
            //
            // btnSendCmd
            //
            btnSendCmd.Location = new System.Drawing.Point(78, 163); //Originally 78, 131
            btnSendCmd.Name     = "btnSendCmd";
            btnSendCmd.Size     = new System.Drawing.Size(131, 30);
            btnSendCmd.TabIndex = 1;
            btnSendCmd.Text     = "Send Command";
            btnSendCmd.Font     = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            btnSendCmd.UseVisualStyleBackColor = true;
            btnSendCmd.Click += new EventHandler((sender, e) => btnSendCmd_Click(sender, e, txtHead.Text, txtSpd.Text, txtAlt.Text, rbCW.Checked, rbCCW.Checked));
            //
            // Add table control
            //
            f.Controls.Add(tblPlaneInfo);
            tblPlaneInfo.BringToFront();
            tblPlaneInfo.ResumeLayout(false);
            tblPlaneInfo.PerformLayout();
            f.ResumeLayout(false);
            f.PerformLayout();
        }
Exemplo n.º 17
0
 public void glassButtonAll_Click(object sender, EventArgs e)
 {
     panelAllP.BringToFront();
     panelAll.BringToFront();
     lbAll.Text = "全部";
 }
Exemplo n.º 18
0
 //Обработка нажатия на кнопку "Следующий вопрос"
 private void button1_Click(object sender, EventArgs e)
 {
     //В начале происходит выборка предыдущих ответов пользователя. Результаты выбора пользователя заносятся в базу данных
     using (TestAppLibrary.TestAppContext db = new TestAppLibrary.TestAppContext())
     {
         TestAppLibrary.Question que = q[count - 1];
         var answer = db.Answers.Where(i => i.Question.Id == que.Id).ToList();
         if (q[count - 1].MultiChoice == true)
         {
             var boxes = table.Controls.OfType <CheckBox>();
             int i     = 0;
             foreach (var box in boxes)
             {
                 TestAppLibrary.UserAnswer uans = new TestAppLibrary.UserAnswer();
                 var user = db.Users.Where(l => l.Id == idUser).FirstOrDefault();
                 uans.User = user;
                 TestAppLibrary.Answer ans1 = answer[i++];
                 uans.Answer   = ans1;
                 uans.IsPicked = box.Checked;
                 db.UserAnswers.Add(uans);
             }
         }
         else
         {
             var radios = table.Controls.OfType <RadioButton>();
             int i      = 0;
             foreach (var radio in radios)
             {
                 TestAppLibrary.UserAnswer uans = new TestAppLibrary.UserAnswer();
                 var user = db.Users.Where(l => l.Id == idUser).FirstOrDefault();
                 uans.User = user;
                 TestAppLibrary.Answer ans1 = answer[i++];
                 uans.Answer   = ans1;
                 uans.IsPicked = radio.Checked;
                 db.UserAnswers.Add(uans);
             }
         }
         //Выведение на форму следующего вопроса
         TestAppLibrary.Question quest = q[count++];
         textBox1.Text = quest.Challenge;
         Control ctrl;
         textBox1.ReadOnly = true;
         table             = new TableLayoutPanel();
         table.Parent      = splitContainer2.Panel1;
         table.Dock        = DockStyle.Fill;
         table.ColumnCount = 2;
         table.Padding     = new Padding(20, 10, 10, 20);
         table.AutoScroll  = true;
         table.BringToFront();
         table.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 20));
         int k   = 0;
         var ans = db.Answers.Where(i => i.Question.Id == quest.Id).ToList();
         for (int j = 0; j < quest.AnswersNumber && j < ans.Count; j++)
         {
             if (quest.MultiChoice == false)
             {
                 ctrl = new RadioButton();
             }
             else
             {
                 ctrl = new CheckBox();
             }
             ctrl.Parent = table;
             TextBox t = new TextBox();
             t.Parent    = table;
             t.Multiline = true;
             t.WordWrap  = true;
             t.Size      = new Size {
                 Width = 250, Height = 50
             };
             t.Text = ans[k++].Challenge;
         }
         //Если вопросов больше нет в коллекции сделать неактивной кнопку продолжения
         if (count == q.Count)
         {
             button1.Enabled = false;
         }
         db.SaveChanges();
     }
 }
Exemplo n.º 19
0
        /// <summary>
        /// CameraShowUnitDic显示窗口,关闭运行图像处理线程,
        /// </summary>
        private void InitRunData()
        {
            tabPanel.BringToFront();
            tabPanel.Dock = DockStyle.Fill;    //覆盖了其它TableLayoutPanel控件。
            CameraShowUnitDic.Clear();
            //必须手动释放显示控件以清除native的图像集合数据
            foreach (var item in this.tabPanel.Controls)
            {
                UserControl control = item as UserControl;

                if (control != null)
                {
                    control.Dispose();
                }
            }
            foreach (var item in this.panelHWndMax.Controls)
            {
                UserControl control = item as UserControl;

                if (control != null)
                {
                    control.Dispose();
                }
            }

            this.tabPanel.Controls.Clear();
            this.panelHWndMax.Controls.Clear();

            if (runTheadDataDic.Count > 0)
            {
                foreach (var item in runTheadDataDic.Values)
                {
                    item.Stop();
                }
            }
            runTheadDataDic.Clear();
            //runThreadDic.Clear();
            InitResultTable();
            //清空相机选择控件
            tscobCameraSelect.Items.Clear();
            //清空相机list
            CameraFindIndexList.Clear();
            //相机与显示图像窗口绑定,与图像处理线程绑定
            for (int i = 0; i < cameraCount; i++)
            {
                tscobCameraSelect.Items.Add(string.Format("相机{0}", i + 1));

                CameraShow showUnit = new CameraShow();
                showUnit.Init(i + 1);
                CameraShowUnitDic.Add(i + 1, showUnit);
                showUnit.CameraShowMouseDoubleClick += HWndCtrl_MouseDoubleClick;
                runTheadDataDic.Add(i + 1, new RunTheadData(this, i + 1));
                if (CameraManger.CameraDic.ContainsKey(i + 1))
                {
                    runTheadDataDic[i + 1].BindCameraEvent(CameraManger.CameraDic[i + 1]);
                    CameraFindIndexList.Add(i + 1);
                    CameraManger.CameraDic[i + 1].CameraLineOffEvent += CameraLineOff_Event;
                }
                else
                {
                    showUnit.HWndUnit.SetTextBackColor();
                }

                //runThreadDic.Add(i + 1, new Thread(new ThreadStart(runTheadDataDic[i + 1].Run)));
                //runThreadDic[i + 1].Start();
                if (cameraCount < 10)
                {
                    tabPanel.RowCount = 2;
                }
                if (cameraCount < 5)//小于等于4个相机的处理
                {
                    switch (i + 1)
                    {
                    case 1:
                        this.tabPanel.Controls.Add(showUnit.HWndUnit, 0, 0);
                        if (cameraCount == 2)
                        {
                            tabPanel.SetRowSpan(showUnit.HWndUnit, 2);
                        }
                        break;

                    case 2:
                        this.tabPanel.Controls.Add(showUnit.HWndUnit, 1, 0);
                        if (cameraCount == 2)
                        {
                            tabPanel.SetRowSpan(showUnit.HWndUnit, 2);
                        }
                        break;

                    case 3:
                        this.tabPanel.Controls.Add(showUnit.HWndUnit, 0, 1);
                        break;

                    case 4:
                        this.tabPanel.Controls.Add(showUnit.HWndUnit, 1, 1);
                        break;

                    default:
                        break;
                    }
                }
                else//大于4个相机的处理
                {
                    switch (i + 1)
                    {
                    case 1:
                        this.tabPanel.Controls.Add(showUnit.HWndUnit, 0, 0);
                        break;

                    case 2:
                        this.tabPanel.Controls.Add(showUnit.HWndUnit, 1, 0);
                        break;

                    case 3:
                        this.tabPanel.Controls.Add(showUnit.HWndUnit, 2, 0);
                        break;

                    case 4:
                        this.tabPanel.Controls.Add(showUnit.HWndUnit, 0, 1);
                        break;

                    case 5:
                        this.tabPanel.Controls.Add(showUnit.HWndUnit, 1, 1);
                        break;

                    case 6:
                        this.tabPanel.Controls.Add(showUnit.HWndUnit, 2, 1);
                        break;

                    case 7:
                        this.tabPanel.Controls.Add(showUnit.HWndUnit, 0, 2);
                        break;

                    case 8:
                        this.tabPanel.Controls.Add(showUnit.HWndUnit, 1, 2);
                        break;

                    case 9:
                        this.tabPanel.Controls.Add(showUnit.HWndUnit, 2, 2);
                        break;

                    default:
                        break;
                    }
                }
            }
            if (CameraFindIndexList.Count > 0)
            {
                tscobCameraSelect.SelectedIndex = CameraFindIndexList[0] - 1;
            }
            else
            {
                tscobCameraSelect.SelectedIndex = 0;
            }
            //panelDgvTools.Controls.Add(CameraShowUnitDic[1].DgvTool);
            //CameraShowUnitDic[1].InitDgvShow();
        }
Exemplo n.º 20
0
        private void f_Load_PChitiet()
        {
            try
            {
                pCT.Controls.Clear();
                Label   alb;
                Label   albphantram;
                TextBox atb;

                m_table                 = new TableLayoutPanel();
                m_table.Name            = "tableLayoutPanel_01";
                m_table.Text            = "?";
                m_table.AutoScroll      = true;
                m_table.BorderStyle     = BorderStyle.None;
                m_table.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.None;
                m_table.BackColor       = Color.Honeydew;

                m_table.Padding  = new System.Windows.Forms.Padding(0, 0, 0, 0);
                m_table.AutoSize = true;

                m_table.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.AutoSize));
                m_table.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.AutoSize));

                DataSet ads = m_v.get_data("select a.id,a.viettat,a.ten from medibv.v_loaivp a order by a.ten");
                int     ai = 0, arow = 0, acol = 0;
                foreach (DataRow r in ads.Tables[0].Rows)
                {
                    ai++;
                    m_table.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 22F));

                    alb      = new Label();
                    alb.Name = "lbma_" + r["id"].ToString();
                    alb.Text = (r["ten"].ToString().Length > 50 ? r["viettat"].ToString().Trim() : r["ten"].ToString().Trim()) + ":";
                    toolTip1.SetToolTip(alb, r["ten"].ToString().Trim());
                    alb.AutoSize  = true;
                    alb.Font      = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                    alb.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Right | System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)));
                    alb.TextAlign = ContentAlignment.MiddleRight;
                    m_table.Controls.Add(alb, acol, arow);

                    atb           = new TextBox();
                    atb.Name      = "tbma_" + r["id"].ToString();
                    atb.Text      = "";
                    atb.BackColor = Color.White;
                    atb.Width     = 70;

                    atb.Leave     += new System.EventHandler(this.f_Control_Leave);
                    atb.Enter     += new System.EventHandler(this.f_Control_Enter);
                    atb.KeyDown   += new System.Windows.Forms.KeyEventHandler(this.f_Control_KeyDown);
                    atb.Validated += new System.EventHandler(this.txt_Validated);
                    atb.KeyPress  += new System.Windows.Forms.KeyPressEventHandler(this.f_Control_Keypress);

                    atb.ReadOnly  = false;
                    atb.TextAlign = HorizontalAlignment.Right;
                    m_table.Controls.Add(atb, acol + 1, arow);

                    albphantram           = new Label();
                    albphantram.Text      = "%";
                    albphantram.AutoSize  = true;
                    albphantram.Font      = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                    albphantram.TextAlign = ContentAlignment.MiddleCenter;
                    m_table.Controls.Add(albphantram, acol + 2, arow);

                    arow++;
                }
                m_table.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.AutoSize));
                alb           = new Label();
                alb.Name      = "_blank";
                alb.Text      = "";
                alb.AutoSize  = true;
                alb.Font      = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                alb.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right | System.Windows.Forms.AnchorStyles.Bottom)));
                alb.TextAlign = ContentAlignment.MiddleRight;
                m_table.Controls.Add(alb, 0, ai);

                pCT.Controls.Add(m_table);
                m_table.Dock = DockStyle.Fill;
                m_table.BringToFront();
            }
            catch
            {
            }
            finally
            {
            }
        }