public static FromImage ( Image img ) : |
||
img | Image | |
Résultat |
/// <summary> /// convert an Image to an OLE Picture IPictureDisp interface /// </summary> /// <param name="image"></param> /// <returns></returns> public static IPictureDisp ToOLE_IPictureDisp(Image image) { #if !__MonoCS__ return(AxHost.GetIPictureDispFromPicture(image) as IPictureDisp); #else return(ImagePicture.FromImage(image)); #endif }
public void ImagePictureClass() { const int width = 100; const int height = 200; using (Image testImage = new Bitmap(width, height)) { using (ImagePicture i = ImagePicture.FromImage(testImage)) { Assert.AreEqual(new HiMetric(width, i.DpiX).Value, i.Width, "A1"); Assert.AreEqual(new HiMetric(height, i.DpiY).Value, i.Height, "A2"); } } }