|
-
Mar 20th, 2003, 07:50 AM
#1
Thread Starter
Member
Toolbar troubles.
Hi,
I've created a simple toolbar with 16x16 pixel buttons. The buttons appearance property is set to Flat, 'cos I wanted to do them similar to internet explorer type buttons.
The normal images are grey and when I hover over the buttons an active colour image is shown.
But the method i have used, means the tooltips text is not displayed. Am I doing things in a funny way and is there a better way of doing this, or alternatively how can I mae it work and also show tooltips text.
Below is my code.
On mouseMove the images are first reset to the grey ones.
Then if the mouse (which i turned the co-ords into a rect) is over a button, it selects a colour image on the button.
private void tlbRuleScript_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
tlbRuleScript.Buttons[0].ImageIndex = 6;
tlbRuleScript.Buttons[1].ImageIndex = 7;
tlbRuleScript.Buttons[3].ImageIndex = 8;
Rectangle MouseRect = new Rectangle(e.X,e.Y,1,1);
if (tlbRuleScript.Buttons[0].Rectangle.IntersectsWith(MouseRect))
tlbRuleScript.Buttons[0].ImageIndex = 0;
if (tlbRuleScript.Buttons[1].Rectangle.IntersectsWith(MouseRect))
tlbRuleScript.Buttons[1].ImageIndex = 1;
if (tlbRuleScript.Buttons[3].Rectangle.IntersectsWith(MouseRect))
tlbRuleScript.Buttons[3].ImageIndex = 2;
}
to restore the grey images I have added the following code to the MouseLeave event of the toolbar
private void tlbRuleScript_MouseLeave(object sender, System.EventArgs e)
{
tlbRuleScript.Buttons[0].ImageIndex = 6;
tlbRuleScript.Buttons[1].ImageIndex = 7;
tlbRuleScript.Buttons[3].ImageIndex = 8;
}
When hovering the mouse over the buttons, I also get a bit of flicker.
Why can't I see the tooltips text (which I have set correctly) or am I doing this wrong and how can I fix it?
Please help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|