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 869191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:16:10+00:00 2026-05-15T10:16:10+00:00

I have a Winforms dropdown. The drop down displays a string that is in

  • 0

I have a Winforms dropdown. The drop down displays a string that is in the form of…

<Description 30chars> Weight:<weight 6chars> Thickness:<thickness 6chars>

I need the strings to line up so Weight always starts at the same spot. So when there is a list of them everything lines up nicely.

My current solution was to use a monospaced font and create a display string that pads each part with spaces to get everything to line up. However the font looks different than the rest of the application and the beta testers did not approve. Is there a way to get text to line up without using a mono spaced font? This way I can use the same font that is used for the rest of the application.

Thank you

  • 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-15T10:16:11+00:00Added an answer on May 15, 2026 at 10:16 am

    Take a look at the DrawItem event for the ComboBox. There you can do any kind of formatting. Make sure you set the DrawMode to OwnerDrawXXXX.

     private void comboBox1_DrawItem(object sender, DrawItemEventArgs e)
            {
                ComboBox cb = (ComboBox)sender;
                int index = e.Index;
                Graphics g = e.Graphics;
    
                DataItem item = (DataItem)cb.Items[index];
    
                g.DrawString(item.Name, new Font("Arial", 8), new SolidBrush(Color.Blue), 0, e.Bounds.Y);
                g.DrawString(item.Age.ToString(), new Font("Arial", 8), new SolidBrush(Color.Blue), 100, e.Bounds.Y);
            }
    
            public class DataItem
            {
                public string Name;
                public int Age;
    
                public override string ToString()
                {
                    return string.Format("{0} {1}", Name, Age);
                }
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
                comboBox1.Items.Add(new DataItem { Name = "Apple", Age = 10 });
                comboBox1.Items.Add(new DataItem { Name = "Berry", Age = 20 });
                comboBox1.Items.Add(new DataItem { Name = "Cherry", Age = 30 });
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 488k
  • Answers 488k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Hard to say without knowing for sure what SAX parser… May 16, 2026 at 8:37 am
  • Editorial Team
    Editorial Team added an answer I'd personally separate it out so I had three assemblies:… May 16, 2026 at 8:37 am
  • Editorial Team
    Editorial Team added an answer Add this to your code: ).data( "autocomplete" )._renderItem = function(… May 16, 2026 at 8:36 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

WinForms, .NET 3.5 I have a ComboBox that needs to display a growing list
I have multiple winforms applications that download large sets of reference data on startup.
I have a WinForms user control Host with a custom UI Editor. Through that
I have a DataGridView with one DataGridViewComboBoxColumn in my WinForms application. I need to
I have a C# winforms app with a form for user preferences. An admin
I am using .NET winforms. I have a groupBox that contains a set of
I have an application that has two dependent dropdown lists, where if the user
I have a very critial business application presently running using Winforms. The application is
It seems like when you have a WinForms .NET application, and a ComboBox (set
I have a WinForms application with a view where the user selects a single

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.