Custom combobox with drawn images into datagrid view
===

I new to this custom datagridview column mechanism.  I'm want to have a combobox in a datagridview which will allow the user to pick different line styles (using DashStyle).  Tutorials i've found are either not for comboboxes or don't use drawing.  

I can already make a working custom standalone ComboBox by overriding the OnDrawItem(), using the code [here][1] 

But i am having trouble making a custom datagridview combobox column.  

 1. I want the comboboxcell's value to return a DashStyle.
 2. I am also having trouble with displaying the drawn item at the form load.  Setting the default startup value to Dashstyle.Solid writes "Solid" in the combobox.  When i click in it it will trigger the draw item...

Here is the code i have so far, based on other examples on the web :

    public class CustomComboBoxColumn : DataGridViewComboBoxColumn
    {
      public CustomComboBoxColumn()
      {
        CustomComboBoxCell cbc = new CustomComboBoxCell();
        this.CellTemplate = cbc;
      }
    }

    public class CustomComboBoxCell : DataGridViewComboBoxCell
    {
      public CustomComboBoxCell()
      : base() { }

      public override void InitializeEditingControl(int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle)
      {
        base.InitializeEditingControl(rowIndex, initialFormattedValue, dataGridViewCellStyle);

        var ctl = DataGridView.EditingControl as CustomComboBoxControl;

        if (this.Value == null)
          ctl.SelectedIndex = 0;
      }

      public override Type EditType
      {
        get { return typeof(CustomComboBoxControl); }
      }

      public override Type ValueType
      {
        get { return typeof(DashStyle); }
      }

      public override object DefaultNewRowValue
      {
        get { return DashStyle.Solid; }
      }

    }


    public class CustomComboBoxControl : MyComboBox, IDataGridViewEditingControl
    {
      private int index_ = 0;
      private DataGridView dataGridView_ = null;
      private bool valueChanged_ = false;

      public CustomComboBoxControl() : base()
      {
        this.SelectedIndexChanged += new EventHandler(ComboBoxControl_SelectedIndexChanged);
        this.DrawMode = DrawMode.OwnerDrawVariable;
        this.DropDownStyle = ComboBoxStyle.DropDownList;
      }


      public void ComboBoxControl_SelectedIndexChanged(object sender, EventArgs e)
      {
        NotifyDataGridViewOfValueChange();
      }


      protected virtual void NotifyDataGridViewOfValueChange()
      {
        this.valueChanged_ = true;
        if (this.dataGridView_ != null)
        {
          this.dataGridView_.NotifyCurrentCellDirty(true);
        }
      }

      public void ApplyCellStyleToEditingControl(DataGridViewCellStyle dataGridViewCellStyle) {      }

      public DataGridView EditingControlDataGridView
      {
        get { return dataGridView_; }
        set { dataGridView_ = value; }
      }

      public object EditingControlFormattedValue
      {
        get { return base.SelectedValue; }
        set { base.SelectedValue = value; NotifyDataGridViewOfValueChange(); }
      }

      public int EditingControlRowIndex
      {
        get { return index_; }
        set { index_ = value; }
      }

      public bool EditingControlValueChanged
      {
        get { return valueChanged_; }
        set { valueChanged_ = value; }
      }

      public bool EditingControlWantsInputKey(Keys keyData, bool dataGridViewWantsInputKey)
      {
        if (keyData == Keys.Return)
          return true;
        switch (keyData & Keys.KeyCode)
        {
          case Keys.Up:
          case Keys.Down:
            return true;
          default:
            return false;
        }
      }

      public Cursor EditingPanelCursor
      {
        get { return base.Cursor; }
      }

      public object GetEditingControlFormattedValue(DataGridViewDataErrorContexts context)
      {
        var val = EditingControlFormattedValue;
        if (val == null)
          val = DashStyle.Solid;
        return val.ToString();
      }

      public void PrepareEditingControlForEdit(bool selectAll) { }

      public bool RepositionEditingControlOnValueChange
      {
        get { return false; }
      }

    }

I appreciate any information about what i'm doing wrong and how this works... 

  [1]: http://stackoverflow.com/questions/10891214/c-sharp-combobox-with-lines