Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Set the <code>ToolStripButton.CheckOnClick</code> property to <code>True</code>. (It's found in the <code>Behavior</code> section of the <code>Items Collection Editor</code>.)</p> <p>This makes clicking it just like toggling the <code>Down</code> property in a Delphi <code>TSpeedButton</code> (making it flat or depressed), and <code>if ToolStripButton1.Checked</code> is the equivalent of <code>if SpeedButton1.Down</code> in Delphi.</p> <p>To set up the test, I did the following:</p> <ul> <li>Created a new Winforms application</li> <li>Dropped a <code>ToolStrip</code> onto the new <code>MainForm</code></li> <li>Added four <code>ToolStripButton</code> items and gave them images to make them easier to see.</li> <li>Set the <code>CheckOnClick</code> property to <code>True</code> for each of them</li> <li>Set the <code>Checked</code> property of <code>toolStripButton1</code> to <code>True</code>;</li> <li><p>Added the code below to <code>toolStripButton1.Click</code></p> <p>method MainForm.toolStripButton1_Click(sender: System.Object; e: System.EventArgs); begin toolStripButton2.Checked := not toolStripButton2.Checked; toolStripButton4.Checked := toolStripButton2.Checked; end;</p></li> </ul> <p>Running the app (initial startup, <code>toolStripButton1</code> checked and the others unchecked):</p> <p><img src="https://i.stack.imgur.com/AT3vz.png" alt="One button down"></p> <p>The first button is clearly down, and the rest are up.</p> <p>After clicking <code>toolStripButton1</code> once:</p> <p><img src="https://i.stack.imgur.com/RDEbN.png" alt="Two buttons down"></p> <p>The first button is now up (unchecked) and the second and fourth are down (checked). (I should pay more attention to the consistency in sizing if I do successive images in future posts.)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload