Beispiel #1
0
        private void InternalConstruct(IDockableWindow content, DockState dockState, bool flagBounds, Rectangle floatWindowBounds, DockPane prevPane, DockAlignment alignment, double proportion, bool show)
        {
            if (dockState == DockState.Hidden || dockState == DockState.Unknown)
            {
                throw new ArgumentException(ResourceHelper.GetString("DockPane.DockState.InvalidState"));
            }

            if (content == null)
            {
                throw new ArgumentNullException(ResourceHelper.GetString("DockPane.Constructor.NullContent"));
            }

            if (content.DockHandler.DockPanel == null)
            {
                throw new ArgumentException(ResourceHelper.GetString("DockPane.Constructor.NullDockPanel"));
            }


            SuspendLayout();
            SetStyle(ControlStyles.Selectable, false);

            _isFloat = (dockState == DockState.Float);

            _contents           = new DockContentCollection();
            _displayingContents = new DockContentCollection(this);
            _tabs      = new DockPaneTabCollection(this);
            _dockPanel = content.DockHandler.DockPanel;
            _dockPanel.AddPane(this);

            _splitter = new DockPaneSplitter(this);

            _nestedDockingStatus = new NestedDockingStatus(this);

            _autoHidePane    = DockPanel.AutoHidePaneFactory.CreateAutoHidePane(this);
            _captionControl  = DockPanel.DockPaneCaptionFactory.CreateDockPaneCaption(this);
            _tabStripControl = DockPanel.DockPaneStripFactory.CreateDockPaneStrip(this);
            Controls.AddRange(new Control[] { _captionControl, _tabStripControl });

            DockPanel.SuspendLayout(true);
            if (flagBounds)
            {
                FloatWindow = DockPanel.FloatWindowFactory.CreateFloatWindow(DockPanel, this, floatWindowBounds);
            }
            else if (prevPane != null)
            {
                AddToDockList(prevPane.DockListContainer, prevPane, alignment, proportion);
            }

            SetDockState(dockState);
            if (show)
            {
                content.DockHandler.Pane = this;
            }
            else if (this.IsFloat)
            {
                content.DockHandler.FloatPane = this;
            }
            else
            {
                content.DockHandler.PanelPane = this;
            }

            ResumeLayout();
            DockPanel.ResumeLayout(true, true);
        }
Beispiel #2
0
        private void InternalConstruct(IDockContent content, DockState dockState, bool flagBounds, Rectangle floatWindowBounds, DockPane prevPane, DockAlignment alignment, double proportion, bool show)
        {
            if (dockState == DockState.Hidden || dockState == DockState.Unknown)
            {
                throw new ArgumentException(Strings.DockPane_SetDockState_InvalidState);
            }

            if (content == null)
            {
                throw new ArgumentNullException(Strings.DockPane_Constructor_NullContent);
            }

            if (content.DockHandler.DockPanel == null)
            {
                throw new ArgumentException(Strings.DockPane_Constructor_NullDockPanel);
            }


            SuspendLayout();
            SetStyle(ControlStyles.Selectable, false);

            m_isFloat = (dockState == DockState.Float);

            m_contents           = new DockContentCollection();
            m_displayingContents = new DockContentCollection(this);
            m_dockPanel          = content.DockHandler.DockPanel;
            m_dockPanel.AddPane(this);

            m_splitter = new SplitterControl(this);

            m_nestedDockingStatus = new NestedDockingStatus(this);

            m_captionControl  = DockPanel.DockPaneCaptionFactory.CreateDockPaneCaption(this);
            m_tabStripControl = DockPanel.DockPaneStripFactory.CreateDockPaneStrip(this);
            Controls.AddRange(new Control[] { m_captionControl, m_tabStripControl });

            DockPanel.SuspendLayout(true);
            if (flagBounds)
            {
                FloatWindow = DockPanel.FloatWindowFactory.CreateFloatWindow(DockPanel, this, floatWindowBounds);
            }
            else if (prevPane != null)
            {
                DockTo(prevPane.NestedPanesContainer, prevPane, alignment, proportion);
            }

            SetDockState(dockState);
            if (show)
            {
                content.DockHandler.Pane = this;
            }
            else if (this.IsFloat)
            {
                content.DockHandler.FloatPane = this;
            }
            else
            {
                content.DockHandler.PanelPane = this;
            }

            ResumeLayout();
            DockPanel.ResumeLayout(true, true);
        }
Beispiel #3
0
            private void InitializeComponent()
            {
                SetBounds(0, 0, controlWidth, controlHeight);

                BackColor      = SystemColors.Control;
                ForeColor      = SystemColors.ControlText;
                AccessibleName = SR.DockEditorAccName;

                none.Anchor         = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
                none.Location       = new Point(offset2X, noneY);
                none.Size           = new Size(noneWidth, noneHeight);
                none.Text           = DockStyle.None.ToString();
                none.TabIndex       = 0;
                none.TabStop        = true;
                none.Appearance     = Appearance.Button;
                none.Click         += OnClick;
                none.KeyDown       += OnKeyDown;
                none.AccessibleName = SR.DockEditorNoneAccName;

                container.Anchor   = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right;
                container.Location = new Point(offset2X, offset2Y);
                container.Size     = containerSize;

                none.Dock      = DockStyle.Bottom;
                container.Dock = DockStyle.Fill;

                right.Dock           = DockStyle.Right;
                right.Size           = buttonSize;
                right.TabIndex       = 4;
                right.TabStop        = true;
                right.Text           = " "; // Needs at least one character so focus rect will show.
                right.Appearance     = Appearance.Button;
                right.Click         += OnClick;
                right.KeyDown       += OnKeyDown;
                right.AccessibleName = SR.DockEditorRightAccName;

                left.Dock           = DockStyle.Left;
                left.Size           = buttonSize;
                left.TabIndex       = 2;
                left.TabStop        = true;
                left.Text           = " ";
                left.Appearance     = Appearance.Button;
                left.Click         += OnClick;
                left.KeyDown       += OnKeyDown;
                left.AccessibleName = SR.DockEditorLeftAccName;

                top.Dock           = DockStyle.Top;
                top.Size           = buttonSize;
                top.TabIndex       = 1;
                top.TabStop        = true;
                top.Text           = " ";
                top.Appearance     = Appearance.Button;
                top.Click         += OnClick;
                top.KeyDown       += OnKeyDown;
                top.AccessibleName = SR.DockEditorTopAccName;

                bottom.Dock           = DockStyle.Bottom;
                bottom.Size           = buttonSize;
                bottom.TabIndex       = 5;
                bottom.TabStop        = true;
                bottom.Text           = " ";
                bottom.Appearance     = Appearance.Button;
                bottom.Click         += OnClick;
                bottom.KeyDown       += OnKeyDown;
                bottom.AccessibleName = SR.DockEditorBottomAccName;

                fill.Dock           = DockStyle.Fill;
                fill.Size           = buttonSize;
                fill.TabIndex       = 3;
                fill.TabStop        = true;
                fill.Text           = " ";
                fill.Appearance     = Appearance.Button;
                fill.Click         += OnClick;
                fill.KeyDown       += OnKeyDown;
                fill.AccessibleName = SR.DockEditorFillAccName;

                Controls.Clear();
                Controls.AddRange(new Control[]
                {
                    container,
                    none
                });

                container.Controls.Clear();
                container.Controls.AddRange(new Control[]
                {
                    fill,
                    left,
                    right,
                    top,
                    bottom
                });
            }
Beispiel #4
0
        public CriteriaLine(bool select, bool search, bool order)
        {
            SelectCriteria  = select;
            SearchCriteria  = search;
            OrderByCriteria = order;

            //BackColor = Color.White;

            Insert.Text = "Insert"; Insert.Width = 40; Insert.Height = 19; Insert.FlatStyle = FlatStyle.Flat; Insert.Font = new Font("Arial", 6.5f);
            Insert.FlatAppearance.BorderSize = 0;

            Remove.Text = "Remove"; Remove.Width = 51; Remove.Height = 19; Remove.FlatStyle = FlatStyle.Flat; Remove.Font = new Font("Arial", 6.5f);
            Remove.FlatAppearance.BorderSize = 0;

            QueryOperatorSelect.Items.AddRange(new object[] { QueryOperator.And, QueryOperator.Or });
            QueryOperatorSelect.Width                 = 45;
            QueryOperatorSelect.DropDownStyle         = ComboBoxStyle.DropDownList;
            QueryOperatorSelect.SelectedIndex         = 0;
            QueryOperatorSelect.SelectedIndexChanged += delegate
            {
                GetValueOptions();
                object value = ValueSelect.SelectedItem;
                (Parent as CriteriaPanel).UpdateValueSelects(this);
                ValueSelect.SelectedItem = value;
            };
            //QueryOperatorSelect.Visible = false;

            PropertySelect.SelectedIndexChanged += OnPropertyChange;
            //PropertySelect.FlatStyle = FlatStyle.Flat;

            ComparerSelect.DropDownStyle = ComboBoxStyle.DropDownList;
            ComparerSelect.Width         = 115;
            ComparerSelect.ForeColor     = Color.Green;
            //ComparerSelect.FlatStyle = FlatStyle.Popup;
            //ComparerSelect.Font = new System.Drawing.Font("MS Sans Serif", 8, FontStyle.Bold);
            ComparerSelect.FormattingEnabled = true;
            ComparerSelect.Format           += delegate(object sender, ListControlConvertEventArgs e)
            {
                e.Value = SearchProperty.ComparerToString((QueryComparer)e.Value);
            };
            GetComparers();

            //ValueSelect.FlatStyle = FlatStyle.Flat;
            ValueSelect.Width        = 175;
            ValueSelect.TextChanged += delegate
            {
                (Parent as CriteriaPanel).UpdateValueSelects(this);
            };
            ValueSelect.SelectedIndexChanged += delegate
            {
                (Parent as CriteriaPanel).UpdateValueSelects(this);
            };
            ValueSelect.FormattingEnabled = true;
            ValueSelect.Format           += delegate(object sender, ListControlConvertEventArgs e)
            {
                //if (e.ListItem.GetType() == typeof(DeathCause))
                e.Value = e.ListItem.GetDescription();
            };

            OrderBySelect.Items.AddRange(new object[] { "Ascending", "Descending" });
            OrderBySelect.Width         = 83;
            OrderBySelect.DropDownStyle = ComboBoxStyle.DropDownList;
            OrderBySelect.SelectedIndex = 0;
            //OrderBySelect.FlatStyle = FlatStyle.Flat;

            if (OrderByCriteria)
            {
                Controls.AddRange(new Control[] { PropertySelect, OrderBySelect, Insert, Remove });
            }
            else
            {
                Controls.AddRange(new Control[] { QueryOperatorSelect, PropertySelect, ComparerSelect, ValueSelect, Insert, Remove });
            }

            Height = LineHeight;
        }
Beispiel #5
0
        public static Controls DeSerialize(string structure)
        {
            var list    = new List <Object>();
            var outlist = new Controls();

            if (string.IsNullOrEmpty(structure))
            {
                return(outlist);
            }
            var strings = structure.Split('#');

            try
            {
                foreach (var s1 in strings)
                {
                    if (string.IsNullOrEmpty(s1))
                    {
                        continue;
                    }
                    var byteArray  = Encoding.UTF8.GetBytes(s1);
                    var stream     = new MemoryStream(byteArray);
                    var serializer = new DataContractJsonSerializer(typeof(Control));
                    var result     = serializer.ReadObject(stream);
                    var control    = (Control)result;
                    if (control.Type == null)
                    {
                        continue;
                    }
                    var type = Assembly.GetExecutingAssembly().GetTypes().FirstOrDefault(x => x.Name == control.Type);
                    if (type == null)
                    {
                        continue;
                    }
                    var serializer2  = new DataContractJsonSerializer(type);
                    var memoryStream = new MemoryStream(byteArray);
                    var readObject   = serializer2.ReadObject(memoryStream);
                    list.Add(readObject);
                }
                outlist.AddRange(list.OrderBy(x => ((Control)x).Order).ToList());
                return(outlist);
            }
            catch (Exception ex)
            {
                int order = 1;
                foreach (var s1 in strings)
                {
                    if (string.IsNullOrEmpty(s1))
                    {
                        continue;
                    }
                    var format = string.Format("FG-{0}-TextBox-{1}", Guid.NewGuid(), order);
                    list.Add(new Label()
                    {
                        Text = "Error in Generate" + ex.Message, Id = format, Name = format, Caption = "Error in Generate"
                    });
                    order++;
                }
                outlist.AddRange(list.OrderBy(x => ((Control)x).Order).ToList());
                return(outlist);
            }
        }
Beispiel #6
0
        private void InitControls()
        {
            // visible controls
            _stickyNote = new TodoHoverableButtonImage()
            {
                Image_Normal  = Properties.Resources.sticky_note_normal,
                Image_Hovered = Properties.Resources.sticky_note_hovered,
                Location      = new Point(191, 0),
                Size          = new Size(31, 36)
            };

            _checkBox = new TodoCheckBox()
            {
                Location = new Point(321, 0),
                Size     = new Size(31, 36),
                Checked  = _desc.Done
            };

            // help/on-click controls
            _helpTT = new ToolTip()
            {
                AutoPopDelay = 60000,
                ToolTipIcon  = ToolTipIcon.Info
            };

            DescriptionChanged();

            _contextMenuStrip = new ContextMenuStrip();
            _contextMenuStrip.Items.Add("Modifier");
            _contextMenuStrip.Items.Add("Supprimer");

            _contextMenuStrip.ItemClicked += (object sender, ToolStripItemClickedEventArgs e) =>
            {
                switch (e.ClickedItem.Text)
                {
                case "Modifier":
                    using (var form = new EditTaskForm(_desc))
                    {
                        if (form.ShowDialog() == DialogResult.OK)
                        {
                            _desc.Title       = form.NewTitle;
                            _desc.Description = form.NewDescription;
                            DescriptionChanged();
                            Refresh();
                        }
                    }
                    break;

                case "Supprimer":
                    var parent = (PlanningPanel)Parent;
                    parent.RemoveTask(this);
                    break;
                }
            };

            // events
            _checkBox.Click += (object sender, EventArgs e) =>
            {
                _desc.Done = !_desc.Done;
                Refresh();
            };

            // // //

            Controls.AddRange(new Control[]
            {
                _stickyNote,
                _checkBox
            });

            ContextMenuStrip = _contextMenuStrip;
        }
Beispiel #7
0
        private void AI()
        {
            Control[] addBoxes    = new Control[4];
            int[]     guessColors = new int[6];
            int       r           = 0;

            AIRand();

            for (int b = 0; b < 12; b++)
            {
                if (count_correct == 4)
                {
                    break;
                }
                for (int j = 0; j < 4; j++)
                {
                    PictureBox box = shit[r, j];
                    switch (guess[j])
                    {
                    case "Red":
                        box.BackColor = Color.Red;
                        box.Visible   = true;
                        Controls.AddRange(addBoxes);
                        break;

                    case "Blue":
                        box.BackColor = Color.Blue;
                        box.Visible   = true;
                        Controls.AddRange(addBoxes);
                        break;

                    case "Yellow":
                        box.BackColor = Color.Yellow;
                        box.Visible   = true;
                        Controls.AddRange(addBoxes);
                        break;

                    case "Green":
                        box.BackColor = Color.ForestGreen;
                        box.Visible   = true;
                        Controls.AddRange(addBoxes);
                        break;

                    case "White":
                        box.BackColor = Color.WhiteSmoke;
                        box.Visible   = true;
                        Controls.AddRange(addBoxes);
                        break;

                    case "Black":
                        box.BackColor = Color.Black;
                        box.Visible   = true;
                        Controls.AddRange(addBoxes);
                        break;
                    }
                }

                CheckAnswers();
                if (count_correct == 4)
                {
                    break;
                }
                c = 0;
                r++;
                for (int j = 0; j < 4; j++)
                {
                    switch (j)
                    {
                    case 0:
                        AIRand(remColor1, j);
                        break;

                    case 1:
                        AIRand(remColor2, j);
                        break;

                    case 2:
                        AIRand(remColor3, j);
                        break;

                    case 3:
                        AIRand(remColor4, j);
                        break;
                    }
                }
                count_color   = 0;
                count_correct = 0;
            }
        }
Beispiel #8
0
        /// <summary>
        /// </summary>
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager
                resources = new System.ComponentModel.ComponentResourceManager(
                typeof(TFrmGLBatch));

            lblAccountText  = new Label();
            lblAccountValue = new Label();

            lblDateEnd      = new Label();
            lblDateEndValue = new Label();

            lblRevCur      = new Label();
            lblRevCurValue = new Label();

            lblCostCentre  = new Label();
            cmbCostCentres = new TCmbAutoPopulated();

            grdDetails = new SourceGrid.DataGrid();

            btnRevaluate = new Button();
            btnCancel    = new Button();
            SuspendLayout();

            int leftColStart  = 32;
            int leftColWidth  = 180;
            int colSpace      = 15;
            int rowY          = 5;
            int rowHeight     = 25;
            int rightColWidth = 280;

            // int buttonTop = 210;
            int buttonLeft = 120;

            //
            // lblAccountText
            //
            lblAccountText.Location  = new System.Drawing.Point(leftColStart, rowY);
            lblAccountText.Name      = "lblAccountText";
            lblAccountText.Size      = new System.Drawing.Size(leftColWidth, 21);
            lblAccountText.TextAlign = ContentAlignment.MiddleRight;

            //
            // lblAccountValue
            //
            lblAccountValue.Location  = new System.Drawing.Point(leftColStart + leftColWidth + colSpace, rowY);
            lblAccountValue.Name      = "lblAccountValue";
            lblAccountValue.Size      = new System.Drawing.Size(144, 21);
            lblAccountValue.TextAlign = ContentAlignment.MiddleLeft;

            rowY = rowY + rowHeight;

            //
            // lblDateEnd
            //
            lblDateEnd.Location  = new System.Drawing.Point(leftColStart, rowY);
            lblDateEnd.Name      = "lblDateEnd";
            lblDateEnd.Size      = new System.Drawing.Size(leftColWidth, 21);
            lblDateEnd.TextAlign = ContentAlignment.MiddleRight;

            //
            // lblDateEndValue
            //
            lblDateEndValue.Location  = new System.Drawing.Point(leftColStart + leftColWidth + colSpace, rowY);
            lblDateEndValue.Name      = "lblDateEndValue";
            lblDateEndValue.Size      = new System.Drawing.Size(rightColWidth, 21);
            lblDateEndValue.TextAlign = ContentAlignment.MiddleLeft;

            rowY = rowY + rowHeight;

            //
            // lblRevCur
            //
            lblRevCur.Location  = new System.Drawing.Point(leftColStart, rowY);
            lblRevCur.Name      = "lblRevCur";
            lblRevCur.Size      = new System.Drawing.Size(leftColWidth, 21);
            lblRevCur.TextAlign = ContentAlignment.MiddleRight;

            //
            // lblRevCurValue
            //
            lblRevCurValue.Location  = new System.Drawing.Point(leftColStart + leftColWidth + colSpace, rowY);
            lblRevCurValue.Name      = "lblRevCurValue";
            lblRevCurValue.Size      = new System.Drawing.Size(rightColWidth, 21);
            lblRevCurValue.TextAlign = ContentAlignment.MiddleLeft;

            rowY = rowY + rowHeight;

            //
            // Cost Centre
            //

            lblCostCentre.Location  = new System.Drawing.Point(leftColStart, rowY);
            lblCostCentre.Name      = "lblCostCentre";
            lblCostCentre.Size      = new System.Drawing.Size(leftColWidth, 21);
            lblCostCentre.TextAlign = ContentAlignment.MiddleRight;

            cmbCostCentres.Location  = new System.Drawing.Point(leftColStart + leftColWidth + colSpace, rowY);
            cmbCostCentres.Name      = "clbCostCentres";
            cmbCostCentres.Size      = new System.Drawing.Size(rightColWidth, 22);
            cmbCostCentres.ListTable = TCmbAutoPopulated.TListTableEnum.UserDefinedList;

            rowY = rowY + rowHeight + 20;

            grdDetails.Location    = new System.Drawing.Point(leftColStart, rowY);
            grdDetails.Size        = new System.Drawing.Size(430, 200);
            grdDetails.BorderStyle = BorderStyle.FixedSingle;
            grdDetails.Anchor      = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom;
            grdDetails.AutoStretchColumnsToFitWidth = true;

            rowY = rowY + 230;

            //
            // btnRevaluate
            //
            btnRevaluate.Location = new System.Drawing.Point(buttonLeft, rowY);
            btnRevaluate.Name     = "btnRevaluate";
            btnRevaluate.Size     = new System.Drawing.Size(95, 23);
            btnRevaluate.TabIndex = 2;
            btnRevaluate.Text     = "Revalue";
            btnRevaluate.UseVisualStyleBackColor = true;
            //
            // btnCancel
            //
            btnCancel.Location = new System.Drawing.Point(150 + buttonLeft, rowY);
            btnCancel.Name     = "btnCancel";
            btnCancel.Size     = new System.Drawing.Size(95, 23);
            btnCancel.TabIndex = 3;
            btnCancel.Text     = "Cancel";
            btnCancel.UseVisualStyleBackColor = true;
            //
            // GLRevaluation
            //
            AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            AutoScaleMode       = AutoScaleMode.Font;
            Font = new System.Drawing.Font("Verdana", 8.25f);


            ClientSize   = new System.Drawing.Size(500, rowY + 50);
            CancelButton = btnCancel;
            Controls.AddRange(new Control[] {
                btnCancel,
                btnRevaluate,
                lblAccountText,
                lblAccountValue,
                lblDateEnd,
                lblDateEndValue,
                lblRevCur,
                lblRevCurValue,
                lblCostCentre,
                cmbCostCentres,
                this.grdDetails
            });

            Icon = (System.Drawing.Icon)resources.GetObject("$this.Icon");

            Name = "GLRevaluation";
            Text = "Revaluation ...";
            ResumeLayout(false);
        }
Beispiel #9
0
        public BrowserDocument(AppWindow owner, bool show = true, bool contextAcquired = false) : base(owner)
        {
            MainMenuStrip = new MenuStrip()
            {
                Dock  = DockStyle.Top, AllowMerge = true, Visible = false,
                Items =
                {
                    new MenuButton("&View")
                    {
                        MergeAction   = MergeAction.MatchOnly,
                        DropDownItems =
                        {
                            new MenuButton("&DevTools", null, (s, a) =>   { if ((s as ToolStripMenuItem).Checked)
                                                                            {
                                                                                Browser.ShowDevTools();
                                                                            }
                                                                            else
                                                                            {
                                                                                Browser.CloseDevTools();
                                                                            } }, Keys.F12)
                            {
                                CheckOnClick = true,    MergeIndex = 0,MergeAction = MergeAction.Insert
                            },
                            new ToolStripSeparator()
                            {
                                MergeIndex = 1,         MergeAction = MergeAction.Insert
                            },
                        }
                    },
                    new MenuButton("&Navigate")
                    {
                        MergeIndex    = 3, MergeAction = MergeAction.Insert,
                        DropDownItems =
                        {
                            new MenuButton("&Forward", Icons.Icon_Forward, (s, a) => Browser.Forward()),
                            new MenuButton("&Back",    Icons.Icon_Back,    (s, a) => Browser.Back()),
                            new MenuButton("&Stop",    Icons.Icon_Stop,    (s, a) => Browser.Stop()),
                            new ToolStripSeparator(),
                            new MenuButton("&Refresh", Icons.Icon_Refresh, (s, a) => Browser.Reload()),
                        }
                    },
                    new MenuButton("&Execute")
                    {
                        MergeAction   = MergeAction.MatchOnly,
                        DropDownItems =
                        {
                            new MenuButton("&Play",                Icons.Icon_Play,  (s, a) => Context.Play(),     Keys.F5)
                            {
                                MergeAction = MergeAction.Insert,  MergeIndex = 0
                            },
                            new ToolStripSeparator()
                            {
                                MergeAction = MergeAction.Insert,  MergeIndex = 1
                            },
                            new MenuButton("&Break",               Icons.Icon_Break, (s, a) => Context.Break(),    Keys.Control | Keys.Pause)
                            {
                                MergeAction = MergeAction.Insert,  MergeIndex = 2
                            },
                            new MenuButton("&Step",                Icons.Icon_Step,  (s, a) => Context.Step(),     Keys.F8)
                            {
                                MergeAction = MergeAction.Insert,  MergeIndex = 3
                            },
                            new MenuButton("Sto&p",                Icons.Icon_Stop,  (s, a) => Context.Stop(),     Keys.Shift | Keys.F5)
                            {
                                MergeAction = MergeAction.Insert,  MergeIndex = 4
                            },
                            new ToolStripSeparator()
                            {
                                MergeAction = MergeAction.Insert,  MergeIndex = 5
                            },
                            new ToolStripSeparator(),
                            new MenuButton("Register &JS Fetcher", null,             (s, a) => RegisterJsObject(), Keys.F9),
                        }
                    }
                },
            };
            AddressBar = new MenuStrip()
            {
                Dock      = DockStyle.Top, AllowMerge = false,
                Stretch   = true, LayoutStyle = ToolStripLayoutStyle.HorizontalStackWithOverflow,
                ImageList = Icons.ImageList,
                Items     =
                {
                    new ToolbarButton("Back",    Icons.Icon_Back,    (s, a) => Browser.Back(),    "navigate-backward"),
                    new ToolbarButton("Forward", Icons.Icon_Forward, (s, a) => Browser.Forward(), "navigate-forward"),
                    new ToolbarButton("Refresh", Icons.Icon_Refresh, (s, a) => Browser.Reload(),  "navigate-refresh"),
                    new ToolStripLabel("&Address")
                    {
                        TextAlign = System.Drawing.ContentAlignment.TopLeft
                    },
                    (AddressBox = new ToolStripTextBox("AddressBox")
                    {
                        AutoSize = false
                    }),
                    new ToolStripButton("Go",    null,               (s, a) => Context.LoadUrl(AddressBox.Text))
                    {
                        Alignment = ToolStripItemAlignment.Right
                    },
                }
            };
            Browser = new ChromiumWebBrowser(new CefSharp.Web.HtmlString("<center><h1>Enter URL</h1></center>"))
            {
                Dock            = DockStyle.Fill,
                BrowserSettings = new BrowserSettings()
                {
                    FileAccessFromFileUrls      = CefState.Enabled,
                    UniversalAccessFromFileUrls = CefState.Enabled,
                }
            };
            Controls.AddRange(new Control[] { Browser, MainMenuStrip, AddressBar });
            AddressBox.KeyUp += (s, a) => { if (a.KeyCode != Keys.Enter)
                                            {
                                                return;
                                            }
                                            Context.LoadUrl(AddressBox.Text); };

            AddressBar.Layout += (s, a) => {
                var width = AddressBar.Width;
                foreach (ToolStripItem item in AddressBar.Items)
                {
                    if (item != AddressBox)
                    {
                        width -= item.Width - item.Margin.Horizontal;
                    }
                }
                AddressBox.Width = Math.Max(0, width - AddressBox.Margin.Horizontal - 18);
            };

            Browser.TitleChanged        += (s, a) => this.InvokeOnUiThreadIfRequired(() => { _browserTitle = a.Title; Context_StateChanged(Context, EventArgs.Empty); });
            Browser.AddressChanged      += (s, a) => this.InvokeOnUiThreadIfRequired(() => AddressBox.Text = a.Address);
            Browser.StatusMessage       += (s, a) => this.InvokeOnUiThreadIfRequired(() => OwnerWindow.Status = a.Value);
            Browser.LoadingStateChanged += (s, a) => {
                this.InvokeOnUiThreadIfRequired(() => {
                    AddressBar.Items["navigate-refresh"].Enabled  = a.CanReload;
                    AddressBar.Items["navigate-forward"].Enabled  = a.CanGoForward;
                    AddressBar.Items["navigate-backward"].Enabled = a.CanGoBack;
                });
            };
            Context = new Core.Context(Browser, OwnerWindow.ContextManager);
            owner.ContextManager.AddContext(Context, contextAcquired);
            if (show)
            {
                Show();
            }
        }
 public BattleInfoPanel()
 {
     Controls.AddRange(new Control[] { _enemyFighterPower, _enemyFighterPowerCaption, _formation, _resultRank });
     _resultRank.Click += (sender, e) => ShowResultRank();
 }
Beispiel #11
0
        private void InitializeForm()
        {
            logoPanel.SuspendLayout();
            SuspendLayout();

            logoLabel.BackColor = Color.White;
            logoLabel.Font      = new Font("Arial", 18F, (FontStyle.Bold | FontStyle.Italic), GraphicsUnit.Point, (byte)(0));
            logoLabel.ForeColor = Color.RoyalBlue;
            logoLabel.Location  = new Point(24, 24);
            logoLabel.Name      = "logoLabel";
            logoLabel.Size      = new Size(515, 46);
            logoLabel.TabIndex  = 0;
            logoLabel.Text      = "Cassini Personal Web Server";

            logoPanel.BackColor   = Color.White;
            logoPanel.BorderStyle = BorderStyle.FixedSingle;
            logoPanel.Controls.AddRange(new Control[] { logoLabel });
            logoPanel.Name     = "logoPanel";
            logoPanel.Size     = new Size(560, 80);
            logoPanel.TabIndex = 0;

            appDirLabel.BackColor = Color.Transparent;
            appDirLabel.Font      = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular, GraphicsUnit.Point, (byte)(0));
            appDirLabel.Location  = new Point(24, 104);
            appDirLabel.Name      = "appDirLabel";
            appDirLabel.Size      = new Size(152, 20);
            appDirLabel.TabIndex  = 1;
            appDirLabel.Text      = "Application &Directory:";
            appDirLabel.TextAlign = ContentAlignment.TopRight;

            appDirTextBox.BackColor = SystemColors.ActiveCaptionText;
            appDirTextBox.Location  = new Point(184, 104);
            appDirTextBox.Name      = "appDirTextBox";
            appDirTextBox.Size      = new Size(344, 22);
            appDirTextBox.TabIndex  = 2;
            appDirTextBox.Text      = _appPath;

            portLabel.BackColor = Color.Transparent;
            portLabel.Font      = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular, GraphicsUnit.Point, (byte)(0));
            portLabel.Location  = new Point(24, 144);
            portLabel.Name      = "portLabel";
            portLabel.Size      = new Size(152, 19);
            portLabel.TabIndex  = 3;
            portLabel.Text      = "Server &Port:";
            portLabel.TextAlign = ContentAlignment.TopRight;

            portTextBox.BackColor = SystemColors.ActiveCaptionText;
            portTextBox.Location  = new Point(184, 144);
            portTextBox.Name      = "portTextBox";
            portTextBox.Size      = new Size(72, 22);
            portTextBox.TabIndex  = 4;
            portTextBox.Text      = _portString;

            vrootLabel.BackColor = Color.Transparent;
            vrootLabel.Font      = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular, GraphicsUnit.Point, (byte)(0));
            vrootLabel.Location  = new Point(24, 184);
            vrootLabel.Name      = "vrootLabel";
            vrootLabel.Size      = new Size(152, 20);
            vrootLabel.TabIndex  = 5;
            vrootLabel.Text      = "Virtual &Root:";
            vrootLabel.TextAlign = ContentAlignment.TopRight;

            vrootTextBox.BackColor = SystemColors.ActiveCaptionText;
            vrootTextBox.Location  = new Point(184, 184);
            vrootTextBox.Name      = "vrootTextBox";
            vrootTextBox.Size      = new Size(120, 22);
            vrootTextBox.TabIndex  = 6;
            vrootTextBox.Text      = _virtRoot;

            browseLabel.BackColor = Color.Transparent;
            browseLabel.Font      = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular, GraphicsUnit.Point, (byte)(0));
            browseLabel.Location  = new Point(24, 224);
            browseLabel.Name      = "browseLabel";
            browseLabel.Size      = new Size(152, 19);
            browseLabel.TabIndex  = 7;
            browseLabel.Text      = "Click To Browse:";
            browseLabel.TextAlign = ContentAlignment.TopRight;
            browseLabel.Visible   = false;

            browseLink.Location     = new Point(184, 224);
            browseLink.Name         = "browseLink";
            browseLink.Size         = new Size(308, 30);
            browseLink.TabIndex     = 8;
            browseLink.Text         = "";
            browseLink.LinkClicked += new LinkLabelLinkClickedEventHandler(OnLinkClick);
            browseLabel.Visible     = false;

            startButton.BackColor = SystemColors.Control;
            startButton.FlatStyle = FlatStyle.Popup;
            startButton.Font      = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular, GraphicsUnit.Point, (byte)(0));
            startButton.Location  = new Point(328, 264);
            startButton.Name      = "startButton";
            startButton.Size      = new Size(96, 28);
            startButton.TabIndex  = 9;
            startButton.Text      = "Start";
            startButton.Click    += new System.EventHandler(OnStartButtonClick);

            stopButton.BackColor    = SystemColors.Control;
            stopButton.DialogResult = DialogResult.Cancel;
            stopButton.FlatStyle    = FlatStyle.Popup;
            stopButton.Font         = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular, GraphicsUnit.Point, (byte)(0));
            stopButton.Location     = new Point(440, 264);
            stopButton.Name         = "stopButton";
            stopButton.Size         = new Size(96, 28);
            stopButton.TabIndex     = 10;
            stopButton.Text         = "Stop";
            stopButton.Click       += new System.EventHandler(OnStopButtonClick);

            AcceptButton      = startButton;
            AutoScaleBaseSize = new Size(6, 15);
            AutoScroll        = true;
            CancelButton      = stopButton;
            ClientSize        = new Size(560, 312);
            Controls.AddRange(new Control[] {
                logoPanel,
                appDirLabel, appDirTextBox,
                portLabel, portTextBox,
                vrootLabel, vrootTextBox,
                browseLabel, browseLink,
                startButton, stopButton
            });

            Text = "Cassini Personal Web Server";
            Icon = new Icon(Assembly.GetExecutingAssembly().GetManifestResourceStream("CassiniWebServerIcon"));

            MaximizeBox   = false;
            MinimizeBox   = true;
            Name          = "CassiniForm";
            ShowInTaskbar = true;
            StartPosition = FormStartPosition.CenterParent;

            logoPanel.ResumeLayout(false);
            ResumeLayout(false);
        }
        void InitializeComponent2()
        {
            listBox1    = new CheckedListBox();
            listBox2    = new CheckedListBox();
            listBox3    = new CheckedListBox();
            listBox4    = new CheckedListBox();
            label1      = new Label();
            label2      = new Label();
            label3      = new Label();
            label4      = new Label();
            labelSel    = new Label();
            buttonAdd   = new Button();
            buttonClear = new Button();
            labelitems  = new Label();

            SuspendLayout();

            int y = 0;

            object[] items = new object[] {
                "this is item 0",
                "this is item 1",
                "this is item 2",
                "this is item 3",
                "this is item 4",
                "this is item 5",
                "this is item 6",
                //"this is item 6 this is really long item as a matter of fact that I may be longer that you expect",
                "this is item 7",
                "this is item 8",
                "this is item 9",
                "this is item 10",
                "this is item 11",
                "this is item 12",
                "this is item 13",
                "this is item 14",
                "this is item 15",
                "this is item 16",
                "this is item 17",
            };

            object[] items_comarques = new object[]
            {
                "Conca de Barberà", "Vallès Occidental", "Ripollès",
                "Alt Urgell", "Alta Ribagorça",
                "Anoia", "Bages", "Baix Empordà", "Baix Llobregat",
                "Baix Penedès", "Barcelonès",
                "Berguedà", "Cerdanya", "Garraf", "Garrigues",
                "Montsià", "Noguera", "Osona", "Pallars Jussà", "Pla d'Urgell",
                "Priorat", "Ribera d'Ebre", "Alt Penedès",
                "Segarra", "Segrià", "Selva", "Solsonès", "Tarragonès",
                "Garrotxa", "Gironès", "Maresme", "Pallars Sobirà",
                "Terra Alta", "Baix Camp", "Baix Ebre", "Urgell", "Val d'Aran",
                "Vallès Oriental", "Alt Empordà", "Alt Camp",
            };

            bool CheckedListbox1 = true;
            bool CheckedListbox2 = true;
            bool CheckedListbox3 = true;
            bool CheckedListbox4 = true;
            bool CheckedListbox5 = true;
            bool CheckedListbox6 = true;


            //
            // CheckedlistBox 1
            //
            if (CheckedListbox1)
            {
                listBox1.Location = new System.Drawing.Point(10, y + 20);
                //listBox1.MultiColumn = false;
                listBox1.SelectionMode = SelectionMode.One;
                listBox1.Size          = new System.Drawing.Size(400, 65);
                //listBox1.IntegralHeight = true;
                listBox1.ScrollAlwaysVisible = false;
                listBox1.HorizontalScrollbar = false;
                listBox1.Items.AddRange(items);
                listBox1.SelectedIndexChanged += new EventHandler(IndexChangedCheckedListBox1);
                //listBox1.ThreeDCheckBoxes = true;
                //listBox1.CheckOnClick = true;
                listBox1.SelectedIndex = 1;
                listBox1.SelectedIndex = 2;

                label1.Location = new System.Drawing.Point(10, y);
                label1.AutoSize = true;
                // label1.Text = "MultiColumn:" + listBox1.MultiColumn + " Selection:" + listBox1.SelectionMode;
                label1.Text = "Selection:" + listBox1.SelectionMode;
            }


            //
            // CheckedListBox 2
            //
            if (CheckedListbox2)
            {
                listBox2.Location = new System.Drawing.Point(450, y + 20);
                listBox2.Size     = new System.Drawing.Size(400, 65);
                //listBox2.IntegralHeight = false;
                //listBox2.CheckOnClick = true;
                listBox2.ScrollAlwaysVisible = false;
                listBox2.HorizontalScrollbar = false;
                //listBox2.MultiColumn = false;
                listBox2.Items.AddRange(items);
                listBox2.SelectedIndex         = 1;
                listBox2.SelectedIndex         = 2;
                listBox2.SelectedIndexChanged += new EventHandler(IndexChangedCheckedListBox2);
                label2.Location = new System.Drawing.Point(450, y);
                label2.AutoSize = true;
                //label2.Text = "MultiColumn:" + listBox2.MultiColumn + " Selection:" + listBox2.SelectionMode;
                label2.Text = "Selection:" + listBox2.SelectionMode;
            }

            y += 120;

            //
            // CheckedListBox 3
            //
            if (CheckedListbox3)
            {
                listBox3.Location = new System.Drawing.Point(10, y + 20);
                //listBox3.MultiColumn = true;
                listBox3.Size = new System.Drawing.Size(400, 70);
                //listBox3.IntegralHeight = true;
                listBox3.ScrollAlwaysVisible = false;
                listBox3.HorizontalScrollbar = false;
                listBox3.Items.AddRange(items_comarques);
                listBox3.Text = listBox3.Items[5].ToString();
                //listBox3.ThreeDCheckBoxes = true;
                listBox3.SelectedIndexChanged += new EventHandler(IndexChangedCheckedListBox3);
                listBox3.Sorted = true;
                label3.Location = new System.Drawing.Point(10, y);
                label3.AutoSize = true;
                // label3.Text = "MultiColumn:" + listBox3.MultiColumn + " Selection:" + listBox3.SelectionMode;
                label3.Text = "Selection:" + listBox3.SelectionMode;
            }

            //
            // CheckedListBox 4
            //
            if (CheckedListbox4)
            {
                listBox4.Location = new System.Drawing.Point(450, y + 20);
                //listBox4.MultiColumn = true;
                listBox4.Sorted = true;
                listBox4.Size   = new System.Drawing.Size(400, 70);
                //listBox4.IntegralHeight = false;
                listBox4.ScrollAlwaysVisible = false;
                listBox4.HorizontalScrollbar = false;
                listBox4.Items.AddRange(items_comarques);
                listBox4.SelectedIndexChanged += new EventHandler(IndexChangedCheckedListBox4);
                label4.Location = new System.Drawing.Point(450, y);
                label4.AutoSize = true;
                //label4.Text = "MultiColumn:" + listBox4.MultiColumn + " Selection:" + listBox4.SelectionMode;
                label4.Text = "Selection:" + listBox4.SelectionMode;
            }

            y += 120;
            labelSel.Location = new System.Drawing.Point(10, y);
            labelSel.AutoSize = true;
            labelSel.Text     = "Seleteced Items None";

            buttonAdd.Location = new Point(860, 30);
            buttonAdd.Name     = "button";
            buttonAdd.Size     = new System.Drawing.Size(75, 25);
            buttonAdd.Text     = "Add Items";
            buttonAdd.Click   += new System.EventHandler(ButtonAddClick);

            buttonClear.Location = new Point(860, 300);
            buttonClear.Name     = "button";
            buttonClear.Size     = new System.Drawing.Size(90, 25);
            buttonClear.Text     = "Clear Sel Items";
            buttonClear.Click   += new System.EventHandler(ButtonClearClick);

            labelitems.Location = new Point(860, 60);
            labelitems.Text     = "items:" + listBox1.Items.Count;

            //
            // MainForm
            //
            ClientSize = new System.Drawing.Size(950, 350);

            if (CheckedListbox1)
            {
                Controls.AddRange(new Control[] { listBox1, label1 });
            }

            if (CheckedListbox2)
            {
                Controls.AddRange(new Control[] { listBox2, label2 });
            }

            if (CheckedListbox3)
            {
                Controls.AddRange(new Control[] { listBox3, label3 });
            }

            if (CheckedListbox4)
            {
                Controls.AddRange(new Control[] { listBox4, label4 });
            }

            Controls.Add(buttonAdd);
            Controls.Add(labelitems);
            Controls.Add(labelSel);
            Controls.Add(buttonClear);

            Text = "SWF-Listboxes";
            ResumeLayout(false);
        }
Beispiel #13
0
        private void initBoardGuessLine(int i_GuessLineIndex, int i_Height)
        {
            GameButton GuessButton1 = new GameButton(i_GuessLineIndex);

            GuessButton1.Location = new Point(15, i_Height + 10);
            GuessButton1.Height   = k_GuessButtonSize;
            GuessButton1.Width    = k_GuessButtonSize;
            GuessButton1.Enabled  = false;
            r_GameButtons.Add(GuessButton1);

            GameButton GuessButton2 = new GameButton(i_GuessLineIndex);

            GuessButton2.Location = new Point(GuessButton1.Right + 10, i_Height + 10);
            GuessButton2.Height   = k_GuessButtonSize;
            GuessButton2.Width    = k_GuessButtonSize;
            GuessButton2.Enabled  = false;
            r_GameButtons.Add(GuessButton2);

            GameButton GuessButton3 = new GameButton(i_GuessLineIndex);

            GuessButton3.Location = new Point(GuessButton2.Right + 10, i_Height + 10);
            GuessButton3.Height   = k_GuessButtonSize;
            GuessButton3.Width    = k_GuessButtonSize;
            GuessButton3.Enabled  = false;
            r_GameButtons.Add(GuessButton3);

            GameButton GuessButton4 = new GameButton(i_GuessLineIndex);

            GuessButton4.Location = new Point(GuessButton3.Right + 10, i_Height + 10);
            GuessButton4.Height   = k_GuessButtonSize;
            GuessButton4.Width    = k_GuessButtonSize;
            GuessButton4.Enabled  = false;
            r_GameButtons.Add(GuessButton4);

            if (i_GuessLineIndex == 0)
            {
                GuessButton1.Enabled = true;
                GuessButton2.Enabled = true;
                GuessButton3.Enabled = true;
                GuessButton4.Enabled = true;
            }

            GameButton arrowButton = new GameButton(i_GuessLineIndex);

            arrowButton.Text     = k_ArrowsButtonsText;
            arrowButton.Enabled  = false;
            arrowButton.Location = new Point(GuessButton4.Right + 5, GuessButton4.Top + 10);
            arrowButton.Height   = 25;
            arrowButton.Width    = k_GuessButtonSize;
            r_ArrowsButtons.Add(arrowButton);

            GameButton feedbackButton1 = new GameButton(i_GuessLineIndex);

            feedbackButton1.Location = new Point(arrowButton.Right + 10, GuessButton4.Top + 5);
            feedbackButton1.Height   = k_FeedbackButtonSize;
            feedbackButton1.Width    = k_FeedbackButtonSize;
            feedbackButton1.Enabled  = false;
            r_FeedbackButtons.Add(feedbackButton1);

            GameButton feedbackButton2 = new GameButton(i_GuessLineIndex);

            feedbackButton2.Location = new Point(feedbackButton1.Right + 10, feedbackButton1.Top);
            feedbackButton2.Height   = k_FeedbackButtonSize;
            feedbackButton2.Width    = k_FeedbackButtonSize;
            feedbackButton2.Enabled  = false;
            r_FeedbackButtons.Add(feedbackButton2);

            GameButton feedbackButton3 = new GameButton(i_GuessLineIndex);

            feedbackButton3.Location = new Point(arrowButton.Right + 10, feedbackButton1.Bottom + 5);
            feedbackButton3.Height   = k_FeedbackButtonSize;
            feedbackButton3.Width    = k_FeedbackButtonSize;
            feedbackButton3.Enabled  = false;
            r_FeedbackButtons.Add(feedbackButton3);

            GameButton feedbackButton4 = new GameButton(i_GuessLineIndex);

            feedbackButton4.Location = new Point(feedbackButton3.Right + 10, feedbackButton3.Top);
            feedbackButton4.Height   = k_FeedbackButtonSize;
            feedbackButton4.Width    = k_FeedbackButtonSize;
            feedbackButton4.Enabled  = false;
            r_FeedbackButtons.Add(feedbackButton4);

            arrowButton.Click  += arrowButton_Click;
            GuessButton1.Click += guessButton_Click;
            GuessButton2.Click += guessButton_Click;
            GuessButton3.Click += guessButton_Click;
            GuessButton4.Click += guessButton_Click;
            Controls.AddRange(new Control[] { GuessButton1, GuessButton2, GuessButton3, GuessButton4, arrowButton, feedbackButton1, feedbackButton2, feedbackButton3, feedbackButton4 });
        }
Beispiel #14
0
 private void InitializeComponent()
 {
     System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MyForm));
     myDataGridTableStyle     = new System.Windows.Forms.DataGridTableStyle();
     myDataGridTextBoxColumn1 = new System.Windows.Forms.DataGridTextBoxColumn();
     myDataGridTextBoxColumn2 = new System.Windows.Forms.DataGridTextBoxColumn();
     myDataGridBoolColumn     = new System.Windows.Forms.DataGridBoolColumn();
     myLabel1    = new System.Windows.Forms.Label();
     myLabel2    = new System.Windows.Forms.Label();
     myDataGrid  = new System.Windows.Forms.DataGrid();
     myLabel3    = new System.Windows.Forms.Label();
     myComboBox3 = new System.Windows.Forms.ComboBox();
     myComboBox2 = new System.Windows.Forms.ComboBox();
     myComboBox1 = new System.Windows.Forms.ComboBox();
     ((System.ComponentModel.ISupportInitialize)(myDataGrid)).BeginInit();
     SuspendLayout();
     //
     // myDataGridTableStyle
     //
     myDataGridTableStyle.DataGrid = myDataGrid;
     myDataGridTableStyle.GridColumnStyles.AddRange(
         new System.Windows.Forms.DataGridColumnStyle[] {
         myDataGridTextBoxColumn1,
         myDataGridTextBoxColumn2,
         myDataGridBoolColumn
     });
     myDataGridTableStyle.MappingName = "TestTable";
     //
     // myDataGridTextBoxColumn1
     //
     myDataGridTextBoxColumn1.MappingName = "IntegerValue";
     //
     // myDataGridTextBoxColumn2
     //
     myDataGridTextBoxColumn2.MappingName = "StringValue";
     //
     // myDataGridBoolColumn
     //
     myDataGridBoolColumn.MappingName = "BooleanValue";
     myDataGridBoolColumn.TrueValue   = true;
     myDataGridBoolColumn.FalseValue  = false;
     myDataGridBoolColumn.NullValue   = Convert.DBNull;
     myDataGridBoolColumn.AllowNull   = true;
     RegisterEventHandlers(myDataGridBoolColumn);
     //
     // myLabel1
     //
     myLabel1.Location = new System.Drawing.Point(16, 232);
     myLabel1.Size     = new System.Drawing.Size(136, 24);
     myLabel1.Text     = "Change the TrueValue to:";
     //
     // myLabel2
     //
     myLabel2.Location = new System.Drawing.Point(16, 264);
     myLabel2.Size     = new System.Drawing.Size(136, 24);
     myLabel2.Text     = "Change the FalseValue to:";
     //
     // myDataGrid
     //
     myDataGrid.Location   = new System.Drawing.Point(16, 0);
     myDataGrid.Size       = new System.Drawing.Size(296, 216);
     myDataGrid.DataSource = CreateSource();
     myDataGrid.TableStyles.AddRange(
         new System.Windows.Forms.DataGridTableStyle[] {
         myDataGridTableStyle
     });
     //
     // myLabel3
     //
     myLabel3.Location = new System.Drawing.Point(16, 296);
     myLabel3.Size     = new System.Drawing.Size(136, 24);
     myLabel3.Text     = "Allow null values to appear:";
     //
     // myComboBox3
     //
     myComboBox3.Location = new System.Drawing.Point(168, 288);
     myComboBox3.Size     = new System.Drawing.Size(144, 21);
     myComboBox3.Items.AddRange(new Object[] { true, false });
     myComboBox3.SelectedIndexChanged +=
         new System.EventHandler(myComboBox3_SelectedIndexChanged);
     //
     // myComboBox2
     //
     myComboBox2.Location = new System.Drawing.Point(168, 256);
     myComboBox2.Size     = new System.Drawing.Size(144, 21);
     myComboBox2.Items.AddRange(new Object[] { true, false });
     myComboBox2.SelectedIndexChanged +=
         new System.EventHandler(myComboBox2_SelectedIndexChanged);
     //
     // myComboBox1
     //
     myComboBox1.Location = new System.Drawing.Point(168, 224);
     myComboBox1.Size     = new System.Drawing.Size(144, 21);
     myComboBox1.Items.AddRange(new Object[] { true, false });
     myComboBox1.SelectedIndexChanged +=
         new System.EventHandler(myComboBox1_SelectedIndexChanged);
     //
     // MyForm
     //
     ClientSize = new System.Drawing.Size(336, 341);
     Controls.AddRange(
         new System.Windows.Forms.Control[] {
         myComboBox3,
         myLabel3,
         myComboBox2,
         myLabel2,
         myComboBox1,
         myLabel1,
         myDataGrid
     });
     Name = "MyForm";
     Text = "MyForm";
     ((System.ComponentModel.ISupportInitialize)(myDataGrid)).EndInit();
     ResumeLayout(false);
 }
Beispiel #15
0
            internal virtual void InitializeComponent()
            {
                int XBORDER = SystemInformation.Border3DSize.Width;
                int YBORDER = SystemInformation.Border3DSize.Height;

                SetBounds(0, 0, 90, 90);

                AccessibleName = SR.AnchorEditorAccName;

                container.Location = new Point(0, 0);
                container.Size     = new Size(90, 90);
                container.Anchor   = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right;

                control.Location = new Point(30, 30);
                control.Size     = new Size(30, 30);
                control.Anchor   = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right;

                right.Location       = new Point(60, 40);
                right.Size           = new Size(30 - XBORDER, 10);
                right.TabIndex       = 2;
                right.TabStop        = true;
                right.Anchor         = AnchorStyles.Right;
                right.AccessibleName = SR.AnchorEditorRightAccName;

                left.Location       = new Point(XBORDER, 40);
                left.Size           = new Size(30 - XBORDER, 10);
                left.TabIndex       = 0;
                left.TabStop        = true;
                left.Anchor         = AnchorStyles.Left;
                left.AccessibleName = SR.AnchorEditorLeftAccName;

                top.Location       = new Point(40, YBORDER);
                top.Size           = new Size(10, 30 - YBORDER);
                top.TabIndex       = 1;
                top.TabStop        = true;
                top.Anchor         = AnchorStyles.Top;
                top.AccessibleName = SR.AnchorEditorTopAccName;

                bottom.Location       = new Point(40, 60);
                bottom.Size           = new Size(10, 30 - YBORDER);
                bottom.TabIndex       = 3;
                bottom.TabStop        = true;
                bottom.Anchor         = AnchorStyles.Bottom;
                bottom.AccessibleName = SR.AnchorEditorBottomAccName;

                Controls.Clear();
                Controls.AddRange(new Control[]
                {
                    container
                });

                container.Controls.Clear();
                container.Controls.AddRange(new Control[]
                {
                    control,
                    top,
                    left,
                    bottom,
                    right
                });
            }
Beispiel #16
0
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components      = new System.ComponentModel.Container();
            this.AutoScaleMode   = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize      = new System.Drawing.Size(450, 450);
            this.FormBorderStyle = FormBorderStyle.FixedToolWindow;
            this.Text            = "File Manager";

            /*
             * Open File
             */
            Open.Click += OpenFile_Click;

            /*
             * Save File
             */
            Save.Click += SaveFile_Click;

            /*
             * SaveAs File
             */
            SaveAs.Click += SaveAsFile_Click;

            /*
             * FontChange
             */
            FontChange.Click += delegate
            {
                Form3 form3 = new Form3();
                form3.ShowDialog();
                string    FontName  = ContentTextBox.Font.Name;
                float     FontSize  = ContentTextBox.Font.Size;
                FontStyle fontStyle = ContentTextBox.Font.Style;
                if (form3.LocalFontFamily != null)
                {
                    FontName = form3.LocalFontFamily;
                }
                if (form3.LocalFontSize != -1)
                {
                    FontSize = form3.LocalFontSize;
                }
                if (form3.LocalFontStyle != -1)
                {
                    fontStyle = (FontStyle)form3.LocalFontStyle;
                }
                ContentTextBox.Font = new Font(FontName, FontSize, fontStyle);
            };

            /*
             * FontColorChange
             */
            FontColorChange.Click += delegate
            {
                Form4 form4 = new Form4();
                form4.ShowDialog();
                string BackColor       = ContentTextBox.BackColor.Name;
                string ForegroundColor = ContentTextBox.ForeColor.Name;
                if (form4.LocalBackColor != "")
                {
                    BackColor = form4.LocalBackColor;
                }
                if (form4.LocalForegroundColor != "")
                {
                    ForegroundColor = form4.LocalForegroundColor;
                }
                try
                {
                    ContentTextBox.BackColor = Color.FromName(BackColor);
                    ContentTextBox.ForeColor = Color.FromName(ForegroundColor);
                }
                catch { }
            };
            //
            // Elements Adding
            //
            Controls.AddRange(new Control[] { Open, Save, SaveAs, EnterPathLabel, PathTextBox, ContentLabel, ContentTextBox, FontChange, FontColorChange });
        }
        void InitializeComponent()
        {
            listBox1   = new ListBox();
            listBox2   = new ListBox();
            listBox3   = new ListBox();
            listBox4   = new ListBox();
            listBox5   = new ListBox();
            listBox6   = new ListBox();
            listBox7   = new ListBox();
            listBox8   = new ListBox();
            label1     = new Label();
            label2     = new Label();
            label3     = new Label();
            label4     = new Label();
            label5     = new Label();
            label6     = new Label();
            label7     = new Label();
            label8     = new Label();
            buttonAdd  = new Button();
            labelitems = new Label();

            SuspendLayout();

            int y = 0;

            object[] items = new object[] {
                "this is item 1",
                "this is item 2",
                "this is item 3",
                "this is item 4",
                "this is item 5",
                "this is item 6",
                "this is item 7",
                "this is item 8",
                "this is item 9",
                "this is item 10",
                "this is item 11",
                "this is item 12",
                "this is item 13",
                "this is item 14",
                "this is item 15",
                "this is item 16",
                "this is item 17",
            };


            bool listbox1 = true;
            bool listbox2 = true;
            bool listbox3 = true;
            bool listbox4 = true;
            bool listbox5 = true;
            bool listbox6 = true;
            bool listbox7 = true;
            bool listbox8 = true;

            //
            // listBox 1
            //
            if (listbox1)
            {
                listBox1.Location            = new System.Drawing.Point(10, y + 20);
                listBox1.MultiColumn         = false;
                listBox1.Size                = new System.Drawing.Size(400, 65);
                listBox1.IntegralHeight      = true;
                listBox1.ScrollAlwaysVisible = false;
                listBox1.HorizontalScrollbar = false;
                listBox1.Items.AddRange(items);
                label1.Location = new System.Drawing.Point(10, y);
                label1.AutoSize = true;
                label1.Text     = "IntegralHeight true, ScrollAlwaysVisible(V) false, HorizontalScrollbar false";
            }

            //
            // listBox 2
            //
            if (listbox2)
            {
                listBox2.Location            = new System.Drawing.Point(450, y + 20);
                listBox2.MultiColumn         = false;
                listBox2.Size                = new System.Drawing.Size(400, 65);
                listBox2.IntegralHeight      = false;
                listBox2.ScrollAlwaysVisible = false;
                listBox2.HorizontalScrollbar = false;
                listBox2.Items.AddRange(items);
                label2.Location = new System.Drawing.Point(450, y);
                label2.AutoSize = true;
                label2.Text     = "IntegralHeight false, ScrollAlwaysVisible(V) false, HorizontalScrollbar false";
            }

            y += 120;

            //
            // listBox 3
            //
            if (listbox3)
            {
                listBox3.Location            = new System.Drawing.Point(10, y + 20);
                listBox3.MultiColumn         = false;
                listBox3.Size                = new System.Drawing.Size(400, 65);
                listBox3.IntegralHeight      = true;
                listBox3.ScrollAlwaysVisible = false;
                listBox3.HorizontalScrollbar = true;
                listBox3.Items.AddRange(items);
                label3.Location = new System.Drawing.Point(10, y);
                label3.AutoSize = true;
                label3.Text     = "IntegralHeight true, ScrollAlwaysVisible(V) false, HorizontalScrollbar true";
            }

            //
            // listBox 4
            //
            if (listbox4)
            {
                listBox4.Location            = new System.Drawing.Point(450, y + 20);
                listBox4.MultiColumn         = false;
                listBox4.Size                = new System.Drawing.Size(400, 65);
                listBox4.IntegralHeight      = false;
                listBox4.ScrollAlwaysVisible = false;
                listBox4.HorizontalScrollbar = true;
                listBox4.Items.AddRange(items);
                label4.Location = new System.Drawing.Point(450, y);
                label4.AutoSize = true;
                label4.Text     = "IntegralHeight false, ScrollAlwaysVisible(V) false, HorizontalScrollbar true";
            }

            y += 120;

            //
            // listBox 5
            //
            if (listbox5)
            {
                listBox5.Location            = new System.Drawing.Point(10, y + 20);
                listBox5.MultiColumn         = true;
                listBox5.Size                = new System.Drawing.Size(400, 70);
                listBox5.IntegralHeight      = true;
                listBox5.ScrollAlwaysVisible = false;
                listBox5.HorizontalScrollbar = false;
                listBox5.Items.AddRange(items);
                label5.Location = new System.Drawing.Point(10, y);
                label5.AutoSize = true;
                label5.Text     = "MultCol true, IntegralHeight true, ScrollAlwaysVisible(V) false, HorizontalScrollbar false";
            }

            //
            // listBox 6
            //
            if (listbox6)
            {
                listBox6.Location            = new System.Drawing.Point(450, y + 20);
                listBox6.MultiColumn         = true;
                listBox6.Size                = new System.Drawing.Size(400, 70);
                listBox6.IntegralHeight      = false;
                listBox6.ScrollAlwaysVisible = false;
                listBox6.HorizontalScrollbar = false;
                listBox6.Items.AddRange(items);
                label6.Location = new System.Drawing.Point(450, y);
                label6.AutoSize = true;
                label6.Text     = "MultCol true, IntegralHeight false, ScrollAlwaysVisible(V) false, HorizontalScrollbar false";
            }

            y += 120;

            //
            // listBox 7
            //
            if (listbox7)
            {
                listBox7.Location            = new System.Drawing.Point(10, y + 20);
                listBox7.MultiColumn         = true;
                listBox7.Size                = new System.Drawing.Size(400, 70);
                listBox7.IntegralHeight      = true;
                listBox7.ScrollAlwaysVisible = false;
                listBox7.HorizontalScrollbar = true;
                listBox7.Items.Add("Simple string");
                label7.Location = new System.Drawing.Point(10, y);
                label7.AutoSize = true;
                label7.Text     = "MultCol true, IntegralHeight true, ScrollAlwaysVisible(V) true, HorizontalScrollbar false";
            }

            //
            // listBox 8
            //
            if (listbox8)
            {
                listBox8.Location            = new System.Drawing.Point(450, y + 20);
                listBox8.MultiColumn         = true;
                listBox8.Size                = new System.Drawing.Size(400, 70);
                listBox8.IntegralHeight      = false;
                listBox8.ScrollAlwaysVisible = true;
                listBox8.HorizontalScrollbar = false;
                listBox8.Items.AddRange(items);
                listBox8.ColumnWidth = 50;
                label8.Location      = new System.Drawing.Point(450, y);
                label8.AutoSize      = true;
                label8.Text          = "MultCol true, IntegralHeight false, ScrollAlwaysVisible(V) true, HorizontalScrollbar false";
            }

            buttonAdd.Location = new Point(860, 30);
            buttonAdd.Name     = "button";
            buttonAdd.Size     = new System.Drawing.Size(75, 25);
            buttonAdd.Text     = "Add Items";
            buttonAdd.Click   += new System.EventHandler(ButtonAddClick);

            labelitems.Location = new Point(860, 60);
            labelitems.Text     = "items:" + listBox1.Items.Count;

            //
            // MainForm
            //
            ClientSize = new System.Drawing.Size(950, 500);

            if (listbox1)
            {
                Controls.AddRange(new Control[] { listBox1, label1 });
            }

            if (listbox2)
            {
                Controls.AddRange(new Control[] { listBox2, label2 });
            }

            if (listbox3)
            {
                Controls.AddRange(new Control[] { listBox3, label3 });
            }

            if (listbox4)
            {
                Controls.AddRange(new Control[] { listBox4, label4 });
            }

            if (listbox5)
            {
                Controls.AddRange(new Control[] { listBox5, label5 });
            }

            if (listbox6)
            {
                Controls.AddRange(new Control[] { listBox6, label6 });
            }

            if (listbox7)
            {
                Controls.AddRange(new Control[] { listBox7, label7 });
            }

            if (listbox8)
            {
                Controls.AddRange(new Control[] { listBox8, label8 });
            }

            Controls.Add(buttonAdd);
            Controls.Add(labelitems);


            Text = "SWF-Listboxes";
            ResumeLayout(false);
        }
Beispiel #18
0
 public DockIndicator(DockDragHandler dragHandler)
 {
     m_dragHandler = dragHandler;
     Controls.AddRange(new Control[] { PaneDiamond, PanelLeft, PanelRight, PanelTop, PanelBottom, PanelFill });
     Region = new Region(Rectangle.Empty);
 }
Beispiel #19
0
        /// <summary>
        /// Required designer variable.
        /// </summary>
        //private System.ComponentModel.IContainer components = null;
        #region ALiwoto Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            //----------------------------------------------
            //Almost all of the Form Settings, setted in the SandBoxBase class, so you don't need
            // to set something in this place...
            this.Dock = DockStyle.None;
            //this.Focused = true;
            this.HelpButton = false;
            this.TopMost    = true;
            //SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            this.StartPosition = FormStartPosition.CenterScreen;
            //----------------------------------------------
            this.MyRes = new WotoRes(typeof(YuiLoadingSandbox));
            this.YuiWaitingPictureBox = new GameControls.PictureBoxControl(this);
            this.YuiImage             = new Bitmap(ThereIsConstants.Path.Datas_Path + ThereIsConstants.Path.DoubleSlash +
                                                   MyRes.GetString(YuiPicNameInRes));
            this.AnimationFactory = new Trigger()
            {
                Interval = 45,
                Enabled  = false,
                Index    = 0,
            };
            this.UnlimitedRectangleFWorks = new RectangleF[]
            {
                //-----------------------------------------
                //"00":{"x":541,"y":324,"w":178,"h":153},
                //"01":{"x":359,"y":337,"w":178,"h":155},
                //"02":{"x":538,"y":1,"w":174,"h":160}
                //"03":{"x":356,"y":170,"w":174,"h":163},
                //"04":{"x":1,"y":343,"w":175,"h":165},
                //"05":{"x":1,"y":1,"w":175,"h":167},
                //"06":{"x":179,"y":172,"w":173,"h":166},
                //"07":{"x":1,"y":172,"w":174,"h":167},
                //"08":{"x":180,"y":1,"w":174,"h":165},
                //"09":{"x":180,"y":342,"w":175,"h":163},
                //"10":{"x":359,"y":1,"w":175,"h":160},
                //"11":{"x":534,"y":165,"w":177,"h":155},
                //-----------------------------------------
                new RectangleF(new PointF(541, 324), new SizeF(178, 153)), // index : 0
                new RectangleF(new PointF(359, 337), new SizeF(178, 155)), // index : 1
                new RectangleF(new PointF(538, 1), new SizeF(174, 160)),   // index : 2
                new RectangleF(new PointF(356, 170), new SizeF(174, 163)), // index : 3
                new RectangleF(new PointF(1, 343), new SizeF(175, 165)),   // index : 4
                new RectangleF(new PointF(1, 1), new SizeF(175, 167)),     // index : 5
                new RectangleF(new PointF(179, 172), new SizeF(173, 166)), // index : 6
                new RectangleF(new PointF(1, 172), new SizeF(174, 167)),   // index : 7
                new RectangleF(new PointF(180, 1), new SizeF(174, 165)),   // index : 8
                new RectangleF(new PointF(180, 342), new SizeF(175, 163)), // index : 9
                new RectangleF(new PointF(359, 1), new SizeF(175, 160)),   // index : 10
                new RectangleF(new PointF(534, 165), new SizeF(177, 155)), // index : 11
            };
            //----------------------------------------------
            //names:

            //PictureBoxes:
            //this.YuiWaitingPictureBox.Image = Properties.Resources.YuiLoading;
            this.YuiWaitingPictureBox.Image =
                ThereIsConstants.Actions.CropImage(YuiImage,
                                                   new RectangleF(new PointF(541, 324), new SizeF(178, 153)));
            TheW++;
            //TabIndexes:

            //FontAndTextAligns:

            //Styles:

            //Sizes:
            this.Size =
                this.YuiWaitingPictureBox.Size =
                    new Size(180, 170);

            //Locations:

            //Colors:
            this.Opacity         = 1;
            this.BackColor       = Color.GhostWhite;
            this.TransparencyKey = Color.GhostWhite;
            //this.YuiWaitingPictureBox.BackColor = Color.Transparent;
            //ComboBoxes:
            //Enableds:
            //Texts:
            //AddRanges:
            //ToolTipSettings:
            //----------------------------------------------
            //Events:
            this.AnimationFactory.Tick += AnimationFactoryWorker;
            //----------------------------------------------
            Controls.AddRange(new Control[]
            {
                YuiWaitingPictureBox
            });
            AnimationFactory.Enabled = true;
        }
Beispiel #20
0
        private void InitializeComponent()
        {
            nodesTreeView   = new TreeView();
            splitter        = new Splitter();
            viewPanel       = new Panel();
            mainMenu        = new MainMenu();
            fileMenuItem    = new MenuItem();
            viewMenuItem    = new MenuItem();
            exitMenuItem    = new MenuItem();
            refreshMenuItem = new MenuItem();

            SuspendLayout();

            //
            // nodesTreeView
            //
            nodesTreeView.BorderStyle        = BorderStyle.None;
            nodesTreeView.Dock               = DockStyle.Left;
            nodesTreeView.ImageIndex         = -1;
            nodesTreeView.Name               = "nodesTreeView";
            nodesTreeView.SelectedImageIndex = -1;
            nodesTreeView.ShowLines          = false;
            nodesTreeView.Size               = new System.Drawing.Size(121, 549);
            nodesTreeView.TabIndex           = 0;
            nodesTreeView.HotTracking        = true;
            nodesTreeView.AfterSelect       += new TreeViewEventHandler(NodesTreeView_AfterSelect);

            //
            // splitter
            //
            splitter.Location = new System.Drawing.Point(121, 0);
            splitter.Name     = "splitter";
            splitter.Size     = new System.Drawing.Size(3, 549);
            splitter.TabIndex = 1;
            splitter.TabStop  = false;

            //
            // viewPanel
            //
            viewPanel.Dock     = DockStyle.Fill;
            viewPanel.Location = new System.Drawing.Point(124, 0);
            viewPanel.Name     = "viewPanel";
            viewPanel.Size     = new System.Drawing.Size(676, 549);
            viewPanel.TabIndex = 2;

            //
            // mainMenu
            //
            mainMenu.MenuItems.AddRange(new MenuItem[] { fileMenuItem, viewMenuItem });

            //
            // fileMenuItem
            //
            fileMenuItem.Index = 0;
            fileMenuItem.MenuItems.AddRange(new MenuItem[] { exitMenuItem });
            fileMenuItem.Text = "File";

            // viewMenuItem
            viewMenuItem.Index = 1;
            viewMenuItem.MenuItems.AddRange(new MenuItem[] { refreshMenuItem });
            viewMenuItem.Text = "View";

            //
            // exitMenuItem
            //
            exitMenuItem.Index  = 0;
            exitMenuItem.Text   = "E&xit";
            exitMenuItem.Click += new System.EventHandler(ExitMenuItem_Click);

            //
            // refreshMenuItem
            //
            refreshMenuItem.Index  = 0;
            refreshMenuItem.Text   = "Refresh";
            refreshMenuItem.Click += new EventHandler(RefreshMenuItem_Click);

            //
            // AdminFrame
            //
            AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            ClientSize        = new System.Drawing.Size(705, 680);
            Controls.AddRange(new Control[] { viewPanel, splitter, nodesTreeView });

            Menu = mainMenu;
            Name = "AdminFrame";
            Text = "Replication Admin Tool";

            ResumeLayout(false);

            Resize += new EventHandler(AdminFrame_Resize);
        }
Beispiel #21
0
        // We are required to compute the needed height to contain our controls
        // *before* the dialog is shown, thus we do it here as well as the vertical layout.
        // The X coords for our controls are set as soon as we get access to the native
        // dialog's controls, which happens to be when the OnShown event is fired.
        void Initialize(OpenFileDialogData data)
        {
            SuspendLayout();

            int padding = 6;
            int y       = padding;

            labelsWidth = GetMaxLabelWidth(data.ShowEncodingSelector, data.ShowViewerSelector);

            if (data.ShowEncodingSelector)
            {
                encodingLabel = new Label()
                {
                    Text     = GettextCatalog.GetString(EncodingText),
                    Top      = y,
                    AutoSize = true
                };

                encodingBox = new EncodingBox(data.Action != Gtk.FileChooserAction.Save)
                {
                    Top = y,
                    SelectedEncodingId = data.Encoding != null ? data.Encoding.CodePage : 0,
                };

                Controls.AddRange(new Control [] { encodingLabel, encodingBox });

                y += Math.Max(encodingLabel.Height, encodingBox.Height) + padding;
            }

            if (data.ShowViewerSelector && FileDialog is OpenFileDialog)
            {
                viewerLabel = new Label()
                {
                    Text     = GettextCatalog.GetString(ViewerText),
                    Top      = y,
                    AutoSize = true
                };

                viewerBox = new ComboBox()
                {
                    Top           = y,
                    DropDownStyle = ComboBoxStyle.DropDownList,
                    Enabled       = false
                };

                y += Math.Max(viewerLabel.Height, viewerBox.Height) + padding;

                if (IdeApp.Workspace.IsOpen)
                {
                    closeSolutionBox = new CheckBox()
                    {
                        Text     = GettextCatalog.GetString("Close current workspace"),
                        Top      = y,
                        AutoSize = true,
                        Checked  = true,
                        Enabled  = false
                    };

                    y += closeSolutionBox.Height + padding;
                }

                if (encodingBox != null)
                {
                    viewerBox.SelectedIndexChanged += delegate {
                        int idx = viewerBox.SelectedIndex;
                        encodingBox.Enabled = !(idx == 0 && currentViewers [0] == null);
                    };
                }

                Controls.AddRange(new Control [] { viewerLabel, viewerBox });
                if (closeSolutionBox != null)
                {
                    Controls.Add(closeSolutionBox);
                }
            }

            AutoScaleDimensions = new SizeF(6F, 13F);
            AutoScaleMode       = AutoScaleMode.Font;
            ClientSize          = new Size(ClientSize.Width, y);

            ResumeLayout();
        }
Beispiel #22
0
        public void InitializeComponents()
        {
            // Control creation
            subredditTB = new TextBox("subredditTB")
            {
                Position = new Point(0, 0), Size = new Size(75, 1), Placeholder = "Subreddit name..."
            };
            goBTN = new Button("goBTN", ">>>")
            {
                Position = new Point(75, 0), Size = new Size(5, 1)
            };

            sep1 = new Label("sep1", new string('-', 80))
            {
                Position = new Point(0, 1), Size = new Size(80, 1)
            };

            hotBTN = new Button("hotBTN", "Hot")
            {
                Position = new Point(0, 2), Size = new Size(20, 1), Enabled = false
            };
            newBTN = new Button("newBTN", "New")
            {
                Position = new Point(20, 2), Size = new Size(20, 1), Enabled = false
            };
            controversialBTN = new Button("controversialBTN", "Controversial")
            {
                Position = new Point(40, 2), Size = new Size(20, 1), Enabled = false
            };
            bestBTN = new Button("bestBTN", "Best")
            {
                Position = new Point(60, 2), Size = new Size(20, 1), Enabled = false
            };

            sep2 = new Label("sep2", new string('-', 80))
            {
                Position = new Point(0, 3), Size = new Size(80, 1)
            };

            searchTB = new TextBox("searchTB")
            {
                Position = new Point(0, 4), Size = new Size(70, 1), Placeholder = "Search..."
            };
            searchBTN = new Button("searchBTN", "Search")
            {
                Position = new Point(70, 4), Size = new Size(10, 1), Enabled = false
            };

            sep3 = new Label("sep3", new string('=', 80))
            {
                Position = new Point(0, 5), Size = new Size(80, 1)
            };

            pageLabel = new Label("pageLabel", "Page ...")
            {
                Position = new Point(0, 6), Size = new Size(72, 1)
            };
            prevBTN = new Button("prevBTN", "<-")
            {
                Position = new Point(72, 6), Size = new Size(4, 1), Enabled = false
            };
            nextBTN = new Button("nextBTN", "->")
            {
                Position = new Point(76, 6), Size = new Size(4, 1), Enabled = false
            };

            postLabel   = new Label[PostsPerPage];
            postLinkBTN = new Button[PostsPerPage];

            for (int i = 0; i < PostsPerPage; i++)
            {
                postLabel[i] = new Label($"postLabel{i}", "...")
                {
                    Position = new Point(0, 7 + (4 * i)), Size = new Size(75, 3)
                };
                postLinkBTN[i] = new Button($"postLinkBTN{i}", ">")
                {
                    Position = new Point(75, 7 + (4 * i)), Size = new Size(5, 3), Enabled = false
                };
            }

            // Event registration
            subredditTB.KeyDown += SubredditTB_KeyDown;
            goBTN.Click         += GoBTN_Click;

            hotBTN.Click           += HotBTN_Click;
            newBTN.Click           += NewBTN_Click;
            controversialBTN.Click += ControversialBTN_Click;
            bestBTN.Click          += BestBTN_Click;

            searchBTN.Click  += SearchBTN_Click;
            searchTB.KeyDown += SearchTB_KeyDown;

            prevBTN.Click += PrevBTN_Click;
            nextBTN.Click += NextBTN_Click;

            postLinkBTN[0].Click += PostLinkBTN0_Click;
            postLinkBTN[1].Click += PostLinkBTN1_Click;
            postLinkBTN[2].Click += PostLinkBTN2_Click;
            postLinkBTN[3].Click += PostLinkBTN3_Click;
            postLinkBTN[4].Click += PostLinkBTN4_Click;
            postLinkBTN[5].Click += PostLinkBTN5_Click;

            // Register all controls
            Controls.AddRange(subredditTB, goBTN, sep1, hotBTN, newBTN, controversialBTN, bestBTN, sep2, searchTB, searchBTN, sep3, pageLabel, prevBTN, nextBTN);
            Controls.AddRange(postLabel);
            Controls.AddRange(postLinkBTN);
        }
Beispiel #23
0
    private void InitializeComponent()
    {
        button1  = new  Button();
        button2  = new  Button();
        button3  = new  Button();
        textBox2 = new  TextBox();
        textBox1 = new  TextBox();
        button4  = new  Button();
        label1   = new  Label();
        label2   = new  Label();
        SuspendLayout();

        button1.Location = new  Point(120, 8);
        button1.Name     = "button1";
        button1.Size     = new  Size(64, 24);
        button1.TabIndex = 0;
        button1.Text     = "<";
        button1.Click   += new System.EventHandler(button1_Click);

        button2.Location = new  Point(184, 8);
        button2.Name     = "button2";
        button2.Size     = new  Size(64, 24);
        button2.TabIndex = 1;
        button2.Text     = ">";
        button2.Click   += new System.EventHandler(button2_Click);

        button3.Location = new  Point(96, 112);
        button3.Name     = "button3";
        button3.TabIndex = 4;
        button3.Text     = "Suspend";
        button3.Click   += new System.EventHandler(button3_Click);

        textBox2.Location = new  Point(200, 72);
        textBox2.Name     = "textBox2";
        textBox2.Size     = new  Size(150, 20);
        textBox2.TabIndex = 3;
        textBox2.Text     = "";

        textBox1.Location = new  Point(40, 72);
        textBox1.Name     = "textBox1";
        textBox1.Size     = new  Size(150, 20);
        textBox1.TabIndex = 2;
        textBox1.Text     = "";

        button4.Location = new  Point(192, 112);
        button4.Name     = "button4";
        button4.TabIndex = 5;
        button4.Text     = "Resume";
        button4.Click   += new System.EventHandler(button4_Click);

        label1.Location = new  Point(48, 48);
        label1.Name     = "label1";
        label1.TabIndex = 6;
        label1.Text     = "Customer Name";

        label2.Location = new  Point(216, 48);
        label2.Name     = "label2";
        label2.TabIndex = 7;
        label2.Text     = "CustomerID";

        ClientSize = new  Size(450, 200);
        Controls.AddRange(new  Control[] { label2, label1, button4, button3, button1, button2, textBox1, textBox2 });
        Name = "Form1";
        Text = "Binding Sample";
        ResumeLayout(false);
    }
Beispiel #24
0
        // Initialize the control elements.
        public void InitializeComponent()
        {
            // Initialize the controls.
            components                   = new System.ComponentModel.Container();
            errorProvider1               = new System.Windows.Forms.ErrorProvider();
            textName                     = new System.Windows.Forms.TextBox();
            textAddress                  = new System.Windows.Forms.TextBox();
            textCity                     = new System.Windows.Forms.TextBox();
            textStateProvince            = new System.Windows.Forms.TextBox();
            textPostal                   = new System.Windows.Forms.TextBox();
            textCountryRegion            = new System.Windows.Forms.TextBox();
            textEmail                    = new System.Windows.Forms.TextBox();
            labelName                    = new System.Windows.Forms.Label();
            labelAddress                 = new System.Windows.Forms.Label();
            labelCityStateProvincePostal = new System.Windows.Forms.Label();
            labelCountryRegion           = new System.Windows.Forms.Label();
            labelEmail                   = new System.Windows.Forms.Label();

            // Set the tab order, text alignment, size, and location of the controls.
            textName.Location                      = new System.Drawing.Point(120, 8);
            textName.Size                          = new System.Drawing.Size(232, 20);
            textName.TabIndex                      = 0;
            textAddress.Location                   = new System.Drawing.Point(120, 32);
            textAddress.Size                       = new System.Drawing.Size(232, 20);
            textAddress.TabIndex                   = 1;
            textCity.Location                      = new System.Drawing.Point(120, 56);
            textCity.Size                          = new System.Drawing.Size(96, 20);
            textCity.TabIndex                      = 2;
            textStateProvince.Location             = new System.Drawing.Point(216, 56);
            textStateProvince.Size                 = new System.Drawing.Size(56, 20);
            textStateProvince.TabIndex             = 3;
            textPostal.Location                    = new System.Drawing.Point(272, 56);
            textPostal.Size                        = new System.Drawing.Size(80, 20);
            textPostal.TabIndex                    = 4;
            textCountryRegion.Location             = new System.Drawing.Point(120, 80);
            textCountryRegion.Size                 = new System.Drawing.Size(232, 20);
            textCountryRegion.TabIndex             = 5;
            textEmail.Location                     = new System.Drawing.Point(120, 104);
            textEmail.Size                         = new System.Drawing.Size(232, 20);
            textEmail.TabIndex                     = 6;
            labelName.Location                     = new System.Drawing.Point(8, 8);
            labelName.Size                         = new System.Drawing.Size(112, 23);
            labelName.Text                         = "Name:";
            labelName.TextAlign                    = System.Drawing.ContentAlignment.MiddleRight;
            labelAddress.Location                  = new System.Drawing.Point(8, 32);
            labelAddress.Size                      = new System.Drawing.Size(112, 23);
            labelAddress.Text                      = "Address:";
            labelAddress.TextAlign                 = System.Drawing.ContentAlignment.MiddleRight;
            labelCityStateProvincePostal.Location  = new System.Drawing.Point(8, 56);
            labelCityStateProvincePostal.Size      = new System.Drawing.Size(112, 23);
            labelCityStateProvincePostal.Text      = "City, St/Prov. Postal:";
            labelCityStateProvincePostal.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            labelCountryRegion.Location            = new System.Drawing.Point(8, 80);
            labelCountryRegion.Size                = new System.Drawing.Size(112, 23);
            labelCountryRegion.Text                = "Country/Region:";
            labelCountryRegion.TextAlign           = System.Drawing.ContentAlignment.MiddleRight;
            labelEmail.Location                    = new System.Drawing.Point(8, 104);
            labelEmail.Size                        = new System.Drawing.Size(112, 23);
            labelEmail.Text                        = "email:";
            labelEmail.TextAlign                   = System.Drawing.ContentAlignment.MiddleRight;

            // Add the Validating and Validated handlers for textEmail.
            textEmail.Validating += new System.ComponentModel.CancelEventHandler(textEmail_Validating);
            textEmail.Validated  += new System.EventHandler(textEmail_Validated);

            // Add the controls to the user control.
            Controls.AddRange(new System.Windows.Forms.Control[]
            {
                labelName,
                labelAddress,
                labelCityStateProvincePostal,
                labelCountryRegion,
                labelEmail,
                textName,
                textAddress,
                textCity,
                textStateProvince,
                textPostal,
                textCountryRegion,
                textEmail
            });

            // Size the user control.
            Size = new System.Drawing.Size(375, 150);
        }
Beispiel #25
0
            private void InitializeComponent()
            {
                ComponentResourceManager resources = new ComponentResourceManager(typeof(ShortcutKeysEditor));

                tlpOuter     = new TableLayoutPanel();
                lblModifiers = new Label();
                chkCtrl      = new CheckBox();
                chkAlt       = new CheckBox();
                chkShift     = new CheckBox();
                tlpInner     = new TableLayoutPanel();
                lblKey       = new Label();
                cmbKey       = new ComboBox();
                btnReset     = new Button();
                tlpOuter.SuspendLayout();
                tlpInner.SuspendLayout();
                SuspendLayout();

                //
                // tlpOuter
                //
                resources.ApplyResources(tlpOuter, "tlpOuter");
                tlpOuter.ColumnCount = 3;
                tlpOuter.ColumnStyles.Add(new ColumnStyle());
                tlpOuter.ColumnStyles.Add(new ColumnStyle());
                tlpOuter.ColumnStyles.Add(new ColumnStyle());
                tlpOuter.Controls.Add(lblModifiers, 0, 0);
                tlpOuter.Controls.Add(chkCtrl, 0, 1);
                tlpOuter.Controls.Add(chkShift, 1, 1);
                tlpOuter.Controls.Add(chkAlt, 2, 1);
                tlpOuter.Name     = "tlpOuter";
                tlpOuter.RowCount = 2;
                tlpOuter.RowStyles.Add(new RowStyle(SizeType.Absolute, 20F));
                tlpOuter.RowStyles.Add(new RowStyle(SizeType.Absolute, 24F));

                //
                // lblModifiers
                //
                resources.ApplyResources(lblModifiers, "lblModifiers");
                tlpOuter.SetColumnSpan(lblModifiers, 3);
                lblModifiers.Name = "lblModifiers";

                //
                // chkCtrl
                //
                resources.ApplyResources(chkCtrl, "chkCtrl");
                chkCtrl.Name = "chkCtrl";
                // this margin setting makes this control left-align with cmbKey and indented from lblModifiers/lblKey
                chkCtrl.Margin = new Padding(12, 3, 3, 3);

                chkCtrl.CheckedChanged += chkModifier_CheckedChanged;

                //
                // chkAlt
                //
                resources.ApplyResources(chkAlt, "chkAlt");
                chkAlt.Name = "chkAlt";

                chkAlt.CheckedChanged += chkModifier_CheckedChanged;

                //
                // chkShift
                //
                resources.ApplyResources(chkShift, "chkShift");
                chkShift.Name = "chkShift";

                chkShift.CheckedChanged += chkModifier_CheckedChanged;

                //
                // tlpInner
                //
                resources.ApplyResources(tlpInner, "tlpInner");
                tlpInner.ColumnCount = 2;
                tlpInner.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));
                tlpInner.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));
                tlpInner.Controls.Add(lblKey, 0, 0);
                tlpInner.Controls.Add(cmbKey, 0, 1);
                tlpInner.Controls.Add(btnReset, 1, 1);
                tlpInner.Name     = "tlpInner";
                tlpInner.RowCount = 2;
                tlpInner.RowStyles.Add(new RowStyle(SizeType.Absolute, 20F));
                tlpInner.RowStyles.Add(new RowStyle(SizeType.AutoSize));

                //
                // lblKey
                //
                resources.ApplyResources(lblKey, "lblKey");
                tlpInner.SetColumnSpan(lblKey, 2);
                lblKey.Name = "lblKey";

                //
                // cmbKey
                //
                resources.ApplyResources(cmbKey, "cmbKey");
                cmbKey.DropDownStyle = ComboBoxStyle.DropDownList;
                cmbKey.Name          = "cmbKey";
                // this margin setting makes this control align with chkCtrl and indented from lblModifiers/lblKey
                // the top margin makes the combobox and btnReset align properly
                cmbKey.Margin  = new Padding(12, 4, 3, 3);
                cmbKey.Padding = cmbKey.Margin;

                foreach (Keys keyCode in validKeys)
                {
                    cmbKey.Items.Add(KeysConverter.ConvertToString(keyCode));
                }

                cmbKey.SelectedIndexChanged += cmbKey_SelectedIndexChanged;

                //
                // btnReset
                //
                resources.ApplyResources(btnReset, "btnReset");
                btnReset.Name = "btnReset";

                btnReset.Click += btnReset_Click;

                resources.ApplyResources(this, "$this");
                Controls.AddRange(new Control[] { tlpInner, tlpOuter });
                Name    = "ShortcutKeysUI";
                Padding = new Padding(4);

                tlpOuter.ResumeLayout(false);
                tlpOuter.PerformLayout();
                tlpInner.ResumeLayout(false);
                tlpInner.PerformLayout();
                ResumeLayout(false);
                PerformLayout();
            }
Beispiel #26
0
        public void CreateComponents()
        {
            _lblAvailable           = new Label();
            _lblAvailable.Text      = "Available:";
            _lblAvailable.FlatStyle = FlatStyle.System;
            _lblAvailable.AutoSize  = true;

            _lblInWorkspace           = new Label();
            _lblInWorkspace.FlatStyle = FlatStyle.System;
            _lblInWorkspace.AutoSize  = true;

            _lblProcessing           = new Label();
            _lblProcessing.FlatStyle = FlatStyle.System;
            _lblProcessing.AutoSize  = true;
            _lblProcessing.Visible   = false;
            _lblProcessing.Text      = "Processing...";

            _btnAdd    = CreateTabButton("Add", new EventHandler(OnAddListClick));
            _btnRemove = CreateTabButton("Remove", new EventHandler(OnRemoveListClick));

            //
            // _lvAvailable
            //
            _lvAvailable = new ResourceListView2();
            _lvAvailable.Columns.Add(new ResourceIconColumn());
            _lvAvailable.AddColumn(ResourceProps.DisplayName).AutoSize = true;

            IResourceList tabResources = Core.ResourceStore.GetAllResourcesLive(_resourceTypes [0]);

            tabResources.Sort(new int[] { ResourceProps.DisplayName }, true);
            _listAvailable            = tabResources;
            _lvAvailable.DataProvider = new ResourceListDataProvider(_listAvailable);

            _nameJetFilter = new ResourceNameJetFilter("");
            _lvAvailable.Filters.Add(_nameJetFilter);
            _lvAvailable.HeaderStyle              = ColumnHeaderStyle.None;
            _lvAvailable.ShowContextMenu          = false;
            _lvAvailable.ExecuteDoubleClickAction = false;
            _lvAvailable.AllowDrop         = false;
            _lvAvailable.DoubleClick      += new HandledEventHandler(OnAddListClick);
            _lvAvailable.SelectionChanged += new EventHandler(OnListSelectionChanged);

            WorkspaceManager    workspaceManager = Core.WorkspaceManager as WorkspaceManager;
            IResourceNodeFilter filter           = workspaceManager.GetAvailSelectorFilter(_resourceTypes [0]);

            if (filter != null)
            {
                _lvAvailable.Filters.Add(new TreeFilterJetWrapper(filter));
            }

            _edtFind           = new JetTextBox();
            _edtFind.EmptyText = "<type a name to find>";
            _edtFind.IncrementalSearchUpdated += new EventHandler(OnListIncSearch);

            //
            // _lvInWorkspace
            //
            _lvInWorkspace = new ResourceListView2();
            _lvInWorkspace.Columns.Add(new ResourceIconColumn());
            _lvInWorkspace.AddColumn(ResourceProps.DisplayName).AutoSize = true;

            _lvInWorkspace.HeaderStyle              = ColumnHeaderStyle.None;
            _lvInWorkspace.ShowContextMenu          = false;
            _lvInWorkspace.ExecuteDoubleClickAction = false;
            _lvInWorkspace.AllowDrop         = false;
            _lvInWorkspace.DoubleClick      += new HandledEventHandler(OnRemoveListClick);
            _lvInWorkspace.SelectionChanged += new EventHandler(OnListSelectionChanged);

            UpdateListSelection();

            Controls.AddRange(new Control[] { _lblAvailable, _edtFind, _lvAvailable,
                                              _btnAdd, _btnRemove, _lblProcessing,
                                              _lblInWorkspace, _lvInWorkspace });
        }
Beispiel #27
0
        /// <summary>
        /// Maintains the controls displayed in the list by keeping them in sync with the actual
        /// items in the combobox. (e.g. removing and adding as well as ordering)
        /// </summary>
        public void SynchroniseControlsWithComboBoxItems()
        {
            SuspendLayout();
            if (_CheckBoxComboBox._MustAddHiddenItem)
            {
                _CheckBoxComboBox.Items.Insert(
                    0, _CheckBoxComboBox.GetCSVText(false)); // INVISIBLE ITEM
                _CheckBoxComboBox.SelectedIndex      = 0;
                _CheckBoxComboBox._MustAddHiddenItem = false;
            }
            Controls.Clear();
            #region Disposes all items that are no longer in the combo box list

            for (int Index = _Items.Count - 1; Index >= 0; Index--)
            {
                CheckBoxComboBoxItem Item = _Items[Index];
                if (!_CheckBoxComboBox.Items.Contains(Item.ComboBoxItem))
                {
                    _Items.Remove(Item);
                    Item.Dispose();
                }
            }

            #endregion
            #region Recreate the list in the same order of the combo box items

            bool HasHiddenItem =
                _CheckBoxComboBox.DropDownStyle == ComboBoxStyle.DropDownList &&
                _CheckBoxComboBox.DataSource == null &&
                !DesignMode;

            CheckBoxComboBoxItemList NewList = new CheckBoxComboBoxItemList(_CheckBoxComboBox);
            for (int Index0 = 0; Index0 <= _CheckBoxComboBox.Items.Count - 1; Index0++)
            {
                object Object             = _CheckBoxComboBox.Items[Index0];
                CheckBoxComboBoxItem Item = null;
                // The hidden item could match any other item when only
                // one other item was selected.
                if (Index0 == 0 && HasHiddenItem && _Items.Count > 0)
                {
                    Item = _Items[0];
                }
                else
                {
                    int StartIndex = HasHiddenItem
                        ? 1 // Skip the hidden item, it could match
                        : 0;
                    for (int Index1 = StartIndex; Index1 <= _Items.Count - 1; Index1++)
                    {
                        if (_Items[Index1].ComboBoxItem == Object)
                        {
                            Item = _Items[Index1];
                            break;
                        }
                    }
                }
                if (Item == null)
                {
                    Item = new CheckBoxComboBoxItem(_CheckBoxComboBox, Object);
                    Item.ApplyProperties(_CheckBoxComboBox.CheckBoxProperties);
                }
                NewList.Add(Item);
                Item.Dock = DockStyle.Top;
            }
            _Items.Clear();
            _Items.AddRange(NewList);

            #endregion
            #region Add the items to the controls in reversed order to maintain correct docking order

            if (NewList.Count > 0)
            {
                // This reverse helps to maintain correct docking order.
                NewList.Reverse();
                // If you get an error here that "Cannot convert to the desired
                // type, it probably means the controls are not binding correctly.
                // The Checked property is binded to the ValueMember property.
                // It must be a bool for example.
                Controls.AddRange(NewList.ToArray());
            }

            #endregion

            // Keep the first item invisible
            if (_CheckBoxComboBox.DropDownStyle == ComboBoxStyle.DropDownList &&
                _CheckBoxComboBox.DataSource == null &&
                !DesignMode)
            {
                _CheckBoxComboBox.CheckBoxItems[0].Visible = false;
            }

            ResumeLayout();
        }
Beispiel #28
0
        private void ResultForm_Load(object sender, EventArgs e)
        {
            SuspendLayout();
            for (int i = 0; i < 6; i++)
            {
                for (int j = 0; j < 6; j++)
                {
                    int scale = 150;
                    int num   = 6 * i + j;
                    pictureBoxes[num]          = new PictureBox();
                    pictureBoxes[num].Name     = "pictureBox" + (6 * i + j).ToString();
                    pictureBoxes[num].Size     = new Size(scale, scale);
                    pictureBoxes[num].Location = new Point(j * scale, i * scale);
                    Bitmap canvas = new Bitmap(pictureBoxes[num].Width, pictureBoxes[num].Height);

                    Graphics g = Graphics.FromImage(canvas);

                    Point[] dash = { new Point(scale / 2, scale / 4),
                                     new Point(scale / 4, scale / 2),new Point(scale / 2,  scale * 3 / 4), new Point(scale * 3 / 4, scale / 2) };
                    double  abs = Math.Abs(Agent.Q[j + 1, i + 1, 1]);
                    // Qの絶対値のMaxを決める
                    for (int k = 2; k < 5; k++)
                    {
                        double newabs = Math.Abs(Agent.Q[j + 1, i + 1, k]);
                        if (newabs > abs)
                        {
                            abs = newabs;
                        }
                    }
                    double  rate = scale / 8.0;
                    Point[] q    =
                    {
                        new Point(scale / 2,                           scale / 4 - (int)(Agent.Q[j + 1,     i + 1,      1] * rate)),
                        new Point(scale * 3 / 4 + (int)(Agent.Q[j + 1, i + 1,                               2] * rate), scale / 2),
                        new Point(scale / 2,                           scale * 3 / 4 + (int)(Agent.Q[j + 1, i + 1,      4] * rate)),
                        new Point(scale / 4 - (int)(Agent.Q[j + 1,     i + 1,                               3] * rate), scale / 2)
                    };
                    Pen dashPen = new Pen(Color.Black, 1);
                    dashPen.DashStyle = DashStyle.Dash;
                    g.DrawPolygon(dashPen, dash);
                    g.DrawPolygon(Pens.Black, q);
                    var font  = new Font("MS UI Gothinc", 8);
                    var round = 2;
                    g.DrawString(Math.Round(Agent.Q[j + 1, i + 1, 1], round).ToString(), font, Brushes.Blue, scale / 2 - 10, 10);
                    g.DrawString(Math.Round(Agent.Q[j + 1, i + 1, 2], round).ToString(), font, Brushes.Blue, scale / 2 + 20, scale / 2 - 5);
                    g.DrawString(Math.Round(Agent.Q[j + 1, i + 1, 3], round).ToString(), font, Brushes.Blue, 15, scale / 2 - 5);
                    g.DrawString(Math.Round(Agent.Q[j + 1, i + 1, 4], round).ToString(), font, Brushes.Blue, scale / 2 - 5, scale * 3 / 4);
                    g.DrawString(Agent.visit[j + 1, i + 1].ToString(), new Font("MS UI Gothinc", 9), Brushes.Red, scale / 2 - 15, scale / 2 - 20);
                    var rect = new Rectangle(0, 0, scale, scale);
                    if (Agent.Stage[j + 1, i + 1] < 0)
                    {
                        g.FillRectangle(Brushes.Brown, rect);
                    }
                    if (Agent.Stage[j + 1, i + 1] == 2)
                    {
                        g.FillRectangle(Brushes.White, rect);
                        g.DrawString("G1", font, Brushes.Blue, scale / 2 - 10, scale / 2 - 10);
                    }
                    if (Agent.Stage[j + 1, i + 1] == 1)
                    {
                        g.FillRectangle(Brushes.White, rect);
                        g.DrawString("G2", font, Brushes.Blue, scale / 2 - 10, scale / 2 - 10);
                    }
                    g.Dispose();
                    pictureBoxes[num].Image = canvas;
                }
            }
            Controls.AddRange(pictureBoxes);
            ResumeLayout(false);
        }
Beispiel #29
0
 /// <summary>
 /// Creates new instance.
 /// </summary>
 public GridPanel(string name, params Control[] controls)
 {
     Name = name;
     Controls.AddRange(controls);
 }
Beispiel #30
0
    public FormText()
    {
        ci = new CultureInfo("pt-BR");

        Thread.CurrentThread.CurrentUICulture = ci;

        rm     = ResourceManager.CreateFileBasedResourceManager("Form", ".", null);
        rmImgs = new ResourceManager("Images", typeof(FormText).Assembly);

        btn_ptBR = new Button();
        btn_enUS = new Button();
        btn_itIT = new Button();
        lblText  = new Label();
        timer    = new System.Windows.Forms.Timer();
        btnFont  = new Button();
        txtText  = new TextBox();
        lblTime  = new Label();
        fd       = new FontDialog();
        picBox   = new PictureBox();

        btn_ptBR.Location = new Point(32, 120);
        btn_ptBR.TabIndex = 1;
        btn_ptBR.Text     = "pt-BR";

        btn_enUS.Location = new Point(112, 120);
        btn_enUS.TabIndex = 1;
        btn_enUS.Text     = "en-US";

        btn_itIT.Location = new Point(192, 120);
        btn_itIT.TabIndex = 2;
        btn_itIT.Text     = "it-IT";

        lblText.Location = new Point(8, 16);
        lblText.Size     = new Size(280, 40);
        lblText.TabIndex = 3;

        timer.Enabled  = true;
        timer.Interval = 1000;

        btnFont.Location = new Point(8, 88);
        btnFont.TabIndex = 4;

        txtText.Location = new Point(8, 64);
        txtText.Size     = new Size(280, 20);
        txtText.TabIndex = 0;

        lblTime.BorderStyle = BorderStyle.Fixed3D;
        lblTime.Location    = new Point(32, 152);
        lblTime.Size        = new Size(232, 23);
        lblTime.TextAlign   = ContentAlignment.MiddleCenter;

        fd.ShowColor = true;
        fd.ShowApply = true;

        picBox.Location = new Point(8, 184);
        picBox.Size     = new Size(280, 80);
        picBox.Image    = (Image)rmImgs.GetObject("VSIMG");
        picBox.SizeMode = PictureBoxSizeMode.StretchImage;

        ClientSize      = new Size(292, 268);
        FormBorderStyle = FormBorderStyle.FixedToolWindow;

        Control[] controls = new Control[]
        {
            btn_ptBR, btn_enUS, btn_itIT, lblText,
            btnFont, txtText, lblTime, picBox
        };

        Controls.AddRange(controls);

        timer.Tick += new EventHandler(timer_Tick);

        btnFont.Click += new EventHandler(btnFont_Click);

        fd.Apply += new EventHandler(fontDialog_Apply);

        txtText.TextChanged += new EventHandler(txtText_TextChanged);

        btn_ptBR.Click += new EventHandler(btn_Translate);
        btn_enUS.Click += new EventHandler(btn_Translate);
        btn_itIT.Click += new EventHandler(btn_Translate);

        Translate();
    }