PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Framework Forms State buttons

Reply

State buttons

 
Thread Tools Rate Thread
Old 07-01-2007, 05:46 PM   #1
John
Guest
 
Posts: n/a
Default State buttons


Hi

Does vs 2005 have buttons that can have two states i.e. depressed and
normal?

Thanks

Regards


  Reply With Quote
Old 07-01-2007, 06:15 PM   #2
Mattias Sjögren
Guest
 
Posts: n/a
Default Re: State buttons

>Does vs 2005 have buttons that can have two states i.e. depressed and
>normal?


You can use the CheckBox control with the Appearance property set to
Button.


Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
  Reply With Quote
Old 07-01-2007, 06:36 PM   #3
John
Guest
 
Posts: n/a
Default Re: State buttons

Thanks but can't work out how to make its size to what I need. No handles to
make it bigger. Manually setting the size in properties does not work
either.

Thanks

Regards


"Mattias Sjögren" <mattias.dont.want.spam@mvps.org> wrote in message
news:OAfOUeoMHHA.3552@TK2MSFTNGP03.phx.gbl...
> >Does vs 2005 have buttons that can have two states i.e. depressed and
>>normal?

>
> You can use the CheckBox control with the Appearance property set to
> Button.
>
>
> Mattias
>
> --
> Mattias Sjögren [C# MVP] mattias @ mvps.org
> http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
> Please reply only to the newsgroup.



  Reply With Quote
Old 07-01-2007, 07:55 PM   #4
Rad [Visual C# MVP]
Guest
 
Posts: n/a
Default Re: State buttons

On Sun, 7 Jan 2007 18:36:59 -0000, John wrote:

> Thanks but can't work out how to make its size to what I need. No handles to
> make it bigger. Manually setting the size in properties does not work
> either.
>
> Thanks
>
> Regards


Hey John,

The width of the checkbox with an appearance of Button will adjust to fit
the checkbox text

--
Bits.Bytes
http://bytes.thinkersroom.com
  Reply With Quote
Old 07-01-2007, 10:26 PM   #5
Jay B. Harlow [MVP - Outlook]
Guest
 
Posts: n/a
Default Re: State buttons

John,
As Rad suggests, by default the button will adjust to fit the checkbox &
text.

You can control this behavior with the AutoSize property. So to answer your
original question:

>> >Does vs 2005 have buttons that can have two states i.e. depressed and
>>>normal?


Use a Checkbox with:
Appearance = Button
AutoSize = False

Changing the FlatStyle to Flat you can use the FlatAppearance property to
control the colors used by the button. For example, a Green "toggle" button:

Me.CheckBox1.Appearance = System.Windows.Forms.Appearance.Button
Me.CheckBox1.BackColor = System.Drawing.Color.LightGreen
Me.CheckBox1.FlatAppearance.BorderColor = System.Drawing.Color.Green
Me.CheckBox1.FlatAppearance.CheckedBackColor =
System.Drawing.Color.Green
Me.CheckBox1.FlatAppearance.MouseDownBackColor =
System.Drawing.Color.DarkGreen
Me.CheckBox1.FlatAppearance.MouseOverBackColor =
System.Drawing.Color.PaleGreen
Me.CheckBox1.FlatStyle = System.Windows.Forms.FlatStyle.Flat


FWIW: A number of controls gained the AutoSize property in .NET 2.0, if a
control is not resizing for you check for this property.

--
Hope this helps
Jay B. Harlow [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net


"John" <John@nospam.infovis.co.uk> wrote in message
news:eG3fQroMHHA.3312@TK2MSFTNGP03.phx.gbl...
> Thanks but can't work out how to make its size to what I need. No handles
> to make it bigger. Manually setting the size in properties does not work
> either.
>
> Thanks
>
> Regards
>
>
> "Mattias Sjögren" <mattias.dont.want.spam@mvps.org> wrote in message
> news:OAfOUeoMHHA.3552@TK2MSFTNGP03.phx.gbl...
>> >Does vs 2005 have buttons that can have two states i.e. depressed and
>>>normal?

>>
>> You can use the CheckBox control with the Appearance property set to
>> Button.
>>
>>
>> Mattias
>>
>> --
>> Mattias Sjögren [C# MVP] mattias @ mvps.org
>> http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
>> Please reply only to the newsgroup.

>
>


  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off