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. Image for the cookie policy date


Can I use floating cell support within a GridDataBoundGrid? Or is it not possible because such grids are column oriented in nature? Maybe the fact that my grid is readonly is relevant? E.g. I tried something along the lines of: m_gridJobs[2,2].Trimming = StringTrimming.None; m_gridJobs[2,2].FloatCell = true; m_gridJobs[2,3].FloodCell = true; m_gridJobs[2,4].FloodCell = true; m_gridJobs[2,2].Text = "My longer text message."; Doesn't seem to work though. Regards, Dave.

4 Replies

AD Administrator Syncfusion Team July 27, 2003 02:22 PM UTC

In order for a cell to float over an adjacent cell, the adjacent cell must be empty. So, is this case in your DataSource? If not, then you will not be able to float. Another point is a general one regarding GridDataBoundGrids. You cannot use an indexer to set any style property other than Text (or CellValue). The reason is that there is no cell specific storage allocated in a GridDataBoundGrid. So, to set the Float style properties, you would either have to use the GridBoundColumn.StyleInfo property an dset teh whole column to float, or you woul dhave to handle the Model.QueryCellInfo property, and set it there on a cell by cell basis. You also should set the FloatCellsMode property: this.gridControl1.Model.Options.FloatCellsMode = GridFloatCellsMode.BeforeDisplayCalculation; Attached is a little sample.

DK Dave Karetnyk July 28, 2003 06:25 AM UTC

Clay, Thanks - I can see what I'm doing wrong now. And reading back my original mail - this is what I suspected! I.e. not that there was something wrong with your code...:-) However, maybe not such a good solution to the problem I have anyway. I tried it as an alternative to my BackgroundImage property attempt. Attached screen dump might clarify what I'm trying to do. I need a set of grids on screen where the content changes as the user navigates through them. Point it to display something in the grid to the user when it has no content. A few issues. 1. Sample is no good, I've used a bitmap with the same color as the current desktop - I tried to use a gif with a transparent background but it gets converted to black? 2. The row and column headers become transparent too? Which I don't want. 3. I also tried setting the grid BackColor to Web.Transparent, but get an error indicating that the control doesn't support transparent background colors. 4. From Prosise book, I see that I can paint transparent gifs directly onto the Windows Form itself, on the paint message say. I guess that would work if I made the grid transparent but then I'd still have the trasparent header problem. Also, seems like a kinda ugly solution. General question then is whether I can solve this sensibly in the grids at all. Maybe I need to provide feedback to the user from somewhere else on the ui. Maybe I'm missing an obvious solution to this that you can see? Cheers, Dave

AD Administrator Syncfusion Team July 28, 2003 08:01 AM UTC

Have you tried handling the Paint event, and if the grid is empty, explcit draw your string there?
private void Form1_Load(object sender, EventArgs e)
	this.gridDataBoundGrid1.SmoothControlResize = false;

private void gridDataBoundGrid1_Paint(object sender, PaintEventArgs e)
	// test for empty somehow...
		RectangleF rect = this.gridDataBoundGrid1.Bounds;
		rect = new RectangleF(rect.Left + 100, rect.Top + 100, rect.Width - 100, rect.Height - 100);
		e.Graphics.DrawString("Choose from above...", this.gridDataBoundGrid1.Font, Brushes.Blue, rect  );

DK Dave Karetnyk July 28, 2003 10:04 AM UTC

Oh! Nice solution. You can tell I've spent most of my coding days in places where the ui does not shine. Thanks, Dave.

Live Chat Icon For mobile
Up arrow icon