Click here to Skip to main content
15,889,781 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: MSN Explorer duplicate Pin
Dave Kreskowiak30-Apr-06 5:21
mveDave Kreskowiak30-Apr-06 5:21 
QuestionRe: MSN Explorer duplicate Pin
David Jeba30-Apr-06 20:57
David Jeba30-Apr-06 20:57 
AnswerRe: MSN Explorer duplicate Pin
Dave Kreskowiak1-May-06 2:21
mveDave Kreskowiak1-May-06 2:21 
QuestionUsing Progress Bars Pin
mr_1234527-Apr-06 13:43
mr_1234527-Apr-06 13:43 
AnswerRe: Using Progress Bars Pin
CWIZO27-Apr-06 21:57
CWIZO27-Apr-06 21:57 
GeneralRe: Using Progress Bars Pin
thebread27-Apr-06 22:44
thebread27-Apr-06 22:44 
QuestionAdding a "Checked" property to ToolStripSplitButton Pin
Dromio27-Apr-06 7:59
Dromio27-Apr-06 7:59 
AnswerRe: Adding a "Checked" property to ToolStripSplitButton Pin
Dromio28-Apr-06 4:28
Dromio28-Apr-06 4:28 
I've updated my OnPaint function to the following:

<br />
        protected override void OnPaint(PaintEventArgs e)<br />
        {<br />
            if (_Checked)<br />
            {<br />
                if (renderer != null)<br />
                {<br />
                    System.Drawing.Rectangle cr = base.ContentRectangle;<br />
                    System.Drawing.Image img = this.Image;<br />
<br />
                    // Compute the center of the item's ContentRectangle.<br />
                    int centerY = (cr.Height - img.Height) / 2;<br />
<br />
                    System.Drawing.Rectangle fullRect = new System.Drawing.Rectangle(0, 0, this.Width, this.Height);<br />
<br />
                    System.Drawing.Rectangle imageRect = new System.Drawing.Rectangle(<br />
                        base.ContentRectangle.Left,<br />
                        centerY,<br />
                        base.Image.Width,<br />
                        base.Image.Height);<br />
<br />
                    System.Drawing.Rectangle textRect = new System.Drawing.Rectangle(<br />
                        imageRect.Width,<br />
                        base.ContentRectangle.Top,<br />
                        base.ContentRectangle.Width - (imageRect.Width + 10),<br />
                        base.ContentRectangle.Height);<br />
<br />
                    renderer.DrawBackground(e.Graphics, fullRect);<br />
                    renderer.DrawText(e.Graphics, textRect, this.Text);<br />
                    renderer.DrawImage(e.Graphics, imageRect, this.Image);<br />
                }<br />
                else<br />
                {<br />
                    e.Graphics.FillRectangle(System.Drawing.SystemBrushes.Control, 0, 0, this.Width, this.Height);<br />
                    e.Graphics.DrawRectangle(new System.Drawing.Pen(System.Drawing.SystemColors.Highlight), 0, 0, this.Width - 1, this.Height - 1);<br />
                    base.OnPaint(e);<br />
                }<br />
            }<br />
            else<br />
            {<br />
                base.OnPaint(e);<br />
            }<br />
<br />
        }<br />


Now I've got the image and text, but nothing looks right. I thought that setting the renderer to be the same as a checked button would fix this, but the font is wrong and the background appears blank.

Am I going about this the wrong way?
Questionimplementing the mvc-pattern Pin
thebread26-Apr-06 21:52
thebread26-Apr-06 21:52 
AnswerRe: implementing the mvc-pattern Pin
CWIZO27-Apr-06 7:24
CWIZO27-Apr-06 7:24 
GeneralRe: implementing the mvc-pattern Pin
Josh Smith27-Apr-06 7:39
Josh Smith27-Apr-06 7:39 
GeneralRe: implementing the mvc-pattern Pin
CWIZO27-Apr-06 7:40
CWIZO27-Apr-06 7:40 
GeneralRe: implementing the mvc-pattern Pin
thebread27-Apr-06 10:03
thebread27-Apr-06 10:03 
GeneralRe: implementing the mvc-pattern Pin
Josh Smith27-Apr-06 13:20
Josh Smith27-Apr-06 13:20 
Questionexception handling Pin
D.N.26-Apr-06 19:26
D.N.26-Apr-06 19:26 
AnswerRe: exception handling Pin
CWIZO27-Apr-06 5:47
CWIZO27-Apr-06 5:47 
AnswerRe: exception handling Pin
Josh Smith27-Apr-06 7:25
Josh Smith27-Apr-06 7:25 
QuestionRegex.Split and sub groups Pin
Distinctive26-Apr-06 17:15
Distinctive26-Apr-06 17:15 
AnswerRe: Regex.Split and sub groups Pin
Guffa26-Apr-06 21:27
Guffa26-Apr-06 21:27 
GeneralRe: Regex.Split and sub groups Pin
Distinctive26-Apr-06 23:06
Distinctive26-Apr-06 23:06 
AnswerRe: Regex.Split and sub groups Pin
Guffa27-Apr-06 0:17
Guffa27-Apr-06 0:17 
QuestionClick Once Deployment & logging Pin
Mr Brown Shoes25-Apr-06 14:41
Mr Brown Shoes25-Apr-06 14:41 
AnswerRe: Click Once Deployment & logging Pin
JimRoss2-May-06 11:38
JimRoss2-May-06 11:38 
GeneralRe: Click Once Deployment & logging Pin
Tailslide5-Nov-09 6:11
Tailslide5-Nov-09 6:11 
QuestionDataGridView.remove how do i call this , help ? Pin
Steve Ryan25-Apr-06 12:01
Steve Ryan25-Apr-06 12:01 

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.