about image height and width.

Sep 16, 2009 at 6:59 AM

question 1:
  SourceGrid.Cells.Cell cellImage = new SourceGrid.Cells.Cell();
  cellImage.Image = Image.FromFile("c:\001.jpg");
  grid[r, c] = cellImage;                                                             
  grid[r, c].Editor = null;
  SourceGrid.Cells.Views.Cell test = new SourceGrid.Cells.Views.Cell(viewImage);
  test.ImageAlignment = DevAge.Drawing.ContentAlignment.TopLeft;
  grid[r, c].View = test;
 
  ** How can i set this Image's height and width?
 
 
question 2:
  SourceGrid.Cells.Cell cellImage = new SourceGrid.Cells.Cell();   
  SourceGrid.Cells.Views.MultiImages modelMultiImages = new SourceGrid.Cells.Views.MultiImages();
  modelMultiImages.SubImages.Add(new DevAge.Drawing.VisualElements.Image.FromFile("c:\001.jpg");
  modelMultiImages.SubImages.Add(new DevAge.Drawing.VisualElements.Image.FromFile("c:\002.jpg");
  modelMultiImages.SubImages[0].AnchorArea = new DevAge.Drawing.AnchorArea(DevAge.Drawing.ContentAlignment.TopLeft, false);
  modelMultiImages.SubImages[1].AnchorArea = new DevAge.Drawing.AnchorArea(DevAge.Drawing.ContentAlignment.TopRight, false);
  grid[r, c].View = modelMultiImages;
 
  ** How can i set image's height and width (image[0], image[1]) ?

Coordinator
Sep 23, 2009 at 12:52 PM

See sample 03, there is an example "Stretch image" which shows how to stretch image.


You can then size your cell accordingly to achieve your desired effect

Oct 5, 2009 at 1:33 AM

SourceGrid.Cells.Cell cellImage = new SourceGrid.Cells.Cell();
System.Drawing.Image img0 = System.Drawing.Image.FromFile("c:\001.jpg");
System.Drawing.Image img1 = img0.GetThumbnailImage(30, 30, null, IntPtr.Zero);
cellImage.Image = img1;

grid[r, c] = cellImage; 

 

it's my  solution. ^^ and Thank you.