Created
September 30, 2018 17:14
-
-
Save abfo/3af4c811b4bdd5ea1793c66297a8b737 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| BitmapSource shieldSource = null; | |
| if (Environment.OSVersion.Version.Major >= 6) | |
| { | |
| SHSTOCKICONINFO sii = new SHSTOCKICONINFO(); | |
| sii.cbSize = (UInt32) Marshal.SizeOf(typeof(SHSTOCKICONINFO)); | |
| Marshal.ThrowExceptionForHR(SHGetStockIconInfo(SHSTOCKICONID.SIID_SHIELD, | |
| SHGSI.SHGSI_ICON | SHGSI.SHGSI_SMALLICON, | |
| ref sii)); | |
| shieldSource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHIcon( | |
| sii.hIcon, | |
| Int32Rect.Empty, | |
| BitmapSizeOptions.FromEmptyOptions()); | |
| DestroyIcon(sii.hIcon); | |
| } | |
| else | |
| { | |
| shieldSource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHIcon( | |
| System.Drawing.SystemIcons.Shield.Handle, | |
| Int32Rect.Empty, | |
| BitmapSizeOptions.FromEmptyOptions()); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment