We have had excellent success using the RibbonControlHost to place a C1FlexGrid inside the ribbon. - Our language is C#
The reason for the flexgrid is to provide an adaptable column on/off filter for the flexgrid and/or chart that is displayed below the ribbon. Hence the height of the flexgrid is only 2 rows high and does not conflict with the ribbon group maximum height.
Here is the code...
using
C1.Win.C1FlexGrid;
using
C1.C1Preview;namespace StrategyMap
{
public partial class frmExportToGrid :Form
{
public frmExportToGrid()
{
InitializeComponent();
}
class FlexGridHost : C1.Win.C1Ribbon.RibbonControlHost
{
public FlexGridHost() : base(new C1FlexGrid())
{
}
[Browsable(false)]
[
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]public C1FlexGrid C1FlexGrid
{
get { return (C1FlexGrid)Control; }
}
}
#region
Global Variables
--------
Here is the Click event, note that we deal directly with the flexgrid here...
private void flxColumnFilter_Click(object sender, EventArgs e)
{
Point pt = Control.MousePosition;
pt = flxColumnFilter.C1FlexGrid.PointToClient(pt);
HitTestInfo hti = flxColumnFilter.C1FlexGrid.HitTest(pt.X, pt.Y);
int iRow = hti.Row, iCol = hti.Column;bool ColIsVisible = Utilities.Convert_ToBoolean(flxColumnFilter.C1FlexGrid[1,iCol].ToString());if (iRow == 0)
{
ColIsVisible = !ColIsVisible;
flxColumnFilter.C1FlexGrid[1, iCol] = ColIsVisible;
}
flxExport.Cols[iCol-1].Visible = ColIsVisible;
}
------------
Here is where we setup the flexgrid...
flxColumnFilter.Width = 960;
// adjust the ribbon group width - note that we dealt with the flexgrid directly to set the group size
flxColumnFilter.C1FlexGrid.Clear(); // now we need to deal woth the C1FlexGrid object to set special properties
flxColumnFilter.C1FlexGrid.Redraw = false;
if (flxExport.Rows.Fixed > 0) ColumnNameRow = flxExport.Rows.Fixed - 1;flxColumnFilter.C1FlexGrid.AllowSorting = AllowSortingEnum.None;
flxColumnFilter.C1FlexGrid.Height = 60;
flxColumnFilter.C1FlexGrid.Rows.Count = 2;
flxColumnFilter.C1FlexGrid.Rows.Fixed = 1;
flxColumnFilter.C1FlexGrid.Cols.Count = flxExport.Cols.Count+1;
flxColumnFilter.C1FlexGrid.Cols.Fixed = 1;