bright, fresh software
Downloads  |  Buy

SplitButton control, written in C#

Re: SplitButton control, written in C#

Postby dlarkin77 » July 15th, 2008, 10:14 am

Hi,

I want the SplitButton to have a blue background so I set splitButton1.BackColor = Color.Blue
This has no effect that I can see, the button still has its default color.
Is there something else that I need to do to be able to change the backcolor?

Thanks,

dlarkin77
dlarkin77
 

Re: SplitButton control, written in C#

Postby Wyatt » July 15th, 2008, 7:40 pm

dlarkin77 wrote:I want the SplitButton to have a blue background so I set splitButton1.BackColor = Color.Blue
This has no effect that I can see, the button still has its default color.
Is there something else that I need to do to be able to change the backcolor?


I didn't implement BackColor, so setting the property has no effect. This is similar to another question. All you need to do is open up the SplitButton project and edit the OnPaint method.

It might take a couple of hours to get it the way you like it, But you can ask for help if you have any trouble understanding the code.

I have a few parting questions: Why do you want to override the default theme for XP / Vista? Do your users really want that? Why not just disable the theme on your computer, and set the control color to blue? That way you'll have uniformity across all your apps.
User avatar
Wyatt
Site Admin
 
Posts: 3097
Joined: July 11th, 2007, 10:30 pm
Location: New Hampshire

Re: SplitButton control, written in C#

Postby m0by » December 3rd, 2008, 1:40 pm

I have been using your button, and I would like to hide the "button" part of the splitbutton so when it loses focus, only shows the dropdown arrow, and If the user goes and click the arrow, the button shows again. Any idea?
Thanks.
m0by
 

Re: SplitButton control, written in C#

Postby Wyatt » December 3rd, 2008, 5:16 pm

m0by, I'm not quite sure what you mean. Are you asking for a combo-box? If not, what you're asking for sounds confusing and non-intuitive.

Maybe I'm misunderstanding you. Perhaps you could post a picture of what you're looking for.
User avatar
Wyatt
Site Admin
 
Posts: 3097
Joined: July 11th, 2007, 10:30 pm
Location: New Hampshire

Re: SplitButton control, written in C#

Postby james » July 8th, 2010, 12:56 am

How do i use this with Visual Studio 2005.I added referance from bin folder & then choose item in toolbox & check the split button checkbox then nothing happens.
Am i doing something wrong :oops:
james
 

Re: SplitButton control, written in C#

Postby Sam » July 8th, 2010, 1:12 am

You need to add it to your form. Click the Split Button in the toolbox, and drag it to your form.
User avatar
Sam
 
Posts: 2370
Joined: March 8th, 2010, 3:01 am
Location: New Hampshire

Re: SplitButton control, written in C#

Postby BrewmasterOfNone » July 30th, 2010, 8:24 am

Has anyone else experienced SplitButton appearance changes between XP and Windows 7?

I had a form with a few SplitButtons that I created in WinXP, but when I got a new computer with Windows 7, the SplitButtons appeared to be a slightly different size and a slightly different location. I assumed that the form had gotten mangled somehow and fixed they layout. However, when I load the form on a WinXP machine, the SplitButtons are a slightly different size again. All of the standard .NET Buttons are the correct size, though.

Has anyone else seen this? Is there a fix for it that I missed?

Thank you for help,

Andy
BrewmasterOfNone
 

Re: SplitButton control, written in C#

Postby Sam » July 30th, 2010, 4:52 pm

Hey Andy,

Font sizes on Windows XP vs. Windows 7 are different (see: Windows Vista & 7 Font, Segoe UI, in C# and VB.NET).

Do you have the AutoScaleMode property of your form set? If so, this will move & resize elements on your form.
User avatar
Sam
 
Posts: 2370
Joined: March 8th, 2010, 3:01 am
Location: New Hampshire

Re: SplitButton control, written in C#

Postby BrewmasterOfNone » August 2nd, 2010, 7:42 am

What should AutoScaleMode be set to? I haven't modified it, and it is set to Font.

I don't know if this is really the issue though. You see, all of the split buttons are a different size than the non split buttons. If my entire GUI was mangled, I could understand it being a property like this, but only the split buttons appear to be affected.

However, if I am the only one seeing this, then it must be some property or setting that is causing the problem. If anyone knows what settings might be the problem, I would be much obliged.

Thanks,

Andy
BrewmasterOfNone
 

Re: SplitButton control, written in C#

Postby BrewmasterOfNone » September 3rd, 2010, 8:20 am

My mistake. As it turns out, it isn't a Windows XP / Windows 7 issue, but a large font, small font issue. I designed my form with large fonts, and when I compiled it and move it to a computer that didn't have large fonts turned on, the button was too big.

I think that the problem is in CalculateButtonAutoSize(); there are a couple of places where constants are added to the height and width, and I think those are causing issue when switching between regular fonts and large fonts. There aren't any comments beyond "Pad the text size" and "Pad the result", so I'm not sure where those numbers are coming from. I think that those numbers need to be replaced by values from the operating system, but I don't know which values to get. Does anyone have any suggestions?

Thanks,

Andy
BrewmasterOfNone
 

PreviousNext

Return to Open Source Support