Currently I am adding images into cells (effectively replacing the UltraValidator) but I've run into some problems with the image format and so forth.My question is: Which format does my image need to be in to be used in a cell? Dimensions? And what encoding should I use? ie) A .bmp may be saved in R5 G5 B5 or R8 G8 B8 etc
Here's a nice clear, concise image we are familiar with.
.
Here's an example of what my images appear as.. and yes I did add an alpha layer which doesn't seem to be working.
Well, if you use a DrawFilter and just set the image on the existing ImageUIElement in the cell, then the grid will take care of several things for you:
1) It will position the element in the cell and give it a size and position.
2) Other elements, such as the Text in the cell, will be moved over to accommodate the image.
3) The ImageUIElement won't draw outside the cell.
Why are you using a DrawFilter or CreationFilter here at all? Why not simply set the Appearance on the cell?
Mike Saltzman said:It makes no difference to the grid. If you are using a DrawPhase, then I assume that means you are using a DrawFilter and just setting the Image property on the drawParams.AppearanceData.Image property.
Hi,
rzabransky said:Which format does my image need to be in to be used in a cell? Dimensions? And what encoding should I use? ie) A .bmp may be saved in R5 G5 B5 or R8 G8 B8 etc
It makes no difference to the grid. If you are using a DrawPhase, then I assume that means you are using a DrawFilter and just setting the Image property on the drawParams.AppearanceData.Image property. This property is of type System.Drawing.Image. How you get that image or from what format it comes are all part of the DotNet Framework and has nothing to do with the grid.
As for Alpha channels, the last I heard, there is no support for them in the DotNet Framework. They do support transparency in an image, but once again, that's nothing to do with the grid, it's part of the Image itself. So you will need to check Microsoft's documentation for details on that. Personally, I have used the MakeTransparent method, myself, and it works well.
Regarding the size of the image, that's entirely up to you and the size (mainly the height) of your grid rows. If you want bigger images, make the grid rows bigger. If you just want to make your image fit the existing grid row, then you could use the size of the ImageUIElement as your guide.