Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4086380
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:43:06+00:00 2026-05-20T18:43:06+00:00

Is it possible to change appearance for selected (not in drop down!) item? combobox.ForeColor

  • 0

Is it possible to change appearance for selected (not in drop down!) item?

combobox.ForeColor is changing the text color only for all items into drop-down list.

Edit:
Variants are beelow, ours is

 public static void CBoxDrawItem(object sender, DrawItemEventArgs args)
    {
        var box = sender as ComboBox;
        if (box == null || args.Index < 0 || args.Index >= box.Items.Count)
            return;

        e.DrawBackground();
        var data = box.Tag as ControlData;
        var color = (args.State & DrawItemState.ComboBoxEdit) == 0 || data == null || !data.IsInDefaultState
            ? e.ForeColor : GetDefaultColor(e.ForeColor);
        using (var brush = new SolidBrush(color))
        {
            args.Graphics.DrawString(box.Items[args.Index].ToString(), args.Font, brush, args.Bounds.X, args.Bounds.Y);
        }
        args.DrawFocusRectangle();
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T18:43:07+00:00Added an answer on May 20, 2026 at 6:43 pm

    You don’t have to change the FlatStyle to Popup or Flat to make this work. And you probably don’t want to do that in the first place, because those styles tend to look really ugly when compared to the rest of your application’s interface. Native Windows controls use a 3D-style appearance; the Flat and Popup styles are designed for Web or Windows Mobile applications, where they are a better fit.

    I assume that you’re asking this question because you have already written code to change the foreground color of the text displayed in the combobox, but have noticed that it isn’t working under Windows Vista or later. That’s because when the DropDownList style of combobox changed to look more like a button in those versions of Windows, it also lost support for custom text color. Instead, the selected text is always displayed in the standard “Window Text” color. Compare the DropDownList style to the regular DropDown style combobox:

         Comparing the DropDownList style to the DropDown style under Windows Vista or later

    Visually, the two comboboxes look the same in earlier versions of Windows, but not under Vista and later. The key to getting your custom foreground color to appear is changing the DropDownStyle property of your combobox control to DropDown (which is actually the default).

    I also like to set the FlatStyle property to System so that you get all the nifty fade-in and fade-out effects offered by the native Windows controls. The Standard style attempts to emulate those effects in managed code, but it just doesn’t have quite the right feel. I care about the little things.

    Then you can use the following code (as originally suggested in Adrian’s answer):

    public Form1()
    {
       InitializeComponent();
    
       // Set custom combobox styles
       comboBox1.DropDownStyle = ComboBoxStyle.DropDown;
       comboBox1.FlatStyle = FlatStyle.System;
    
       // Attach relevant event handler methods
       comboBox1.DropDown += new EventHandler(comboBox1_DropDown);
       comboBox1.DropDownClosed += new EventHandler(comboBox1_DropDownClosed);
    }
    
    void comboBox1_DropDown(object sender, EventArgs e)
    {
       // Optionally, revert the color back to the default
       // when the combobox is dropped-down
       //
       // (Note that we're using the ACTUAL default color here,
       //  rather than hard-coding black)
       comboBox1.ForeColor = SystemColors.WindowText;
    }
    
    void comboBox1_DropDownClosed(object sender, EventArgs e)
    {
       // Change the color of the selected text in the combobox
       // to your custom color
       comboBox1.ForeColor = Color.Red;
    }
    

    To produce the following effect:

       ComboBox showing selected text in red

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is is possible to change the item selection focus color and text color in
Is it possible to change the color or appearance of the scrollbar in a
How can i change the appearance (not the color) of a scrollbar within a
Possible Duplicate: Change background color of UI elements in eclipse IDE As you all
Possible Duplicate: Change color of selection How does this site manage to make text
Is possible change background-color on same td in fullcalendar? for example: I like have
Is it possible to change appearance of 'fontselect', 'fontsizeselect' and 'formatselect' selectboxes something like
Is it possible to change the appearance of an html link when it's disabled?
In jqPlot, is it possible change the color of the axis tick labels individually?
Possible Duplicate: Change custom color for Rectangle.Fill or Grid.Background I'm trying to dynamically set

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.