Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Firstly <code>GetTabRect</code> doesn't do what you've thought it does. It gets the bounding rectangle of the control, which is the size of a rectangle that completely encloses the control. This isn't a 'control' that has a colour etc its a property of the <code>TabControl</code>.</p> <p>As I've understood your question you've got lots of controls on the tab and you want to highlight some of them when the mouse is over them?</p> <p>If so the easiest way is to use a container control (<code>FlowLayoutPanel</code>, <code>Panel</code>, <code>SplitContainer</code>, <code>TableLayoutPanel</code>) and place your controls in that.</p> <p>I've created a basic form with a tab control and a panel control on the tab. The following code changes the background colour when the mouse enters or leaves the panel control edges. You don't need to wire up the <code>MouseEnter</code>, <code>MouseLeave</code> events in code if you don't want to...the designer will show you which controls have these events and wire them up in the <code>InitializeComponent()</code> code.</p> <pre><code> public Form1() { InitializeComponent(); panel1.MouseEnter += new EventHandler(panel1_MouseEnter); panel1.MouseLeave += new EventHandler(panel1_MouseLeave); } void panel1_MouseLeave(object sender, EventArgs e) { panel1.BackColor = Color.Red; } void panel1_MouseEnter(object sender, EventArgs e) { panel1.BackColor = Color.PaleGoldenrod; } </code></pre> <p>If I've misunderstood and you want to highlight the actual <code>TabControl</code> some how then, as this control doesn't have any colour properties at all, you will need to either put the TabControl inside another control (like Panel), or as suggested manually draw on the form (within the OnPaint event). I wouldn't recommend this route as it can get quite complicated and can have lots of performance issues.</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. This table or related slice is empty.
    1. This table or related slice is empty.
    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