/// <summary> /// DrawControl /// </summary> /// <param name="di"></param> /// <param name="r"></param> /// <param name="bm"></param> /// <param name="g"></param> /// <param name="oc"></param> /// <param name="s"></param> private void DrawControl(ComboBoxEx di, Rectangle r, Bitmap bm, Graphics g, DataGridViewComboBoxExColumn oc, string s) { Rectangle t = di.GetThumbRect(new Rectangle(0, 0, r.Width, r.Height)); if (t.IsEmpty == false) { // Work around Windows XP and Windows DropDownList // DrawToBitmap problems if (MustRenderVisibleControl(di.DropDownStyle) == true) { di.Location = oc.DataGridView.Location; if (di.Parent == null) { Form form = oc.DataGridView.FindForm(); if (form != null) di.Parent = form; } di.SendToBack(); di.Visible = true; } using (Bitmap bm2 = new Bitmap(bm)) { di.Bounds = r; di.DrawToBitmap(bm2, r); t.X += r.X; t.Y += r.Y; g.DrawImage(bm2, t, t, GraphicsUnit.Pixel); if (t.Left < r.Right) r.Width -= (r.Right - t.Left - 3); } di.Visible = false; } DrawText(di, r, g, s); }