Click here to Skip to main content
15,893,190 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to get points inside polygon Pin
Luc Pattyn14-Feb-08 0:48
sitebuilderLuc Pattyn14-Feb-08 0:48 
Generallabel issues Pin
Harvey Saayman13-Feb-08 20:10
Harvey Saayman13-Feb-08 20:10 
GeneralRe: label issues Pin
Christian Graus13-Feb-08 20:16
protectorChristian Graus13-Feb-08 20:16 
GeneralRe: label issues Pin
Harvey Saayman13-Feb-08 20:17
Harvey Saayman13-Feb-08 20:17 
GeneralRe: label issues Pin
Martin#13-Feb-08 20:34
Martin#13-Feb-08 20:34 
GeneralRe: label issues Pin
Harvey Saayman13-Feb-08 20:40
Harvey Saayman13-Feb-08 20:40 
GeneralRe: label issues Pin
Harvey Saayman13-Feb-08 21:13
Harvey Saayman13-Feb-08 21:13 
AnswerRe: label issues Pin
Martin#13-Feb-08 21:19
Martin#13-Feb-08 21:19 
Hello my quick friend,

You get the Graphics object of any Control for free in the OnPaint method.
If you inherit a control you can overridfe the OnPaint method and use the Graphics object of the passed args.

I show you an example where I inherited from Forms.Label:

private bool testsize = false;

public void TestSize()
{
    testsize = true;
    Invalidate();
}

protected override void OnPaint(PaintEventArgs e)
{
    if(testsize)
    {
        SizeF actSize = e.Graphics.MeasureString(Text, Font);
        if(Width < actSize.Width)
        {
            MessageBox.Show("Error: label to slim");
        }
        testsize = false;
    }
    base.OnPaint (e);
}

You can start the test from outside by calling the "TestSize" method of the Label

Hope it helps!

All the best,

Martin

GeneralRe: label issues Pin
Harvey Saayman13-Feb-08 21:53
Harvey Saayman13-Feb-08 21:53 
GeneralRe: label issues Pin
Martin#13-Feb-08 22:17
Martin#13-Feb-08 22:17 
GeneralError when using delegate.... ( Error in binding the target method)... Pin
peter rankel13-Feb-08 19:42
peter rankel13-Feb-08 19:42 
GeneralRe: Error when using delegate.... ( Error in binding the target method)... Pin
Christian Graus13-Feb-08 20:12
protectorChristian Graus13-Feb-08 20:12 
QuestionDateTime formatting in "dd-MMM-yyyy"? [modified] Pin
John Sundar13-Feb-08 18:18
John Sundar13-Feb-08 18:18 
GeneralRe: DateTime formatting in "dd-MMM-yyyy"? Pin
Steve Echols13-Feb-08 18:43
Steve Echols13-Feb-08 18:43 
GeneralRe: DateTime formatting in "dd-MMM-yyyy"? Pin
John Sundar13-Feb-08 18:57
John Sundar13-Feb-08 18:57 
GeneralRe: DateTime formatting in "dd-MMM-yyyy"? Pin
Steve Echols13-Feb-08 20:15
Steve Echols13-Feb-08 20:15 
GeneralRe: DateTime formatting in "dd-MMM-yyyy"? Pin
John Sundar13-Feb-08 20:25
John Sundar13-Feb-08 20:25 
GeneralRe: DateTime formatting in "dd-MMM-yyyy"? Pin
Steve Echols13-Feb-08 21:07
Steve Echols13-Feb-08 21:07 
GeneralRe: DateTime formatting in "dd-MMM-yyyy"? Pin
John Sundar13-Feb-08 21:52
John Sundar13-Feb-08 21:52 
GeneralRe: DateTime formatting in "dd-MMM-yyyy"? Pin
Steve Echols13-Feb-08 20:22
Steve Echols13-Feb-08 20:22 
GeneralRe: DateTime formatting in "dd-MMM-yyyy"? Pin
PIEBALDconsult14-Feb-08 13:19
mvePIEBALDconsult14-Feb-08 13:19 
GeneralIncluding MSSQL in a C# application for a client. Pin
AlainMesias13-Feb-08 15:51
AlainMesias13-Feb-08 15:51 
GeneralRe: Including MSSQL in a C# application for a client. Pin
Mark Churchill13-Feb-08 16:09
Mark Churchill13-Feb-08 16:09 
GeneralRe: Including MSSQL in a C# application for a client. Pin
Not Active13-Feb-08 16:15
mentorNot Active13-Feb-08 16:15 
GeneralRe: Including MSSQL in a C# application for a client. Pin
Joachim Kerschbaumer13-Feb-08 17:13
Joachim Kerschbaumer13-Feb-08 17:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.