Using the drawString method on a MouseEnter Event.

Posted on 2004-04-24
Last Modified: 2012-06-27

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).

Question by:SVakten
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
LVL 10

Accepted Solution

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)
        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;

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


Author Comment

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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL ( and MongoDB (…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

726 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