title: Adjusting ComboBox DropDown Width in C#
body: <p>I have this code that adjusts the width of a comboBox drop-down:</p>
  
  <pre><code>  private void comboBox_DropDown(object sender, EventArgs e)
    {
       ComboBox senderComboBox = (ComboBox)sender;
       int width = senderComboBox.DropDownWidth;
       Graphics g = senderComboBox.CreateGraphics();
       Font font = senderComboBox.Font;
       int vertScrollBarWidth =
           (senderComboBox.Items.Count &gt; senderComboBox.MaxDropDownItems)
           ? SystemInformation.VerticalScrollBarWidth : 0;
       int newWidth;
  
       foreach (string s in ((ComboBox)sender).Items)
       {
          newWidth = (int)g.MeasureString(s, font).Width
              + vertScrollBarWidth;
  
          if (width &lt; newWidth)
          {
             width = newWidth;
          }
       }
  
       senderComboBox.DropDownWidth = width;
    }
  </code></pre>
  
  <p>It works great, except it expands the width of the drop-down to the right, whereas I would prefer it to expand to the left because the comboBox is located on the right side of my form.  Any thoughts or suggestions you may have would be appreciated.  Thanks.</p>