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

fit custom control to grid cell ?

Hi, Is it possible when adding a custom control in a cell (or range of cells) to adapt the control size to the cell(s) size ? I have added my control by doing this: e.Style.CellType := ''Control''; grid.CoveredRanges.Add(GridRangeInfo.Cells(3,4,4,4)); e.Style.Control := PictureBox1; (I would like that my picture fit exactly the two cells in which it is). Verane.

1 Reply

AD Administrator Syncfusion Team August 27, 2004 06:20 AM UTC

I think the control (pictureBox1) is automatically being sized to fit in the covered cell. (The grid can do this.) But it is the actual bitmap whose size you probably need to adjust, and the grid has no knowledge about what is in the control you are using. So, you will have to size the bitmap yourself somehow. You can use grid.RangeInfoToRectangle to get the size of the target rectangle you need. To see some techniques for sizing bitmaps, take a look at the Grid\Samples\DataBound\GridDataBoundImageCell sample. It sizes pcitures in a grid cell using vaious techniques.

Loader.
Live Chat Icon For mobile
Up arrow icon