title: C# override OnDrawItem
body: <p><img src="https://i.stack.imgur.com/LpFkD.png" alt="enter image description here">I am making a trying to make this combo box: see picture attached. For the LineStyle combo box.</p>
  
  <p>Here's the code I have so far</p>
  
  <pre><code>public partial class frmDlgGraphOptions : Form
        public partial class frmDlgGraphOptions : Form
      {
          public frmDlgGraphOptions()
          {
              InitializeComponent();
              CmbBoxlineStyles.DropDownStyle = ComboBoxStyle.DropDownList;
  
          }
  
          public override void OnDrawItem(DrawItemEventArgs e)
          {
               // Get the item.
  
        var item = this.CmbBoxlineStyles.SelectedIndex.ToString();
        if(item == null)
           return;
  
        int startX = e.Bounds.X;
        int startY = (e.Bounds.Y + 1);
  
        int endX = e.Bounds.X + 5;
        int endY = (e.Bounds.Y + 1);
  
  
        //Draw the lines 
        Pen pen = new Pen(Color.Blue);
  
        e.Graphics.DrawLine(pen, new Point(startX, startY), new Point(endX, endY));
  
  
  
          }
  
      }
  </code></pre>
  
  <p>I am getting this error: Error  1   'Fdrc.frmDlgGraphOptions.OnDrawItem(System.Windows.Forms.DrawItemEventArgs)': no suitable method found to override  </p>
  
  <p>Thank you
  Sun</p>