Who knows how to make the actual check box rectangle larger? Is the onlyway
to inherit from checkbox and override its paint method or something?

thanks

RE: Make checkbox larger by v-kevy

v-kevy
Fri Oct 15 22:30:36 CDT 2004

Hi TS,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to make the check box
rectangle larger. If there is any misunderstanding, please feel free to let
me know.

Yes, you're right. There is no direct way to achieve this by setting a
property or something like that. The only way is to override its paint
method. But I think this is not easy.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."


Re: Make checkbox larger by Herfried

Herfried
Sat Oct 16 05:47:08 CDT 2004

"TS" <manofsteele@311.com> schrieb:
> Who knows how to make the actual check box rectangle
> larger? Is the onlyway to inherit from checkbox and override its
> paint method or something?

Yes.

Very quick and dirty:

\\\
Option Explicit On
Option Strict On

Public Class CheckBoxEx
Inherits System.Windows.Forms.CheckBox

Private Sub CheckBoxEx_Paint( _
ByVal sender As Object, _
ByVal e As System.Windows.Forms.PaintEventArgs _
) Handles MyBase.Paint
Dim rct As Rectangle = _
New Rectangle( _
0, _
CInt((Me.Height - Me.Font.Size) * 0.5), _
CInt(Me.Font.Size), CInt(Me.Font.Size) _
)
e.Graphics.FillRectangle( _
Brushes.Black, _
New Rectangle(0, 0, Me.Width, Me.Height) _
)
Select Case Me.CheckState
Case CheckState.Checked
e.Graphics.FillRectangle(Brushes.Red, rct)
Case CheckState.Indeterminate
e.Graphics.FillRectangle(Brushes.Green, rct)
Case CheckState.Unchecked
e.Graphics.FillRectangle(Brushes.Blue, rct)
End Select
Dim ForeBrush As New SolidBrush(Me.ForeColor)
e.Graphics.DrawString( _
Me.Text, _
Me.Font, _
ForeBrush, _
CInt(Me.Font.Size + 4), _
CInt((Me.Height - Me.Font.Size) * 0.5) _
)
ForeBrush.Dispse()
End Sub

Private Sub CheckBoxEx_CheckStateChanged( _
ByVal sender As Object, _
ByVal e As System.EventArgs _
) Handles MyBase.CheckStateChanged
Me.Invalidate()
End Sub
End Class
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>



Re: Make checkbox larger by Bob

Bob
Sat Oct 16 05:59:10 CDT 2004

You could create your own control fairly easily and then use the
ControlPaint.DrawCheckBox method to draw one of a specific size. The
standard size is discovered in the SystemInformation.MenuCheckSize property.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml






"TS" <manofsteele@311.com> wrote in message
news:edEyXPwsEHA.1308@tk2msftngp13.phx.gbl...
> Who knows how to make the actual check box rectangle larger? Is the
onlyway
> to inherit from checkbox and override its paint method or something?
>
> thanks
>
>



Re: Make checkbox larger by TS

TS
Mon Oct 18 10:35:01 CDT 2004

Thank you all! I will employ one of those methods

"TS" <manofsteele@311.com> wrote in message
news:edEyXPwsEHA.1308@tk2msftngp13.phx.gbl...
> Who knows how to make the actual check box rectangle larger? Is the
onlyway
> to inherit from checkbox and override its paint method or something?
>
> thanks
>
>



Re: Make checkbox larger by v-kevy

v-kevy
Tue Oct 19 01:41:44 CDT 2004

Hi TS,

Nice to hear that you have had this issue resolved. Thanks for sharing your
experience with all the people here. If you have any questions, please feel
free to post them in the community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."