private void AngleDropDownMenu_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) { if (this != _lastSelected) { return; } switch (e.ClickedItem.Text) { case "Recommended": _angleViewMode = AngleViewModeType.Recommended; break; case "Unsigned (short)": _angleViewMode = AngleViewModeType.Unsigned; break; case "Signed (short)": _angleViewMode = AngleViewModeType.Signed; break; case "Degrees": _angleViewMode = AngleViewModeType.Degrees; break; case "Radians": _angleViewMode = AngleViewModeType.Radians; break; } }
public AngleDataContainer(string name, AngleViewModeType angleViewMode = AngleViewModeType.Unsigned) { _specialName = name; _angleViewMode = angleViewMode; this._nameLabel = new Label(); this._nameLabel.Size = new Size(210, 20); this._nameLabel.Text = name; this._nameLabel.Margin = new Padding(3, 3, 3, 3); this._textBoxValue = new TextBox(); this._textBoxValue.ReadOnly = true; this._textBoxValue.BorderStyle = BorderStyle.None; this._textBoxValue.TextAlign = HorizontalAlignment.Right; this._textBoxValue.Width = 200; this._textBoxValue.Margin = new Padding(6, 3, 6, 3); this._textBoxValue.ContextMenuStrip = AngleMenu; this._textBoxValue.MouseEnter += _textBoxValue_MouseEnter; this._tablePanel = new BorderedTableLayoutPanel(); this._tablePanel.Size = new Size(230, _nameLabel.Height + 2); this._tablePanel.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single; this._tablePanel.RowCount = 1; this._tablePanel.ColumnCount = 2; this._tablePanel.RowStyles.Clear(); this._tablePanel.RowStyles.Add(new RowStyle(SizeType.Absolute, _nameLabel.Height + 3)); this._tablePanel.ColumnStyles.Clear(); this._tablePanel.Margin = new Padding(0); this._tablePanel.Padding = new Padding(0); this._tablePanel.ShowBorder = false; this._tablePanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 120)); this._tablePanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 110)); this._tablePanel.Controls.Add(_nameLabel, 0, 0); this._tablePanel.Controls.Add(this._textBoxValue, 1, 0); AngleMenu.ItemClicked += OnMenuStripClick; AngleDropDownMenu[0].DropDownItemClicked += AngleDropDownMenu_DropDownItemClicked; AngleDropDownMenu[1].Click += TruncateAngleMenu_ItemClicked; AngleDropDownMenu[2].Click += AngleDataContainer_Click; }