?
Solved

Using the drawString method on a MouseEnter Event.

Posted on 2004-04-24
3
Medium Priority
?
289 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

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

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

752 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