Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Using the drawString method on a MouseEnter Event.

Posted on 2004-04-24
3
Medium Priority
?
297 Views
Last Modified: 2012-06-27
Hi.

I would like to know how to use the drawString on a mouseEnter Event of, as an example, a button.  I know I have to use the Paint Event but I don't really know what parameters I have to use with the Paint Event (Object sender, PaintEventArgs e).

Thanks.
SVakten
0
Comment
Question by:SVakten
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 10

Accepted Solution

by:
eternal_21 earned 600 total points
ID: 10910466
I'm not sure if I follow you, but if I do - this is what I did:

###

    bool mouseIsOver = false;
   
    private void button1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
    {
      if(mouseIsOver)
        e.Graphics.DrawString("Test", new System.Drawing.Font("Times New Roman", 10), System.Drawing.Brushes.Black, 5, 5);
    }

    private void button1_MouseEnter(object sender, System.EventArgs e)
    {
      this.mouseIsOver = true;
      this.button1.Invalidate();
    }

    private void button1_MouseLeave(object sender, System.EventArgs e)
    {
      this.mouseIsOver = false;
      this.button1.Invalidate();
    }

###
0
 

Author Comment

by:SVakten
ID: 10911566
Eternal_21, you followed me and I thank you, it works great!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question