Home Forums WinForms controls Xceed Grid for WinForms Row containing Controls on FooterRows

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #15284 |

    Hi,

    I would like to display a row containing a lable and a control (textbox or combobox) in footer rows.
    I am able to do this using the ValueRow but the cells are determined by the grid columns and hence the control I display takes the width of my second column, while the lable takes the width of the first column which I dont want.

    What I wanted is something like,

    “Number : [ ]” where the square barces are the control

    How do I accomplish this?

    Imported from legacy forums. Posted by userX (had 1827 views)

    User (Old forums)
    Member
    Post count: 23064

    I was finally able to solve this problem, by inherting from the Row class and overriding the PaintForeGround method. It looks exactly like the way i wanted it.
    Here is the code if anyone else came across similar problem,

    protected override void PaintForeground(GridPaintEventArgs e)
    {
    SizeF stringSize;
    using (Brush brush = new SolidBrush(this.GetDisplayForeColor()))
    {
    Rectangle layoutRectangle = e.DisplayRectangle;
    layoutRectangle.X++;
    layoutRectangle.Height -= 2;
    layoutRectangle.Y+=3;
    e.Graphics.DrawString(“The lable:”, base.Font, brush, layoutRectangle, GetDisplayStringFormat());
    stringSize = e.Graphics.MeasureString(“The lable:”, base.Font);
    }

    Rectangle clientRectangle = ClientRectangleToGrid(e.DisplayRectangle);
    _control.Location= new Point(clientRectangle.X + 2 + (int)stringSize.Width, clientRectangle.Y + 1);
    _control.Parent = _parentGridControl;
    _control.BringToFront();
    _control.Visible = true;

    }

    Imported from legacy forums. Posted by userX (had 2982 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.