Click here to Skip to main content
11,715,022 members (64,481 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# User-controls UI
Hello,

I would like to create a button (with an image on it) in c# User Control. When a user hovers with the mouse over the button, and stays there for a second, I would like a small message\dialog\something like this to pop up and describe in 2 words what the button is. (For example, it will write "edit" for an Edit Text button).

When the user moves the mouse from this button, I want this message to disappear.

How can I do it?

Thanks
Posted 22-Oct-12 3:19am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

I think this would be the perfect solution for you:

private void ButtonName_MouseHover(object sender, EventArgs e)
        {
            System.Windows.Forms.ToolTip ToolTip1 = new System.Windows.Forms.ToolTip();
            ToolTip1.SetToolTip(this.button1, this.button1.Text);
        }

Hope it helps... \m/
  Permalink  
Comments
ridoy at 22-Oct-12 12:51pm
   
+5
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

1. Add image to BackgroundImage property of button.

2. Add a tooltip to the button.
3. Find the property 'ToolTip on toolTip1' (the name may not be toolTip1 if you changed it's default name).Now write "Edit"(as according to your requirement or anything you write will be popped out) on the tooltip property of button.

Now if you want this manually use this as under-.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
 
namespace WindowsFormsApplication29
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        ToolTip t1 = new ToolTip();
        private void button1_MouseHover(object sender, EventArgs e)
        {
            t1.Show("Edit",button1);
        }
    }
}
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Use TOOL TIP Property of the button.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 530
1 Richard MacCutchan 275
2 Maciej Los 259
3 ManasKumarM 155
4 Frankie-C 115
0 Sergey Alexandrovich Kryukov 775
1 CHill60 415
2 Richard MacCutchan 405
3 Maciej Los 389
4 OriginalGriff 320


Advertise | Privacy | Mobile
Web01 | 2.8.150901.1 | Last Updated 22 Oct 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100