コード例 #1
0
 private void _textBoxValue_MouseEnter(object sender, EventArgs e)
 {
     _lastSelected = this;
     if (_watchVar.IsAngle)
     {
         (AngleMenu.Items["HexView"] as ToolStripMenuItem).Checked            = _watchVar.UseHex;
         (AngleMenu.Items["LockValue"] as ToolStripMenuItem).Checked          = GetIsLocked();
         (AngleDropDownMenu[0].DropDownItems[0] as ToolStripMenuItem).Checked = (_angleViewMode == AngleViewModeType.Recommended);
         (AngleDropDownMenu[0].DropDownItems[1] as ToolStripMenuItem).Checked = (_angleViewMode == AngleViewModeType.Unsigned);
         (AngleDropDownMenu[0].DropDownItems[2] as ToolStripMenuItem).Checked = (_angleViewMode == AngleViewModeType.Signed);
         (AngleDropDownMenu[0].DropDownItems[3] as ToolStripMenuItem).Checked = (_angleViewMode == AngleViewModeType.Degrees);
         (AngleDropDownMenu[0].DropDownItems[4] as ToolStripMenuItem).Checked = (_angleViewMode == AngleViewModeType.Radians);
         (AngleDropDownMenu[1] as ToolStripMenuItem).Checked = _angleTruncated;
     }
     else
     {
         (Menu.Items["HexView"] as ToolStripMenuItem).Checked   = _watchVar.UseHex;
         (Menu.Items["LockValue"] as ToolStripMenuItem).Checked = GetIsLocked();
     }
 }
コード例 #2
0
        private void _textBoxValue_MouseEnter(object sender, EventArgs e)
        {
            var lockedStatus = CheckState.Unchecked;

            if (OffsetList.Any(o => GetIsLocked(o)))
            {
                if (OffsetList.All(o => GetIsLocked(o)))
                {
                    lockedStatus = CheckState.Checked;
                }
                else
                {
                    lockedStatus = CheckState.Indeterminate;
                }
            }

            _lastSelected = this;
            if (_watchVar.IsAngle)
            {
                (AngleMenu.Items["HexView"] as ToolStripMenuItem).Checked            = _watchVar.UseHex;
                (AngleMenu.Items["LockValue"] as ToolStripMenuItem).CheckState       = lockedStatus;
                (AngleMenu.Items["Highlight"] as ToolStripMenuItem).Checked          = _tablePanel.ShowBorder;
                (AngleDropDownMenu[0].DropDownItems[0] as ToolStripMenuItem).Checked = (_angleViewMode == AngleViewModeType.Recommended);
                (AngleDropDownMenu[0].DropDownItems[1] as ToolStripMenuItem).Checked = (_angleViewMode == AngleViewModeType.Unsigned);
                (AngleDropDownMenu[0].DropDownItems[2] as ToolStripMenuItem).Checked = (_angleViewMode == AngleViewModeType.Signed);
                (AngleDropDownMenu[0].DropDownItems[3] as ToolStripMenuItem).Checked = (_angleViewMode == AngleViewModeType.Degrees);
                (AngleDropDownMenu[0].DropDownItems[4] as ToolStripMenuItem).Checked = (_angleViewMode == AngleViewModeType.Radians);
                (AngleDropDownMenu[1] as ToolStripMenuItem).Checked = _angleTruncated;
            }
            else
            {
                (Menu.Items["HexView"] as ToolStripMenuItem).Checked      = _watchVar.UseHex;
                (Menu.Items["LockValue"] as ToolStripMenuItem).CheckState = lockedStatus;
                (Menu.Items["Highlight"] as ToolStripMenuItem).Checked    = _tablePanel.ShowBorder;
                ObjectDropDownMenu.ForEach(d => Menu.Items.Remove(d));
                if (_watchVar.IsObject)
                {
                    ObjectDropDownMenu.ForEach(d => Menu.Items.Add(d));
                }
            }
        }
コード例 #3
0
        private void CreateControls()
        {
            this._nameLabel             = new Label();
            this._nameLabel.Size        = new Size(210, 20); //TODO check this
            this._nameLabel.Text        = _watchVar.Name;
            this._nameLabel.Margin      = new Padding(3, 3, 3, 3);
            this._nameLabel.Click      += _nameLabel_Click;
            this._nameLabel.ImageAlign  = ContentAlignment.MiddleRight;
            this._nameLabel.MouseHover += (sender, e) =>
            {
                if (!_watchVar.HasAdditiveOffset)
                {
                    AddressToolTip.SetToolTip(this._nameLabel, String.Format("0x{0:X8} [{2} + 0x{1:X8}]",
                                                                             _watchVar.GetRamAddress(), _watchVar.GetProcessAddress(), Config.Stream.ProcessName));
                }
                else
                {
                    AddressToolTip.SetToolTip(this._nameLabel, String.Format("0x{1:X8} + 0x{0:X8} = 0x{2:X8} [{4} + 0x{3:X8}]",
                                                                             _watchVar.GetRamAddress(0, false), OffsetList[0], _watchVar.GetRamAddress(OffsetList[0]),
                                                                             _watchVar.GetProcessAddress(OffsetList[0]), Config.Stream.ProcessName));
                }
            };

            if (_watchVar.IsBool)
            {
                this._checkBoxBool                 = new CheckBox();
                this._checkBoxBool.CheckAlign      = ContentAlignment.MiddleRight;
                this._checkBoxBool.CheckState      = CheckState.Unchecked;
                this._checkBoxBool.CheckedChanged += OnEdited;
                this._checkBoxBool.MouseEnter     += (sender, e) =>
                {
                    _lastSelected = this;
                    (CheckMenu.Items["Highlight"] as ToolStripMenuItem).Checked = _tablePanel.ShowBorder;
                };
                this._checkBoxBool.ContextMenuStrip = WatchVariableControl.CheckMenu;
            }
            else
            {
                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.TextChanged     += OnEdited;
                this._textBoxValue.ContextMenuStrip = _watchVar.IsAngle ? WatchVariableControl.AngleMenu : WatchVariableControl.Menu;
                this._textBoxValue.KeyDown         += OnTextValueKeyDown;
                this._textBoxValue.MouseEnter      += _textBoxValue_MouseEnter;
                this._textBoxValue.DoubleClick     += _textBoxValue_DoubleClick;
                this._textBoxValue.Leave           += (sender, e) => { EditMode = false; };
                if (_watchVar.IsAngle)
                {
                    WatchVariableControl.AngleMenu.ItemClicked += OnMenuStripClick;
                    WatchVariableControl.AngleDropDownMenu[0].DropDownItemClicked += AngleDropDownMenu_DropDownItemClicked;
                    WatchVariableControl.AngleDropDownMenu[1].Click += TruncateAngleMenu_ItemClicked;
                }
                else
                {
                    WatchVariableControl.Menu.ItemClicked += OnMenuStripClick;
                }
            }

            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.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 120));
            this._tablePanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 110));
            this._tablePanel.ShowBorder = false;
            this._tablePanel.Controls.Add(_nameLabel, 0, 0);
            this._tablePanel.Controls.Add(_watchVar.IsBool ? this._checkBoxBool as Control : this._textBoxValue, 1, 0);
        }