Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*************************************************/
- /* .ico image embedded into .RESX file * START */
- PushButton pButton = rPanel.AddItem(buttonData) as PushButton;
- Icon icon = Properties.Resources.AG_Asset_Protector_Icon;
- MemoryStream ms = new MemoryStream();
- icon.Save(ms);
- ms.Position = 0;
- BitmapImage bLargeImage = new BitmapImage();
- bLargeImage.BeginInit();
- bLargeImage.StreamSource = ms;
- bLargeImage.EndInit();
- pButton.LargeImage = bLargeImage;
- ms.Dispose();
- /* .ico image embedded into .RESX file * END */
- /*************************************************/
- /* .ico image embedded as file by itself * START */
- PushButton pButton = rPanel.AddItem(buttonData) as PushButton;
- BitmapImage bLargeImage = new BitmapImage();
- bLargeImage.BeginInit();
- bLargeImage.UriSource = new Uri("pack://application:,,,/AG_View_Bookmarks;component/Images/bookmark-ui-32.ico");
- bLargeImage.EndInit();
- pButton.LargeImage = bLargeImage;
- // bLargeImage.UriSource = new Uri("pack://application:,,,/AG_View_Bookmarks;component/Images/bookmark-ui-32.png");
- // ^-- Interestingly enough this below crops the image although it also is 32x32 like the ico...
- /* .ico image embedded as file by itself * END */
- /*************************************************/
- /* .ico image called from a directory * START */
- PushButton pButton = rPanel.AddItem(buttonData) as PushButton;
- Uri uriImage = new Uri(@"c:\AG_Tools\AG_ButtonOpenSheets_P.ico");
- BitmapImage bLargeImage = new BitmapImage(uriImage);
- pButton.LargeImage = bLargeImage;
- /* .ico image called from a directory * END */
- /*************************************************/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement