Download horizontallyscrollingcombobox.zip, last updated 13/07/2010 (11.88 KB)

Download
  • md5: de00358a12b9f95e5210e3ba8807e615
using System;
using System.Windows.Forms;

namespace HorizontallyScrollingComboBox
{
  public partial class MainForm : Form
  {
    // Example project demonstrating applying a horizontal scrollbar to a standard combobox
    // Original article and more at http://cyotek.com
    
    #region  Public Constructors  

    public MainForm()
    {
      InitializeComponent();
    }

		#endregion  Public Constructors  

		#region  Event Handlers  

    private void MainForm_Load(object sender, EventArgs e)
    {
      foreach (Control control in this.Controls)
      {
        if (control is ComboBox)
        {
          ComboBox box;

          box = (ComboBox)control;

          box.Items.Add("The quick brown fox jumped over the lazy dog. The quick brown fox jumped over the lazy dog. The quick brown fox jumped over the lazy dog.");
          box.Items.Add("Wolf zombies quickly spot the jinxed grave. Wolf zombies quickly spot the jinxed grave. Wolf zombies quickly spot the jinxed grave.");
          box.Items.Add("The lazy major was fixing Cupid's broken quiver. The lazy major was fixing Cupid's broken quiver. The lazy major was fixing Cupid's broken quiver.");

          box.SetHorizontalExtent();
        }
      }
    }

		#endregion  Event Handlers  
  }
}

Donate

Donate