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 509k
  • Answers 509k
  • 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 This question is strongly related with this one. I would… May 16, 2026 at 4:39 pm
  • Editorial Team
    Editorial Team added an answer Your problem is pretty common and somewhat easy to fix… May 16, 2026 at 4:39 pm
  • Editorial Team
    Editorial Team added an answer It is actually the order by deliveries.id in the top… May 16, 2026 at 4:39 pm

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 application. That application have a rich functionality. It can create
I have a WinForms form hosted in VB6 application (I am not sure if
I have a winforms application that the users must be able to change the
I have a winforms application. I have a textbox on one form (call F1)
I have a winForms DataGridView bound to a List<MyObjectType> . My problem is that
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.