Solved

Using the drawString method on a MouseEnter Event.

Posted on 2004-04-24
3
278 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
3 Comments
 
LVL 23

Expert Comment

by:rama_krishna580
ID: 10910354
0
 
LVL 10

Accepted Solution

by:
eternal_21 earned 150 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

770 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