@Dear Deepak Sharma, I want your help

  • changing 3 months, 2 weeks ago

    Dear Deepak Sharma,

    yesterday you gave me a costum combocell. It works very well.
    But the dropdown button of this combobox looks a littel strange.
    Look at the picture Cell[0,0] is myComboCellType, Cell[0,1] is ComboBoxCellType. How can I set the dropdown button of Cell[0,0] same as Cell[0,1]

    Thanks a lot

    public class myComboCellType : ComboBoxCellType
    public override void PaintCell(Graphics g, Rectangle r, FarPoint.Win.Spread.Appearance appearance, object value, bool isSelected, bool isLocked, float zoomFactor)
    SolidBrush brushBack = new SolidBrush(appearance.BackColor);
    SolidBrush brushFore = new SolidBrush(appearance.ForeColor);
    StringFormat objStringFormat = new StringFormat();
    RectangleF rectfText = default(RectangleF);

    Rectangle rectButton = default(Rectangle);
    g.FillRectangle(brushBack, r);
    rectButton = new Rectangle(r.Right – 17, r.Y, 17, r.Height);
    ControlPaint.DrawComboButton(g, rectButton, ButtonState.Normal);
    if (value!=null)
    objStringFormat.Alignment = StringAlignment.Near;
    objStringFormat.LineAlignment = StringAlignment.Near;

    rectfText = new RectangleF(r.X, r.Y, r.Width – 18, r.Height);
    g.DrawString(value.ToString(), appearance.Font, brushFore, rectfText, objStringFormat);

    //base.PaintCell(g, r, appearance, value, isSelected, isLocked, zoomFactor);


    You must be logged in to view attched files.
  • 122p
    Sean Lawyer122p 3 months, 2 weeks ago


    You can use ComboBoxRenderer instead of ControlPaint; see here for details.


Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to create new topics.