Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //I get image from simple resources (not an embedded)
- //At first I've created converter from a Bitmap to BitmapImage
- public static class BitmapSourceConverter
- {
- public static BitmapSource ConvertFromImage(Bitmap image)
- {
- return System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
- image.GetHbitmap(),
- IntPtr.Zero,
- System.Windows.Int32Rect.Empty,
- BitmapSizeOptions.FromEmptyOptions());
- }
- }
- //And usage
- pushButton.LargeImage = BitmapSourceConverter.ConvertFromImage(Resources.buttonImage);
- //where buttonImage is the image assembly resource which you can add via assembly properties.
- //Here is highlighted code: http://pastebin.com/ZcQYN78v
- //I think this code is more obvious and more simple than yours because there is no need to use assembly.
- //Hope this information is useful.
- //Best regards, Victor.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement