ComboBoxRenderer does not look like Windows 7 ComboBox

Hi,
When I call Application.EnableVisualStyles in WinForms application on Windows 7, a ComboBox looks "modern" - it is a white background with a black arrow.  When I do not call EnableVisualStyles, the ComboBox is "legacy" - a gray background.
However, ComboBoxRenderer.DrawDropDownButton always looks "legacy" - it always draws it with a gray background.  I also tried ControlPaint methods but it also looked "legacy."
How do I draw custom combo box button that is "modern" in C# (or even p/Invoke to GDI or GDI+)?
Thanks.

There are 3 DropDownStyles for combobox and each one renders differently.
Below are 3 simple methods to draw a combobox dependant on style and state:
private void DrawSimpleCombo(Graphics graphics, Rectangle bounds, ComboBoxState state)
VisualStyleRenderer renderer;
if (state != ComboBoxState.Disabled)
renderer = new VisualStyleRenderer("COMBOBOX", 4, 2);
renderer.DrawBackground(graphics, bounds);
else
renderer = new VisualStyleRenderer("EDIT", 1, 1);
renderer.DrawBackground(graphics, bounds);
Rectangle rc = renderer.GetBackgroundContentRectangle(graphics, bounds);
rc.Inflate(-2, -2);
graphics.FillRectangle(SystemBrushes.Control, rc);
private void DrawDropDownCombo(Graphics graphics, Rectangle bounds, ComboBoxState state, bool focused)
VisualStyleRenderer renderer = new VisualStyleRenderer("COMBOBOX", 4, state > ComboBoxState.Normal || focused ? 2 : 1);
VisualStyleRenderer buttonRenderer = new VisualStyleRenderer("COMBOBOX", 7, (int)state);
Size szP = buttonRenderer.GetPartSize(graphics, ThemeSizeType.True);
buttonRenderer.SetParameters("COMBOBOX", 7, (int)state);
Size szR = buttonRenderer.GetPartSize(graphics, ThemeSizeType.True);
buttonRenderer.SetParameters("COMBOBOX", 6, (int)state);
Size szL = buttonRenderer.GetPartSize(graphics, ThemeSizeType.True);
Size sz = new Size(szL.Width + szR.Width + szP.Width, szP.Height);
if (state != ComboBoxState.Disabled)
renderer.DrawBackground(graphics, bounds);
else
renderer = new VisualStyleRenderer("EDIT", 1, 1);
renderer.DrawBackground(graphics, bounds);
Rectangle client = renderer.GetBackgroundContentRectangle(graphics, bounds);
client.Inflate(-2, -2);
client.Width -= sz.Width;
graphics.FillRectangle(SystemBrushes.Control, client);
Rectangle rc = Rectangle.FromLTRB(bounds.Right - (sz.Width), bounds.Top, bounds.Right, bounds.Bottom);
buttonRenderer.DrawBackground(graphics, rc);
private void DrawDropDownListCombo(Graphics graphics, Rectangle bounds, ComboBoxState state)
VisualStyleRenderer renderer = new VisualStyleRenderer("COMBOBOX", 5, (int)state);
renderer.DrawBackground(graphics, bounds);
renderer.SetParameters("COMBOBOX", 1, 1);
Size szP = renderer.GetPartSize(graphics, ThemeSizeType.True);
renderer.SetParameters("COMBOBOX", 7, 1);
Size szR = renderer.GetPartSize(graphics, ThemeSizeType.True);
renderer.SetParameters("COMBOBOX", 6, state == ComboBoxState.Disabled ? 4 : 1);
Size szL = renderer.GetPartSize(graphics, ThemeSizeType.True);
Size sz = new Size(szL.Width + szR.Width + szP.Width, szP.Height);
Rectangle rc = Rectangle.FromLTRB(bounds.Right - (sz.Width), bounds.Top, bounds.Right, bounds.Bottom);
renderer.DrawBackground(graphics, rc);
public enum ComboBoxState
Normal = 1, Hot, Pressed, Disabled
Mick Doherty
http://dotnetrix.co.uk
http://glassui.codeplex.com

Similar Messages

  • My interface -- buttons (back, forward, reload), firefox tab, groups, etc. -- does not look like the sample on your "firefox features" page. ("Groups" seems not to function at all.) I'm running the current firefox 4 download on Windows XP. Can you help?

    My interface -- buttons (back, forward, reload), firefox tab, groups, etc. -- does not look like the sample on your "firefox features" page. ("Groups" seems not to function at all.) I'm running the current firefox 4 download on Windows XP. Can you help?

    cor-el
    Thank you for your swift reply. I don't know that this has helped me, as I've reached my level of tolerance for fooling with this annoying little problem - for today anyway. It has been going on since I "up" graded to Firefox 4. My wife is running 3.6.x on her laptop with none of this foolishness. As BLASPHEMOUS as it may sound, I've gone back to IE for the time being even though I don't like it 1000th as much as I do Firefox.
    Not just to rant here, I would say that I found a way to put some buttons on the right side of the toolbar that immediately gave me permission to "back, forward, and reload", but upon closing the browser and going out for dinner with the wife, I find on return that not only are those buttons NOT still on the toolbar, but I can't find them anymore. I think they were in "add-ons" found under I believe Add-On Manager.
    I did also manage to achieve back/forward functionality running Firefox in SAFE mode, but this meant no No-Script, among other things, and I've grown too fond of that particular little script to give it up.
    I've rebooted, restored, and reinstalled, can't get this formerly completely reliable program to work like it always has. Before looking around on here, I was beginning to think it was my PC.
    THANK YOU FOR YOUR HELP, cor-el. I'm going to see if I can get on live chat on Monday.
    bossman344

  • Webgui theme not rendering toolbar, does not look like SAPgui for Win

    Hello all,
    I just installed the ITS 6.20 Patch 20 and when I started the webgui service, the theme that was genereatd does not look like the SAPgui for Windows at all.
    All I've got is a gray and blue color theme.  The top row is the "SAP Easy Access" header and on the next row are just simple square buttons (Menu, Tools, User Menu, SAP Menu, etc.).
    What do I have to do to enable the "richer" look-and-feel like the SAPgui for Windows 6.20?  I'm looking to get the toolbar with the paging icons, disk icon, goback, etc.
    Thanks,
    Mike

    Oliver,
    You have to disable the Enjoy SAP option.
    1. Log in to the Admin service;
    2. Open the Configuration | General settings for the ITS instance;
    3. Remove the checkmark for the "Enjoy Design" option.
    4. Save and restart.
    Does this help?
    Mike

  • My Ref. HD does not look like my Aperture Library

    Hi,
    I don't neccessarily have a problem, but I do notice that my referenced library on an ext. HD does not look like my Aperture library on my mbp. I notice that there are alot of separate images not in albums or projects or folders. Is there a way or need to reorganize the ref. images into a similar setup as my library. Any thoughts are welcome as I'm a bit of a neat freak, esp. with photos etc.
    Thank you.
    John

    OK we're talking past each other here and not getting much accomplished.
    The top screenshot from this post Re: My Ref. HD does not look like my Aperture Library is not from within Aperture. How did you take that screenshot? Aperture does not display dates like that AFAIK, that sure looks like a Finder window.
    I believe the best thing you can do right now is to read the User Manual, especially the part about the parts of the Aperture library and Kirby's very good user tip. It should clear up your terminology and make things clearer for you.
    good luck
    regards
    To better explain my point. This is what a screenshot of an Aperture Library would look like from within Aperture
    This is a screnhsot of a Finder window
    Message was edited by: Frank Caggiano - added screenshots

  • Does not look like the picture on your site. i have xp professional

    i downloaded ff v.4, but it does not look like the picture on your website. lots of missing components/tabs?
    i use windows xp professional.

    The orange Firefox menu button is hidden by default on Windows XP.<br />
    You see the orange (on Linux gray) Firefox button if the Menu Bar is hidden, so you need to hide the Menu bar to get the new appearance.<br />
    If you need to access the hidden Menu bar then press F10 or hold down the Alt key to make the Menu Bar appear temporarily.<br />
    You can place the Tab Bar on top.
    * View > Toolbars : [ ] Menu Bar
    * View > Toolbars : [X] Tabs on Top

  • "This does not look like a tar archive"

    I've seen other posts but everybody's fix seems to not work for me.  Here is my error:
    :: Starting full aur upgrade...
    Aur Targets    (3): setuptools python2-iso8601 gnome-shell-google-calendar-git
    Proceed with installation? [Y/n]
    tar: This does not look like a tar archive
    gzip: stdin: unexpected end of file
    tar: Child returned status 1
    tar: Error is not recoverable: exiting now
    /usr/bin/packer: line 271: cd: setuptools: No such file or directory
    No PKGBUILD found in directory.
    No matter what, I can't seem to get past this.

    It looks like packer is trying to download the PKGBUILD for setuptools from the AUR, but it doesn't exist. However, setuptools is provided by python2-distribute in extra (or python2-setuptools in the AUR). I think you should remove the current setuptools that you have, install python2-distribute (or python2-setuptools), then try to update again. I think that should work.
    EDIT: typo
    Last edited by jomasti (2011-12-02 19:27:19)

  • Why is it that I downloaded Firefox 4.0 but I do not have the orange firefox box in the upper left hand corner of screen. My screen still looks like the old verison of firefox. My screen does not look like the one in the video. looks nothing like the one

    My Firefox 4.0 does not look anything like the videos you show about the features of the new Firefox. My screen looks totally different than yours. It does not have the orange box in the upper left hand corner of the screen. My screen still looks like the old version. I have the logo on the top of my screen with Ask a Question a vertical line Firefox Help - Mozilla Firefox.
    Under this line I have File, Edit, View, History, Bookmarks, Tools, and Help. Below this line is a tab with Ask a Question Firefox Help and a +. My husbands screen looks identical to the orange Firefox Box in the upper left of screen. I would like my screen to look identical to the ones shown in your videos. I only have one version of Firefox 4.0 my husband does have the Firefox 4.0 plus the Beta version. How do I add the Beta version? I have Windows Vista running systems. Please help. Thank you

    You're welcome

  • My Firefox screen at the top does not look like what you show at your help site, so I can't customize or learn how to do things

    I am running Windows 7 Professional and am not adept at using the Windows platform. Firefox on my computer does not look the way it is shown at specific "Help" topic pages, so I can't get the help needed. Three examples: 1. How to click on a link so it opens in a new tab; 2. How to customize the options; 3. How to get rid of the "Ask" web site window.

    On Windows, you can switch between a classic menu bar and a compact menu opened with an orange button with the word Firefox.
    You can switch between these using one of these methods:
    * right-click a blank area of the tab bar and turn Menu Bar on or off
    * View menu > Toolbars > Menu Bar
    * orange Firefox button > Options triangle > Menu Bar
    Does that help?
    To get to the tab preferences, you can do this:
    orange Firefox button (or Tools menu) > Options > Tabs
    To remove the Ask toolbar, you can go here:
    orange Firefox button (or Tools menu) > Add-ons > Extensions category
    You might still have to do a little cleanup after removing an extension, if it changed your home page, new tab page, search provider, etc. Please describe any remaining problems in more detail.
    Hope this helps.

  • I want to print an 8 x 10, but the photo does not look like the print preview - it truncates part of the picture

    I am using an HP PSC 2355 printer - and have not had trouble printing before. The 8 x 10 photo does not print like the print preview does - everything elarges when the actual print completes, which truncates all details that need to be printed. Is ther a setting that I should be choosing?

    There is no O or L in my Serial Number, and it starts with one single D, then a set of 3 numbers, 3 letters, 4 times, then 3 letters closing it down. When I check my Final Cut's serial number in the help section of the software, I get the same number. Yet, when I enter it in the site, it says, I have an invalid serial number. So I will call Apple Care. I hope I will be able to talk to a representative in an hour or so. It always takes so long that I grow beard while I wait.

  • When i installed firefox on windows my page does not look like the set up in the help support set up section

    when installed the page doesnt look like one that helps you in setup support - i dont have orange firefox tab upper left nothing is the same and very irritating trying to follow your suggestions nothing works

    Also make sure that you do not run Firefox in full screen mode (press F11 or Fn + F11 to toggle; Mac: Command+Shift+F).
    *https://support.mozilla.org/kb/how-to-use-full-screen
    Make sure that toolbars like the "Navigation Toolbar" and the "Bookmarks Toolbar" are visible.
    *Firefox menu button > Options
    *View > Toolbars (press F10 to display the hidden Menu bar)
    *Right-click empty toolbar area
    Use Toolbar Layout (Customize) to open the Customize window and set which toolbar items to display.
    *check that "Bookmarks Toolbar items" is on the Bookmarks Toolbar
    *if "Bookmarks Toolbar items" is not on the Bookmarks Toolbar then drag it back from the toolbar palette into the Customize window to the Bookmarks Toolbar
    *if missing items are in the toolbar palette then drag them back from the Customize window on the toolbar
    *if you do not see an item on a toolbar and in the toolbar palette then click the "Restore Default Set" button to restore the default toolbar setup
    See also:
    You can check for problems caused by a corrupted localstore.rdf file.
    *http://kb.mozillazine.org/Corrupt_localstore.rdf

  • My Firefox does not look like the Firefox shown in your tutorials

    Going through the tutorials and help sections, the Firefox page shown does not match the one that I have. There is no Firefox button, the menu below the Mozilla logo is the "File Edit View...." menu. So the directions I am getting from the tutorials and Help sections can't be followed.
    I just downloaded Firefox, installed it, and checked for updates, which Firefox found and installed. I am now at 19.0.2
    I am running Windows 7 on a Lenovo Thinkpad. WIndows just updated.
    Am I running the latest version of Firefox? Why doesn't my version look like the help pages?

    hello, you can go to the ''view ''menu > ''toolbars'' & un-check the menu-bar - then you should get the default look.

  • Export of noise reduction does not look like Develop preview

    Hi,
    I have a photo that has noise reduction applied, however, after export, it looks as if NO noise reduction has been applied.  Other photos look like they have the noise reduction applied.  Not sure why this one would refuse to export the noise reduction filter.  In the Develop preview, it looks great, no noise. After export, noise.
    Different but possibly related, On all photos, I noticed that the noise reduction preview in Develop doesn't update unless I zoom-in/zoom-out, then it updates it. But if I make any adjustments to the slider it doesn't update until I zoom-in/zoom-out again.  This seems like a bug.
    Lightroom version: 3.0 [677000]
    Operating system: Microsoft Windows XP Professional Service Pack 3 (Build 2600)
    Version: 5.1 [2600]
    Application architecture: x86
    System architecture: x86
    Physical processor count: 2
    Processor speed: 1.8 GHz
    Built-in memory: 2047.2 MB
    Real memory available to Lightroom: 716.8 MB
    Real memory used by Lightroom: 252.1 MB (35.1%)
    Virtual memory used by Lightroom: 400.0 MB
    Memory cache size: 51.7 MB
    System DPI setting: 96 DPI
    Displays: 1) 1680x1050, 2) 1440x900
    Thanks in advance for any help, and sorry if this has already been reported.
    tek

    function(){return A.apply(null,[this].concat($A(arguments)))}
    Lee Jay wrote:
    danpancamo wrote:
    Here's the CR2 file
    https://rcpt.yousendit.com/1005742637/a865add0e167c8fdfac02211e4345a60
    TO recreate the problem
    1. import the CR2 into LR3.3
    2. In the Develop Module  change Noise Reduction Luminance and Detail to 100
    3. In the Library Module export to Hard Drive with 100% Quality no Sharpening
    4. View the JPG and compare to the LR3 views...  
    The two are virtually the same, as far as I can tell.
    It looks like the 1:1 issue in Develop view biting me again... If you view the image in develop view in less thatn 1:1 it looks great.
    Man the 1:1 view issue is annoying!   I want the image to look the way it does in Fit/Fill mode....     Is there a way to do this?
    If I export th CR2 to JPG then Import the JPG then appy NR to the JPG and export, I get the results im after....  there's got to be a better way?

  • I just downloaded Firefox 4 and it does NOT look like it is supposed to look - My menu items are not in a single button, etc... as displayed in Step 2 of getting to know your browser on the welcome page for Mozilla Firefox 4. Can anyone help?

    This webpage [http://example.com http://www.mozilla.com/en-US/firefox/central/ ]shows what Firefox 4 should look like. My Firefox 4 does not have the menu items grouped and I have no app tab. All in all, my Firefox 4 is not what it should be... does anyone know why this might be and how I should go about fixing it? thanks :)

    To get the new UI you need to hide the menu bar. To do that in the View menu select Toolbars, then click on the "Menu Bar" entry.
    If you need access to the menus you can press either Alt or F10 to temporarily display them.

  • My mouse preference pane does not look like Apple's

    Hi all.
    Just bought the Magic Mouse, and I like it. Would like to do some fine-tuning, though. On the apple.com there's a movie about the mouse, with a shot of the pref pane for mouse settings. It looks like this:
    Mine does not. It looks like this, with much less options (sorry for the Swedish language, but I think you get the point):
    What am I missing? I have the latest system (10.7.4). The apple.com it says that I need Wireless Mouse Software Update 1.0, so I tried Software Update but it says I'm up to date on everything.

    Exactly. Secondary click is on, but locked to ctrl+click. I would like to modify this. The apple.com screen shot looks like it offers that option, but I might be wrong.
    I ran my old Logitech through SteerMouse, which offers a world of options. Apple stuff usually don't need to, since they're right from the start, but in this case I'd really like some more options.

  • JEditor pane does not look like the explorer.

    Hi
    I would like to display the following htmlc ode on JEditor pane.
    I want to have two lists of assets and a title to each one.
    the problem is that one of the titles (the second one) does not displayed in the same location as the first one (It displayes ans if it is part of the list)
    I copies the code to a htm page and it looks fine on my explorer.
    I will be happy if you will tell me what is wrong in the html code.
    thanks
    Liat
    JEditorPane summeryMessagePane;
    summeryMessagePane=new JEditorPane("text/html","");
    //html string
    String text="<html><body><font face = Verdana size =2 color=black>The following files were defined successfully:<li><font face = Verdana size =2 color=black>/LDRS/mummy2_opt8_pal_2500kbps_10m_l2_ar128kbps.m1s.mpg</font></li><li><font face = Verdana size =2 color=black>/LDRS/nely_opt2_10m_pal_1860kbps_l2_128kps.m1s.mpg</font></li><br>The definition for the following files failed:<li><font face = Verdana size =2 color=black>/LDRS/mummy2_opt8_pal_2500kbps_10m_l2_ar128kbps.m1s.mpg.meta</font></li><font face = Verdana size =2 color=black>Unsupported asset format.<li><font face = Verdana size =2 color=black>/LDRS/nely_opt2_10m_pal_1860kbps_l2_128kps.m1s.mpg.meta</font></li><font face = Verdana size =2 color=black>Unsupported asset format.</font></body></html>"
    //set the string
    summeryMessagePane.setText(text.toString());
    JScrollPane scrollPane = new JScrollPane(summeryMessagePane);
            add(scrollPane,BorderLayout.CENTER);

    What ever gave you the idea that HTML display on JEditorPane would look exactly like in IE?
    JEditorPane only supports HTML 3.2 (but no frames, I think), some CSS 1 and no Javascript. It's very far from being useful for displaying modern web pages.
    Furthermore....
    <font face = Verdana size =2 color=black>
    Bad bad bad bad bad HTML format. You are supposed to always quote tag attribute values:
    <font face="Verdana" size="2" color="black">

Maybe you are looking for

  • How do i transfer my itunes music from one computer to itunes on another

    Tell me how to in easy steps with an ipod Tell me how to in easy steps with a pen drive

  • Why are some of the tracks on a cd being separated from the album?

    I can't figure out why some tracks are separated from a cd.  It seems to happen if an artist is featured in a song on an album...it separates it from the entire cd and is listed as a single track and i can't put it back with the album unless I create

  • File Adapter Wizard Step 4

    I'd like to write out a message variable to a file. When I use the file adapter, the wizard asks for a schema in step 4. There is no xsd schema defined for the message. I tried using the "Schema is Opaque" checkbox to create the partnerlink but then

  • Surround sound problem

    surround sound problemF hi, i have a creative t7900 8 speaker surround sound setup. back in august i purchased a x-fi soundblaster extremem audio sound card. up until yesterday it was working fine. i opened my pc up after disconecting all the cables

  • How to upload a excel file using BDC

    how should i upload a file using BDC i have downloaded a excel file containing the values of  table A006 a X server. now i hav to upload it into new server Y server using BDC , how do i do it? wat all things one shud consider ?