We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Combobox + browse button

Thread ID:





61436 May 25,2007 01:17 PM UTC May 25,2007 06:08 PM UTC WinForms 2
Tags: GridControl
Dan Dorey
Asked On May 25, 2007 01:17 PM UTC

Hi, I'm using v5.

I'm looking to make a cell that has the functionality of a combo box plus have another button (i.e. [...]) that will allow the user to load up another form. I can make a cell that does both of these, but not sure what the best approach is for combining them.

Should I be inheriting from GridCellComboBoxButton, GridCellComboBoxModel, GridCellComboBoxRenderer and then adding my own browse button? We only have the binaries so I don't know if it's going to hurt that I can't see the underlying code.

Thanks for any advice.


haneefm [Syncfusion]
Replied On May 25, 2007 03:09 PM UTC

Hi Dan,

You can show two buttons in the cell where you now have one. You can do it by deriving the GridComboBoxCellrenderer class. In that renderer's constructor you can add another button by using the AddButton method. Below is a forum thread that show this task.


Let me know if this helps.

Best regards,

Dan Dorey
Replied On May 25, 2007 06:08 PM UTC

Thanks! I was able to figure it out from that example. It was slightly different in 5.0. I'll paste what I ended up with in case it's useful to anyone else.

using System;
using System.Collections;
using System.Diagnostics;
using System.Drawing;
using System.Runtime.Serialization;
using System.Windows.Forms;
using System.IO;
using System.Drawing.Imaging;

using Syncfusion.Diagnostics;
using Syncfusion.Windows.Forms.Grid;

namespace Syncfusion.Windows.Forms.Diagram.Samples.DiagramTool.Pages

public class PlaylistCellModel : GridComboBoxCellModel

protected PlaylistCellModel(SerializationInfo info, StreamingContext context)
: base(info, context)
this.ButtonBarSize = new Size(50, 50);

public PlaylistCellModel(GridModel grid)
: base(grid)

public override GridCellRendererBase CreateRenderer(GridControlBase control)
return new PlaylistCellRenderer(control, this);

protected override Size OnQueryPrefferedClientSize(Graphics g, int rowIndex, int colIndex, GridStyleInfo style, GridQueryBounds GridQueryBounds)
Size size = base.OnQueryPrefferedClientSize(g, rowIndex, colIndex, style, GridQueryBounds);
return new Size(size.Width + 50, size.Height); // base method already consides ButtonBarSize, but let's add some more pixels here.


public class PlaylistCellRenderer : GridComboBoxCellRenderer

public PlaylistCellRenderer(GridControlBase grid, GridTextBoxCellModel cellModel)
: base(grid, cellModel)
this.SupportsFocusControl = false;

GridCellButton button = new GridCellButton(this);
button.Text = "...";
button.Clicked += new GridCellEventHandler(button_Clicked);


void button_Clicked(object sender, GridCellEventArgs e)

protected override System.Drawing.Rectangle OnLayout(int rowIndex, int colIndex, GridStyleInfo style, System.Drawing.Rectangle innerBounds, System.Drawing.Rectangle[] buttonsBounds)

// buttonBounds[] defines the location of where the buttons are drawn.
// innnerBounds is the rectangle of the entire cell

// Define the rectangles that will contain our buttons (we're button the combo arrow before the [...]
System.Drawing.Rectangle comboButtonBounds = System.Drawing.Rectangle.FromLTRB(innerBounds.Right - 40, innerBounds.Top, innerBounds.Right -20, innerBounds.Bottom);
System.Drawing.Rectangle ellipseButtonBounds = System.Drawing.Rectangle.FromLTRB(innerBounds.Right - 20, innerBounds.Top, innerBounds.Right, innerBounds.Bottom);

// The underlying code will have already set the location of the combo button, but we have to move it over to the left.
// Since that was the first button used, it will be index 0. We then set the location of our new [...] button.
buttonsBounds[0] = comboButtonBounds;
buttonsBounds[1] = ellipseButtonBounds;

// this is how much space between the buttons and the text to the left of it.
innerBounds.Width -= 20;
return innerBounds;




This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon