/// <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 (Platform.IsWindows) { return(AxHost.GetIPictureDispFromPicture(image) as IPictureDisp); } return(ImagePicture.FromImage(image)); }
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"); } } }