public void addTo(Control.ControlCollection controls) { controls.Add(depthTextBox); controls.Add(statusLabel); controls.Add(amountTextBox); controls.Add(deleteCheckBox); }
/// <summary> /// Construct a new check box with no key button. /// </summary> /// <param name="location"></param> /// <param name="name"></param> /// <param name="isChecked"></param> /// <param name="OnButtonChecked"></param> /// <param name="OnButtonUnchecked"></param> public CheckBox( Control.ControlCollection controls, Point location, string name, bool isChecked, Lambda OnButtonChecked, Lambda OnButtonUnchecked) { box = new System.Windows.Forms.CheckBox(); box.AutoSize = true; box.Location = location; box.Checked = isChecked; box.Name = name; box.Size = new System.Drawing.Size(80, 17); box.TabIndex = 0; box.Text = name; box.UseVisualStyleBackColor = true; // Anonymous checked event handler -- callback to provided lambdas for check/uncheck behavior. box.CheckedChanged += delegate(Object sender, EventArgs e) { if (box.Checked) { OnButtonChecked(); } else { OnButtonUnchecked(); } }; controls.Add(box); }
public FormCubeLayerVisualiser( Control.ControlCollection parentControl, Point location, guiOptions p_GuiOptions, MainForm mainForm ) { int i = 0; this.location = location; this.GuiOptions = p_GuiOptions; this.dataPanel = new System.Windows.Forms.Panel(); this.dataPanel.Location = location; this.dataPanel.Name = "panel1"; this.dataPanel.Size = new System.Drawing.Size(320, 320); parentControl.Add(dataPanel); layerData = new PictureBox[100]; this.parentForm = mainForm; for (i = 0; i < 100; i++) { this.layerData[i] = new PictureBox(); this.layerData[i].Image = global::FadeCube.Properties.Resources.led_0; this.layerData[i].Location = new Point((i % 10) * 32, (i / 10) * 32); this.layerData[i].Name = "layerData" + i.ToString(); this.layerData[i].Size = new System.Drawing.Size(32, 32); this.layerData[i].TabIndex = 0; this.layerData[i].TabStop = false; this.layerData[i].SendToBack(); this.layerData[i].Click += new System.EventHandler(layerData_Click); dataPanel.Controls.Add(layerData[i]); } }
public override Control CreateControl(IRuleControlOwner owner, Control.ControlCollection collection, System.Drawing.Point pos) { RuleControl rc = new RuleControl(owner) {Location = pos}; rc.RestoreFromRule(this); DisposeControl(); ruleControl_ = rc; collection.Add(rc); return rc; }
public NumberFieldsTable(Control.ControlCollection Controls, Point location) { Fields = new NumberField[SIZE, SIZE]; for (int i = 0; i < SIZE; i++) for (int j = 0; j < SIZE; j++) { Fields[i, j] = new NumberField(i, j, location); Controls.Add(Fields[i, j]); } }
public override void CreateControls(Control.ControlCollection collection) { selectButton = new Button(); selectButton.Width = 150; selectButton.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_SELECT); selectButton.Enabled = false; selectButton.Click += new EventHandler(importButton_Click); collection.Add(selectButton); }
public override void CreateControls(Control.ControlCollection collection) { reworkButton = new Button(); reworkButton.Width = 150; reworkButton.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_REWORK); reworkButton.Enabled = false; reworkButton.Click += new EventHandler(reworkButton_Click); collection.Add(reworkButton); }
private static int Add(Control.ControlCollection Instance,IntPtr l) { // get method arguments int valueId = (int)LuaApi.lua_tonumber(l,3); Control value = LuaManager.Instance.GetObjectT<Control>(valueId); // call method Instance.Add(value); return 0; }
/// <summary> /// 动态增加一个button,指定显示的文本和点击事件执行的委托 /// </summary> /// <param name="Controls1">要增加的控件集合</param> /// <param name="text">button文本</param> /// <param name="buttonClickHandler1">绑定点击后执行的委托</param> /// <returns></returns> public Button addButton(Control.ControlCollection Controls1, string text,int buttonWidth,int buttonHeight, buttonClickHandler buttonClickHandler1) { Button Button1 = new Button(); Button1.Text = text; Button1.Size = new Size(buttonWidth, buttonHeight); Button1.Click += (sender,e) => { buttonClickHandler1(sender,e); }; Controls1.Add(Button1); return Button1; }
public static void displayFormOnPanel(Control.ControlCollection control, Form newForm) { bool isExist = control.Contains(newForm); if (isExist == false) { newForm.TopLevel = false; //设置为非顶级窗体 newForm.FormBorderStyle = FormBorderStyle.None; //设置窗体为非边框样式 newForm.Dock = System.Windows.Forms.DockStyle.Fill; //设置样式是否填充整个PANEL control.Add(newForm); //添加窗体 newForm.Show(); } newForm.BringToFront(); }
private TabControl MainTabControlDrawing(Control.ControlCollection Controls) { TabControl MainTabControl = new TabControl(); // 配置位置を設定 MainTabControl.Location = new System.Drawing.Point(10, 10); // Nameプロパティを設定 MainTabControl.Name = "tabControl"; // 選択されているタブページのインデックス取得 MainTabControl.SelectedIndex = 0; // サイズを設定 MainTabControl.Size = new System.Drawing.Size(340, 585); // TabIndexを設定 MainTabControl.TabIndex = 0; //MainTab表示 Controls.Add(MainTabControl); return MainTabControl; }
// The World constructor receives a reference to the Controls object so // it can add window elements (labels in this case) to the main screen public World(Control.ControlCollection controls, Color backColor, int rows, int columns, int colWidth, int rowHeight) { this.rows = rows; this.columns = columns; this.backColor = backColor; tiles = new Tile[rows, columns]; for (int row = 0; row < rows; row++) { for (int col = 0; col < columns; col++) { tiles[row, col].label = new Label(); tiles[row, col].label.AutoSize = false; tiles[row, col].label.BorderStyle = BorderStyle.FixedSingle; tiles[row, col].label.Location = new Point(col * colWidth, row * rowHeight); tiles[row, col].label.Size = new Size(colWidth, rowHeight); controls.Add(tiles[row, col].label); } } }
public RelationshipView(Control.ControlCollection collection, Essenishial one, Essenishial two, ErRelationshipConnectType firsType, ErRelationshipConnectType secType, ErDiagram Diagram ) { targetDiagram = Diagram; ErConnectEssencePair firstPair = new ErConnectEssencePair(one.Essence, firsType); ErConnectEssencePair secondPair = new ErConnectEssencePair(two.Essence, secType); targetRelationship = new ErRelationship(firstPair, secondPair); targetDiagram.AddRelationship(targetRelationship); oneEssenishial = one; twoEssenishial = two; one.OneOrTwoList.Add(1); two.OneOrTwoList.Add(2); OnePoint = one.GetCentralPoint(); TwoPoint = two.GetCentralPoint(); one.RelationshipViewList.Add(this); two.RelationshipViewList.Add(this); MiddlePoint = new Point((OnePoint.X + TwoPoint.X) / 2, (OnePoint.Y + TwoPoint.Y) / 2); containerOne = new ShapeContainer(); OneToMiddleLine = new LineShape(OnePoint.X, OnePoint.Y, MiddlePoint.X, MiddlePoint.Y); OneToMiddleLine.DoubleClick += OpenRelationshipEditorWindow; OneToMiddleLine.BorderWidth = 3; OneToMiddleLine.BorderStyle = GetLineStyle(firsType.ModalType); MiddelToTwoLine = new LineShape(MiddlePoint.X, MiddlePoint.Y, TwoPoint.X, TwoPoint.Y); MiddelToTwoLine.BorderWidth = 3; MiddelToTwoLine.DoubleClick += OpenRelationshipEditorWindow; MiddelToTwoLine.BorderStyle = GetLineStyle(secType.ModalType); containerOne.Shapes.Add(OneToMiddleLine); containerOne.Shapes.Add(MiddelToTwoLine); //shape. collection.Add(containerOne); }
public override Bullet shoot(Control.ControlCollection controls) { int xPos = 0, yPos = 0; switch (direction) { case Direction.Up: xPos = x + width / 2 - Bullet.width / 2; yPos = y; break; case Direction.Down: xPos = x + width / 2 - Bullet.width / 2; yPos = y + height; break; case Direction.Left: xPos = x; yPos = y + height / 2 - Bullet.height / 2; break; case Direction.Right: xPos = x + width; yPos = y + height / 2 - Bullet.height / 2; break; } Bullet bullet = new Bullet(xPos, yPos, direction); controls.Add(bullet.picture); return bullet; }
/// <summary> /// Construct a check box with a key button. /// </summary> /// <param name="location"></param> /// <param name="name"></param> /// <param name="key"></param> /// <param name="isChecked"></param> /// <param name="OnButtonChecked"></param> /// <param name="OnButtonUnchecked"></param> public CheckBox( Control.ControlCollection controls, Point location, string name, Key key, Point keyLocation, bool isChecked, Lambda OnButtonChecked, Lambda OnButtonUnchecked) : this(controls, location, name, isChecked, OnButtonChecked, OnButtonUnchecked) { // Add corresponding button System.Windows.Forms.Button button = new System.Windows.Forms.Button(); button.Location = keyLocation; button.Text = key.KeyString; button.Click += delegate(Object sender, EventArgs e) { new UserInputScreen((Action<Keys>)delegate(Keys argKey) { key.KeyString = argKey.ToString().ToLower(); button.Text = key.KeyString; }); }; controls.Add(button); }
public static void NewControl(Control.ControlCollection controls, ref UserControl oldControl, UserControl newControl) { controls.Remove(oldControl); oldControl = newControl; controls.Add(oldControl); }
// i think InitializePanel should be moved to some kind of Manager.cs class (iliyan) public virtual void InitializePanel(Control.ControlCollection controls) { //Control.ControlCollection Controls = controls; controls.Add(this.Panel); this.Panel.Location = this.LocationOnTableOnTable; this.Panel.BackColor = Color.DarkBlue; this.Panel.Height = PanelHeightDefault; this.Panel.Width = PanelWidthDefault; this.Panel.Visible = false; }
/// <summary> /// Adds new picture box to scene and sends bitmap + dimensions. /// </summary> /// <param name="c">Form control collection.</param> /// <param name="p">PictureBox to assign.</param> /// <param name="b">Bitmap to assign to PictureBox.</param> /// <param name="width">Image width.</param> /// <param name="height">Image height.</param> /// <param name="x">Position X.</param> /// <param name="y">Position Y.</param> private void SetPictureBox(Control.ControlCollection c, ref PictureBox p, ref Bitmap b, int width, int height, int x, int y) { b = new Bitmap(width, height); b.MakeTransparent(); p = new PictureBox(); p.Location = new System.Drawing.Point(x, y); p.Image = b; p.Size = new Size(width, height); p.BackColor = DColor.Transparent; p.Show(); c.Add(p); }
private void DealCardsToTable(ITable table, int startingDeckCardIndex, IList<ICard> shuffledDeck, Control.ControlCollection controls) { int currentTableX = Constants.TableCoordinateX; int currentTableY = Constants.TableCoordinateY; int distanceBetweenCards = Constants.CardWidth + (Constants.CardWidth / 2); int numberOfCardsOnTable = 5; int endingCardDeckIndex = startingDeckCardIndex + numberOfCardsOnTable; for (int i = startingDeckCardIndex; i < endingCardDeckIndex; i++) { table.TableCardsCollection.Add(shuffledDeck[i]); } for (int tableCardIndex = 0; tableCardIndex < table.TableCardsCollection.Count; tableCardIndex++) { table.TableCardsCollection[tableCardIndex].CardPictureBox.Height = Constants.CardHeight; table.TableCardsCollection[tableCardIndex].CardPictureBox.Width = Constants.CardWidth; table.TableCardsCollection[tableCardIndex].IsVisible = false; table.TableCardsCollection[tableCardIndex].CardPictureBox.Image = table.TableCardsCollection[tableCardIndex].BackImage; table.TableCardsCollection[tableCardIndex].CardPictureBox.Location = new Point(currentTableX, currentTableY); currentTableX += distanceBetweenCards; table.TableCardsCollection[tableCardIndex].CardPictureBox.SizeMode = PictureBoxSizeMode.StretchImage; controls.Add(table.TableCardsCollection[tableCardIndex].CardPictureBox); } }
public override void CreateControls(Control.ControlCollection collection) { Panel p = new Panel(); p.Width = 240; p.Height = 50; importButtonAll = new Button(); importButtonAll.Width = 190; importButtonAll.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_IMPORT_ALL); importButtonAll.Enabled = false; importButtonAll.Click += new EventHandler(importButton_Click); p.Controls.Add(importButtonAll); importLabelAll = new Label(); importLabelAll.Location = new System.Drawing.Point(importButtonAll.Width + 5, importButtonAll.Top); importLabelAll.Text = "(-)"; p.Controls.Add(importLabelAll); importButtonMissing = new Button(); importButtonMissing.Location = new System.Drawing.Point(importButtonAll.Left, importButtonAll.Bottom + 5); importButtonMissing.Width = 190; importButtonMissing.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_IMPORT_MISSING); importButtonMissing.Enabled = false; importButtonMissing.Click += new EventHandler(importButtonMissing_Click); p.Controls.Add(importButtonMissing); importLabelMissing = new Label(); importLabelMissing.Location = new System.Drawing.Point(importButtonMissing.Width + 5, importButtonMissing.Top); importLabelMissing.Text = "(-)"; p.Controls.Add(importLabelMissing); collection.Add(p); }
internal static void AddHeaderStrip( int current, Control.ControlCollection controlCollection) { Debug.Assert(current >= 0 && current < 4); Font defaultFont = new Font("Arial", 9.5F); Font boldFont = new Font("Arial", 9.5F, FontStyle.Bold); Font separatorFont = new Font("Arial", 12F); Color backColor = Program.TopStripBackColor; Color foreColor = Program.DisabledGreyColor; Label signInLabel = new Label(); signInLabel.Location = new Point(25, 24); signInLabel.AutoSize = true; signInLabel.Font = defaultFont; signInLabel.ForeColor = foreColor; signInLabel.BackColor = backColor; signInLabel.Text = Resources.SignInHeaderText; if (current == 0) { signInLabel.ForeColor = Control.DefaultForeColor; signInLabel.Font = boldFont; } controlCollection.Add(signInLabel); Label separator1 = new Label(); separator1.Location = new Point(signInLabel.Right + 2, 23); separator1.AutoSize = true; separator1.ForeColor = foreColor; separator1.BackColor = backColor; separator1.Font = separatorFont; separator1.Text = Resources.SeparatorText; controlCollection.Add(separator1); Label selectEmailLabel = new Label(); selectEmailLabel.Location = new Point(separator1.Right + 2, 24); selectEmailLabel.AutoSize = true; selectEmailLabel.Font = defaultFont; selectEmailLabel.ForeColor = foreColor; selectEmailLabel.BackColor = backColor; selectEmailLabel.Text = Resources.SelectHeaderText; if (current == 1) { selectEmailLabel.ForeColor = Control.DefaultForeColor; selectEmailLabel.Font = boldFont; } controlCollection.Add(selectEmailLabel); Label separator2 = new Label(); separator2.Location = new Point(selectEmailLabel.Right + 2, 23); separator2.AutoSize = true; separator2.ForeColor = foreColor; separator2.BackColor = backColor; separator2.Font = separatorFont; separator2.Text = Resources.SeparatorText; controlCollection.Add(separator2); Label labelLabel = new Label(); labelLabel.Location = new Point(separator2.Right + 2, 24); labelLabel.AutoSize = true; labelLabel.ForeColor = foreColor; labelLabel.BackColor = backColor; labelLabel.Font = defaultFont; labelLabel.Text = Resources.LabelHeaderText; if (current == 2) { labelLabel.ForeColor = Control.DefaultForeColor; labelLabel.Font = boldFont; } controlCollection.Add(labelLabel); Label separator3 = new Label(); separator3.Location = new Point(labelLabel.Right + 2, 23); separator3.AutoSize = true; separator3.ForeColor = foreColor; separator3.BackColor = backColor; separator3.Font = separatorFont; separator3.Text = Resources.SeparatorText; controlCollection.Add(separator3); Label uploadLabel = new Label(); uploadLabel.Location = new Point(separator3.Right + 2, 24); uploadLabel.AutoSize = true; uploadLabel.ForeColor = foreColor; uploadLabel.BackColor = backColor; uploadLabel.Font = defaultFont; uploadLabel.Text = Resources.UploadHeaderText; if (current == 3) { uploadLabel.ForeColor = Control.DefaultForeColor; uploadLabel.Font = boldFont; } controlCollection.Add(uploadLabel); }
static public Label AddDescription( ref int locationX, ref int locationY, int width, string description, Control.ControlCollection controls, bool bBold) { Label label = CreateLabel(locationX, locationY, width, 16, "", description, bBold); label.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; Graphics gfx = label.CreateGraphics(); SizeF sf = gfx.MeasureString(description, label.Font, width); label.Height = (int)sf.Height + 4; controls.Add(label); locationY = label.Bottom; return label; }
public override void CreateControls(Control.ControlCollection collection) { Panel p = new Panel(); p.Width = 240; p.Height = 110; saveButton = new Button(); saveButton.Width = 190; saveButton.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_SAVE); saveButton.Enabled = false; saveButton.Click += new EventHandler(saveButton_Click); p.Controls.Add(saveButton); resoreButton = new Button(); resoreButton.Location = new System.Drawing.Point(saveButton.Left, saveButton.Bottom + 5); resoreButton.Width = saveButton.Width; resoreButton.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_RESTORE); resoreButton.Enabled = false; resoreButton.Click += new EventHandler(resoreButton_Click); p.Controls.Add(resoreButton); createButton = new Button(); createButton.Location = new System.Drawing.Point(resoreButton.Left, resoreButton.Bottom + 5); createButton.Width = saveButton.Width; createButton.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_CREATE); createButton.Enabled = false; createButton.Click += new EventHandler(createButton_Click); p.Controls.Add(createButton); deleteButton = new Button(); deleteButton.Location = new System.Drawing.Point(createButton.Left, createButton.Bottom + 5); deleteButton.Width = saveButton.Width; deleteButton.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_DELETE); deleteButton.Enabled = false; deleteButton.Click += new EventHandler(deleteButton_Click); p.Controls.Add(deleteButton); collection.Add(p); }
// Returns the height of the legend, if any internal int InsertAdditionalLegend (Control.ControlCollection controls) { if (_valueType == VALUE_SCALAR_STRING_ARRAY) { Label l = new Label(); l.Dock = DockStyle.Top; l.Text = StringParser.Parse("${res:ComponentInspector.ParamControlInfo.SeparateStringsWithSpaces}"); l.AutoSize = true; controls.Add(l); return l.Height; } return 0; }
private void AddPropertyPanelToForm(Control.ControlCollection controls, Panel panel, bool readOnly) { controls.Add(panel); panel.Dock = DockStyle.Fill; foreach (Control item in panel.Controls) if (item is TextBox) { ((TextBox)item).ReadOnly = readOnly; //((TextBox)item).ForeColor = SystemColors.GrayText; } else item.Enabled = !readOnly; }
private void GiveCard(ICharacter character, int handCardIndex, IList<ICard> shuffledDeck, int deckCardIndex, Control.ControlCollection controls, bool isVisible = false) { character.CharacterCardsCollection.Add(shuffledDeck[deckCardIndex]); character.CharacterCardsCollection[handCardIndex].CardPictureBox.Height = Constants.CardHeight; character.CharacterCardsCollection[handCardIndex].CardPictureBox.Width = Constants.CardWidth; character.CharacterCardsCollection[handCardIndex].IsVisible = isVisible; if (character.CharacterCardsCollection[handCardIndex].IsVisible) { character.CharacterCardsCollection[handCardIndex].CardPictureBox.Image = character.CharacterCardsCollection[handCardIndex].FrontImage; } else { character.CharacterCardsCollection[handCardIndex].CardPictureBox.Image = character.CharacterCardsCollection[handCardIndex].BackImage; } if (handCardIndex == 0) { character.CharacterCardsCollection[handCardIndex].CardPictureBox.Location = character.FirstCardLocation; } else { character.CharacterCardsCollection[handCardIndex].CardPictureBox.Location = character.SecondCardLocation; } character.CharacterCardsCollection[handCardIndex].CardPictureBox.SizeMode = PictureBoxSizeMode.StretchImage; controls.Add(character.CharacterCardsCollection[handCardIndex].CardPictureBox); }
/// <summary> /// Replaces the controls in the form that was generated by the gui designer /// </summary> /// <param name="controls">The controls container which contains the controls that are to be replaced</param> /// <param name="originalControl">The control to replace</param> /// <param name="replacement">The replacement</param> protected static void ReplaceControl(Control.ControlCollection controls, Control originalControl, Control replacement) { if (originalControl == null) return; var location = originalControl.Location; var originalSize = originalControl.Size; var tabIndex = originalControl.TabIndex; controls.Remove(originalControl); if (replacement != null) { controls.Add(replacement); replacement.Location = location; replacement.Size = originalSize; replacement.TabIndex = tabIndex; } }
/// <summary> /// Updates the specified controls. /// </summary> /// <param name="controls">The controls.</param> public void Update(Control.ControlCollection controls) { if (this.IsVisible) { this.CardPictureBox.Image = this.FrontImage; } else { this.CardPictureBox.Image = this.BackImage; } controls.Add(this.CardPictureBox); }