private void checkBoxsac_MouseDown(object sender, MouseEventArgs e) { CheckBoxCustom c = sender as CheckBoxCustom; SetToggle(c, !c.Checked, e.Button == MouseButtons.Right); DisplayKeyString(); }
bool hiddenmarkershouldbeshown = false; // if to show it now public RollUpPanel() { SuspendLayout(); this.Height = UnrolledHeight; pinbutton = new CheckBoxCustom(); pinbutton.Appearance = Appearance.Normal; pinbutton.FlatStyle = FlatStyle.Popup; pinbutton.Size = new Size(24, 24); pinbutton.Image = ExtendedControls.Properties.Resources.pindownwhite2; //colours 222 and 255 used pinbutton.ImageUnchecked = ExtendedControls.Properties.Resources.pinupwhite2; pinbutton.Checked = true; pinbutton.CheckedChanged += Pinbutton_CheckedChanged; pinbutton.Name = "RUP Pinbutton"; hiddenmarker = new DrawnPanelNoTheme(); hiddenmarker.Name = "Hidden marker"; hiddenmarker.Location = new Point(0, 0); hiddenmarker.ImageSelected = DrawnPanel.ImageType.Bars; hiddenmarker.Size = new Size(100, 3); hiddenmarker.Visible = false; hiddenmarker.Click += Hiddenmarker_Click; Controls.Add(pinbutton); Controls.Add(hiddenmarker); ResumeLayout(); mode = Mode.None; timer = new Timer(); timer.Tick += Timer_Tick; pinbutton.Visible = false; }
private void SetToggle(CheckBoxCustom c, bool ch, bool right) { c.Checked = ch; string last = c.Text.Split(' ').Last(); if (right) { c.Text = ((c.Checked) ? "Right" : "") + " " + last; } else { c.Text = ((c.Checked) ? "Left" : "") + " " + last; } }