예제 #1
0
        public void GetPictureFromIPicture()
        {
            using Icon icon     = SystemIcons.Exclamation;
            using Bitmap bitmap = icon.ToBitmap();
            IPicture picture = MockAxHost.GetIPictureFromPicture(bitmap);

            Assert.NotNull(picture);
            using Image image = MockAxHost.GetPictureFromIPicture(picture);
            Assert.NotNull(image);
            Assert.Equal(bitmap.Size, image.Size);
        }
예제 #2
0
        public void GetIPictureFromImage()
        {
            using MockCursor arrow = new MockCursor(CursorResourceId.IDC_ARROW);
            using Icon icon        = Icon.FromHandle(arrow.Handle);
            using Bitmap bitmap    = icon.ToBitmap();
            IPicture picture = MockAxHost.GetIPictureFromPicture(bitmap);

            Assert.NotNull(picture);
            Assert.Equal(PICTYPE.BITMAP, (PICTYPE)picture.Type);

            Assert.Equal(bitmap.Size.Height, GdiHelper.HimetricToPixelY(picture.Height));
            Assert.Equal(bitmap.Size.Width, GdiHelper.HimetricToPixelX(picture.Width));
        }