FormatConvertedBitmap DestinationFormat Gray32Float BlackWhite
<Window x:Class="WpfApp410.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:WpfApp410" mc:Ignorable="d" WindowState="Maximized" WindowStyle="None" KeyDown="Window_KeyDown" Title="MainWindow" Height="450" Width="800"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition/> <ColumnDefinition/> </Grid.ColumnDefinitions> <Image Grid.Column="0" > <Image.Source> <FormatConvertedBitmap Source="/Images/1.jpg" DestinationFormat="Pbgra32"/> </Image.Source> </Image> <Image Grid.Column="1"> <Image.Source> <FormatConvertedBitmap Source="/Images/1.jpg" DestinationFormat="Gray32Float"/> </Image.Source> </Image> <Image Grid.Column="2"> <Image.Source> <FormatConvertedBitmap Source="/Images/1.jpg" DestinationFormat="BlackWhite"/> </Image.Source> </Image> </Grid> </Window> //cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace WpfApp410 { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private void Window_KeyDown(object sender, KeyEventArgs e) { if (Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.C) { var msgResult = MessageBox.Show("Are you sure to close the window?", "Close the window", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes); if (msgResult == MessageBoxResult.Yes) { this.Close(); } } } } }
#region Assembly PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 // location unknown // Decompiled with ICSharpCode.Decompiler 8.1.1.7464 #endregion namespace MS.Internal; internal enum PixelFormatEnum { Default = 0, Extended = 0, Indexed1 = 1, Indexed2 = 2, Indexed4 = 3, Indexed8 = 4, BlackWhite = 5, Gray2 = 6, Gray4 = 7, Gray8 = 8, Bgr555 = 9, Bgr565 = 10, Gray16 = 11, Bgr24 = 12, Rgb24 = 13, Bgr32 = 14, Bgra32 = 15, Pbgra32 = 16, Gray32Float = 17, Bgr101010 = 20, Rgb48 = 21, Rgba64 = 22, Prgba64 = 23, Rgba128Float = 25, Prgba128Float = 26, Rgb128Float = 27, Cmyk32 = 28 } #if false // Decompilation log '13' items in cache ------------------ Resolve: 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' Found single assembly: 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' Load from: 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\mscorlib.dll' ------------------ Resolve: 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' Found single assembly: 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' Load from: 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.dll' ------------------ Resolve: 'WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' Found single assembly: 'WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' Load from: 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\WindowsBase.dll' ------------------ Resolve: 'System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' Found single assembly: 'System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' Load from: 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Xaml.dll' ------------------ Resolve: 'UIAutomationTypes, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' Could not find by name: 'UIAutomationTypes, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' ------------------ Resolve: 'System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Could not find by name: 'System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' ------------------ Resolve: 'System.Windows.Input.Manipulations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' Could not find by name: 'System.Windows.Input.Manipulations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ------------------ Resolve: 'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' Found single assembly: 'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' Load from: 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Xml.dll' ------------------ Resolve: 'UIAutomationProvider, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' Could not find by name: 'UIAutomationProvider, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' ------------------ Resolve: 'System.Deployment, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Could not find by name: 'System.Deployment, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' #endif