Solved

Using the drawString method on a MouseEnter Event.

Posted on 2004-04-24
3
281 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
HTML - Color not displaying correctly in EMAIL. 6 49
How to read text with RegEx... 2 26
IEnumerable<T> to a List<T> 8 40
c# DateTime Format validation 4 47
In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

821 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