├── .gitattributes
├── .gitignore
├── README.md
├── WriteableBitmapInWPF.sln
└── WriteableBitmapInWPF
├── App.config
├── App.xaml
├── App.xaml.cs
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── MainWindowViewModel.cs
├── NotificationObject.cs
├── Properties
├── AssemblyInfo.cs
├── Resources.Designer.cs
├── Resources.resx
├── Settings.Designer.cs
└── Settings.settings
└── WriteableBitmapInWPF.csproj
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | build/
21 | bld/
22 | [Bb]in/
23 | [Oo]bj/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 |
28 | # MSTest test Results
29 | [Tt]est[Rr]esult*/
30 | [Bb]uild[Ll]og.*
31 |
32 | # NUNIT
33 | *.VisualState.xml
34 | TestResult.xml
35 |
36 | # Build Results of an ATL Project
37 | [Dd]ebugPS/
38 | [Rr]eleasePS/
39 | dlldata.c
40 |
41 | # DNX
42 | project.lock.json
43 | artifacts/
44 |
45 | *_i.c
46 | *_p.c
47 | *_i.h
48 | *.ilk
49 | *.meta
50 | *.obj
51 | *.pch
52 | *.pdb
53 | *.pgc
54 | *.pgd
55 | *.rsp
56 | *.sbr
57 | *.tlb
58 | *.tli
59 | *.tlh
60 | *.tmp
61 | *.tmp_proj
62 | *.log
63 | *.vspscc
64 | *.vssscc
65 | .builds
66 | *.pidb
67 | *.svclog
68 | *.scc
69 |
70 | # Chutzpah Test files
71 | _Chutzpah*
72 |
73 | # Visual C++ cache files
74 | ipch/
75 | *.aps
76 | *.ncb
77 | *.opensdf
78 | *.sdf
79 | *.cachefile
80 |
81 | # Visual Studio profiler
82 | *.psess
83 | *.vsp
84 | *.vspx
85 |
86 | # TFS 2012 Local Workspace
87 | $tf/
88 |
89 | # Guidance Automation Toolkit
90 | *.gpState
91 |
92 | # ReSharper is a .NET coding add-in
93 | _ReSharper*/
94 | *.[Rr]e[Ss]harper
95 | *.DotSettings.user
96 |
97 | # JustCode is a .NET coding add-in
98 | .JustCode
99 |
100 | # TeamCity is a build add-in
101 | _TeamCity*
102 |
103 | # DotCover is a Code Coverage Tool
104 | *.dotCover
105 |
106 | # NCrunch
107 | _NCrunch_*
108 | .*crunch*.local.xml
109 |
110 | # MightyMoose
111 | *.mm.*
112 | AutoTest.Net/
113 |
114 | # Web workbench (sass)
115 | .sass-cache/
116 |
117 | # Installshield output folder
118 | [Ee]xpress/
119 |
120 | # DocProject is a documentation generator add-in
121 | DocProject/buildhelp/
122 | DocProject/Help/*.HxT
123 | DocProject/Help/*.HxC
124 | DocProject/Help/*.hhc
125 | DocProject/Help/*.hhk
126 | DocProject/Help/*.hhp
127 | DocProject/Help/Html2
128 | DocProject/Help/html
129 |
130 | # Click-Once directory
131 | publish/
132 |
133 | # Publish Web Output
134 | *.[Pp]ublish.xml
135 | *.azurePubxml
136 | ## TODO: Comment the next line if you want to checkin your
137 | ## web deploy settings but do note that will include unencrypted
138 | ## passwords
139 | #*.pubxml
140 |
141 | *.publishproj
142 |
143 | # NuGet Packages
144 | *.nupkg
145 | # The packages folder can be ignored because of Package Restore
146 | **/packages/*
147 | # except build/, which is used as an MSBuild target.
148 | !**/packages/build/
149 | # Uncomment if necessary however generally it will be regenerated when needed
150 | #!**/packages/repositories.config
151 |
152 | # Windows Azure Build Output
153 | csx/
154 | *.build.csdef
155 |
156 | # Windows Store app package directory
157 | AppPackages/
158 |
159 | # Visual Studio cache files
160 | # files ending in .cache can be ignored
161 | *.[Cc]ache
162 | # but keep track of directories ending in .cache
163 | !*.[Cc]ache/
164 |
165 | # Others
166 | ClientBin/
167 | [Ss]tyle[Cc]op.*
168 | ~$*
169 | *~
170 | *.dbmdl
171 | *.dbproj.schemaview
172 | *.pfx
173 | *.publishsettings
174 | node_modules/
175 | orleans.codegen.cs
176 |
177 | # RIA/Silverlight projects
178 | Generated_Code/
179 |
180 | # Backup & report files from converting an old project file
181 | # to a newer Visual Studio version. Backup files are not needed,
182 | # because we have git ;-)
183 | _UpgradeReport_Files/
184 | Backup*/
185 | UpgradeLog*.XML
186 | UpgradeLog*.htm
187 |
188 | # SQL Server files
189 | *.mdf
190 | *.ldf
191 |
192 | # Business Intelligence projects
193 | *.rdl.data
194 | *.bim.layout
195 | *.bim_*.settings
196 |
197 | # Microsoft Fakes
198 | FakesAssemblies/
199 |
200 | # Node.js Tools for Visual Studio
201 | .ntvs_analysis.dat
202 |
203 | # Visual Studio 6 build log
204 | *.plg
205 |
206 | # Visual Studio 6 workspace options file
207 | *.opt
208 |
209 | # LightSwitch generated files
210 | GeneratedArtifacts/
211 | _Pvt_Extensions/
212 | ModelManifest.xml
213 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # WriteableBitmapInWPF
2 | WriteableBitmap低开销更新WPFImage UI控件
3 |
4 | WPF的Image控件绑定资源对象WritableBitmap
5 |
6 | 1. 原始图片加载到bitmap对象
7 | 2. 转化bitmap对象为pixelformat是rgb32的bitmap
8 | 3. 再将其转化成rgb32的byte[]
9 | 4. Marshal.Copy()将得到的数组赋值入WritableBitmap的writableBitmap.BackBuffer指针指向的内存地址中
10 | 5. 最后更新界面UI
11 |
12 | ## 该方式的主要目的是降低了原来imagesource对象绑定之后,释放很慢的问题!
13 |
14 | run的时候,记得修改图片路径,我这边用的是12张 3072*2048 6M/pc bmp 8位图片
15 |
16 | 改进点:WritableBitmap初始化的地方,我这里初始化了rgb32的,如果初始化8位的,在Marshal.Copy()的时候回报异常。如果改进这里就不用第2步转化了
17 |
18 | 有大神有更好做法请指教,谢谢!
19 |
20 |
--------------------------------------------------------------------------------
/WriteableBitmapInWPF.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.23107.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WriteableBitmapInWPF", "WriteableBitmapInWPF\WriteableBitmapInWPF.csproj", "{3EB601C6-F129-4522-96A7-A802E9FEFD7A}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {3EB601C6-F129-4522-96A7-A802E9FEFD7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {3EB601C6-F129-4522-96A7-A802E9FEFD7A}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {3EB601C6-F129-4522-96A7-A802E9FEFD7A}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {3EB601C6-F129-4522-96A7-A802E9FEFD7A}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/WriteableBitmapInWPF/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/WriteableBitmapInWPF/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/WriteableBitmapInWPF/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace WriteableBitmapInWPF
10 | {
11 | ///
12 | /// App.xaml 的交互逻辑
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/WriteableBitmapInWPF/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/WriteableBitmapInWPF/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace WriteableBitmapInWPF
17 | {
18 | ///
19 | /// MainWindow.xaml 的交互逻辑
20 | ///
21 | public partial class MainWindow : Window
22 | {
23 | public MainWindow()
24 | {
25 | InitializeComponent();
26 | this.DataContext = new MainWindowViewModel();
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/WriteableBitmapInWPF/MainWindowViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Drawing;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Runtime.InteropServices;
7 | using System.Runtime.Serialization.Formatters.Binary;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 | using System.Windows;
11 | using System.Windows.Media.Imaging;
12 |
13 | namespace WriteableBitmapInWPF
14 | {
15 | public class MainWindowViewModel : NotificationObject
16 | {
17 | ///
18 | /// 图片1序号(起)
19 | ///
20 | private static readonly int INDEX_MIN = 0;
21 | ///
22 | /// 图片11序号(终)
23 | ///
24 | private static readonly int INDEX_MAX = 11;
25 | private int bitmapIndex = INDEX_MIN;
26 | private int writableBitmapIndex = INDEX_MIN;
27 | ///
28 | /// UI绑定的资源对象
29 | ///
30 | private WriteableBitmap writableBitmap;
31 | public WriteableBitmap WritableBitmap
32 | {
33 | get
34 | {
35 | return writableBitmap;
36 | }
37 |
38 | set
39 | {
40 | writableBitmap = value;
41 | this.RaisePropertyChanged("WritableBitmap");
42 | }
43 | }
44 | ///
45 | /// 循环加载图片
46 | ///
47 | public void runimg()
48 | {
49 | int i = 0;
50 | new Task(async ()=> {
51 | while (true)
52 | {
53 | if (i == 11)
54 | {
55 | i = 0;
56 |
57 | }
58 | using (Bitmap bmp =new Bitmap(GetUri(i))) // Bitmap.FromFile(GetUri(i)))
59 | {
60 | //其他格式的图片转32rgb
61 | using (Bitmap bitmap32 = new Bitmap(bmp.Width, bmp.Height, System.Drawing.Imaging.PixelFormat.Format32bppRgb))
62 | {
63 | using (Graphics g = Graphics.FromImage(bitmap32))
64 | {
65 | g.DrawImageUnscaled(bmp, 0, 0);
66 | }
67 | Console.WriteLine(bitmap32.PixelFormat);
68 | bool issc = false;
69 | string str = string.Empty;
70 | //Get8_From_Bitmap 初始化8位 则用该方法
71 | UpdateWritableBitmap(Get8_From_Bitmap(bmp, ref issc, ref str));
72 | //更新资源对象 Getgb32_From_Bitmap 初始化32位 则用该方法
73 | //UpdateWritableBitmap(GetRgb32_From_Bitmap(bitmap32, ref issc, ref str));
74 | }
75 | }
76 | i++;
77 | //休眠10ms
78 | await Task.Delay(10);
79 | }
80 | }).Start();
81 | }
82 | ///
83 | /// 帧写入
84 | ///
85 | ///
86 | private void UpdateWritableBitmap(BitmapFrame frame)
87 | {
88 | Application.Current.Dispatcher.Invoke(() =>
89 | {
90 | writableBitmap.Lock();
91 | frame.CopyPixels(new System.Windows.Int32Rect(0, 0, 3072, 2048), writableBitmap.BackBuffer, (int)writableBitmap.BackBufferStride * (int)writableBitmap.Height, (int)writableBitmap.BackBufferStride);
92 | writableBitmap.AddDirtyRect(new System.Windows.Int32Rect(0, 0, 3072, 2048));
93 | writableBitmap.Unlock();
94 | }, System.Windows.Threading.DispatcherPriority.Background);
95 | }
96 | ///
97 | /// 数组写入
98 | ///
99 | ///
100 | private void UpdateWritableBitmap(byte[] byt)
101 | {
102 | Application.Current.Dispatcher.Invoke(() =>
103 | {
104 | writableBitmap.Lock();
105 | Marshal.Copy(byt, 0, writableBitmap.BackBuffer, byt.Length);
106 | writableBitmap.AddDirtyRect(new System.Windows.Int32Rect(0, 0, 3072, 2048));
107 | writableBitmap.Unlock();
108 | }, System.Windows.Threading.DispatcherPriority.Background);
109 | }
110 | ///
111 | /// 将Image转换为byte[]
112 | ///
113 | ///
114 | ///
115 | public byte[] ConvertImage(Image image)
116 | {
117 | FileStream fs = new FileStream("imagetemp", FileMode.Create, FileAccess.Write, FileShare.None);
118 | BinaryFormatter bf = new BinaryFormatter();
119 | bf.Serialize(fs, (object)image);
120 | fs.Close();
121 | fs = new FileStream("imagetemp", FileMode.Open, FileAccess.Read, FileShare.None);
122 | byte[] bytes = new byte[fs.Length];
123 | fs.Read(bytes, 0, (int)fs.Length);
124 | fs.Close();
125 | return bytes;
126 | }
127 | ///
128 | /// 将bmp转换为byte[] 其实没有释放资源的引用保护 待改善
129 | ///
130 | ///
131 | ///
132 | public byte[] Convertbmp(Bitmap image)
133 | {
134 | byte[] bytes;
135 | using (MemoryStream ms = new MemoryStream())
136 | {
137 | image.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
138 | bytes = ms.GetBuffer();
139 | ms.Close();
140 | }
141 | return bytes;
142 | }
143 | ///
144 | /// Bitmap转换层RGB32
145 | ///
146 | /// Bitmap图片
147 | ///
148 | public byte[] GetRgb32_From_Bitmap(Bitmap Source, ref bool bError, ref string errorMsg)
149 | {
150 | byte[] pRrgaByte;
151 | try
152 | {
153 | bError = false;
154 | int lPicWidth = Source.Width;
155 | int lPicHeight = Source.Height;
156 | Rectangle rect = new Rectangle(0, 0, lPicWidth, lPicHeight);
157 | System.Drawing.Imaging.BitmapData bmpData = Source.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadWrite, Source.PixelFormat);
158 | IntPtr iPtr = bmpData.Scan0;
159 | int picSize = lPicWidth * lPicHeight * 4;
160 | pRrgaByte = new byte[picSize];
161 | System.Runtime.InteropServices.Marshal.Copy(iPtr, pRrgaByte, 0, picSize);
162 | Source.UnlockBits(bmpData);
163 | bError = true;
164 | errorMsg = "BMP数据转换成功";
165 | return pRrgaByte;
166 | }
167 | catch (Exception exp)
168 | {
169 | pRrgaByte = null;
170 | bError = false;
171 | errorMsg = exp.ToString();
172 | }
173 | return null;
174 | }
175 | public byte[] Get8_From_Bitmap(Bitmap Source, ref bool bError, ref string errorMsg)
176 | {
177 | byte[] pRrgaByte;
178 | try
179 | {
180 | bError = false;
181 | int lPicWidth = Source.Width;
182 | int lPicHeight = Source.Height;
183 | Rectangle rect = new Rectangle(0, 0, lPicWidth, lPicHeight);
184 | System.Drawing.Imaging.BitmapData bmpData = Source.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadWrite, Source.PixelFormat);
185 | IntPtr iPtr = bmpData.Scan0;
186 | int picSize = lPicWidth * lPicHeight;
187 | pRrgaByte = new byte[picSize];
188 | System.Runtime.InteropServices.Marshal.Copy(iPtr, pRrgaByte, 0, picSize);
189 | Source.UnlockBits(bmpData);
190 | bError = true;
191 | errorMsg = "BMP数据转换成功";
192 | return pRrgaByte;
193 | }
194 | catch (Exception exp)
195 | {
196 | pRrgaByte = null;
197 | bError = false;
198 | errorMsg = exp.ToString();
199 | }
200 | return null;
201 | }
202 | ///
203 | /// 图片路径
204 | ///
205 | ///
206 | ///
207 | private string GetUri(int index)
208 | {
209 | var directory = @"E:\DevelopProject\ImageTest3072_2048\"; //测试图片路径 鄙人用的12张6M/pc 3072*2048 bmp 8位黑白图
210 | var extention = ".jpg";//图片格式
211 |
212 | var fileName = bitmapIndex.ToString();
213 | bitmapIndex = (INDEX_MAX == bitmapIndex) ? (INDEX_MIN) : (bitmapIndex + 1);
214 |
215 | return directory + fileName + extention;
216 | }
217 | ///
218 | /// 构造
219 | ///
220 | public MainWindowViewModel()
221 | {
222 | //8位
223 | WritableBitmap = new WriteableBitmap(3072, 2048, 96, 96, System.Windows.Media.PixelFormats.Indexed8,BitmapPalettes.Gray256);
224 | //初始化一次
225 | //32rbg
226 | //WritableBitmap = new WriteableBitmap(3072, 2048, 96,96, System.Windows.Media.PixelFormats.Bgr32, null);
227 | runimg();
228 | }
229 |
230 | }
231 | }
232 |
--------------------------------------------------------------------------------
/WriteableBitmapInWPF/NotificationObject.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.ComponentModel;
6 |
7 | namespace WriteableBitmapInWPF
8 | {
9 | public class NotificationObject : INotifyPropertyChanged
10 | {
11 | public event PropertyChangedEventHandler PropertyChanged;
12 | public void RaisePropertyChanged(string propertyName)
13 | {
14 | if (this.PropertyChanged != null)
15 | {
16 | this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
17 | }
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/WriteableBitmapInWPF/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // 有关程序集的一般信息由以下
8 | // 控制。更改这些特性值可修改
9 | // 与程序集关联的信息。
10 | [assembly: AssemblyTitle("WriteableBitmapInWPF")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("WriteableBitmapInWPF")]
15 | [assembly: AssemblyCopyright("Copyright © 2018")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | //将 ComVisible 设置为 false 将使此程序集中的类型
20 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
21 | //请将此类型的 ComVisible 特性设置为 true。
22 | [assembly: ComVisible(false)]
23 |
24 | //若要开始生成可本地化的应用程序,请
25 | // 中的 .csproj 文件中
26 | //例如,如果您在源文件中使用的是美国英语,
27 | //使用的是美国英语,请将 设置为 en-US。 然后取消
28 | //对以下 NeutralResourceLanguage 特性的注释。 更新
29 | //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //主题特定资源词典所处位置
36 | //(当资源未在页面
37 | //或应用程序资源字典中找到时使用)
38 | ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
39 | //(当资源未在页面
40 | //、应用程序或任何主题专用资源字典中找到时使用)
41 | )]
42 |
43 |
44 | // 程序集的版本信息由下列四个值组成:
45 | //
46 | // 主版本
47 | // 次版本
48 | // 生成号
49 | // 修订号
50 | //
51 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
52 | // 方法是按如下所示使用“*”: :
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/WriteableBitmapInWPF/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本: 4.0.30319.42000
5 | //
6 | // 对此文件的更改可能导致不正确的行为,如果
7 | // 重新生成代码,则所做更改将丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace WriteableBitmapInWPF.Properties
12 | {
13 |
14 |
15 | ///
16 | /// 强类型资源类,用于查找本地化字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// 返回此类使用的缓存 ResourceManager 实例。
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WriteableBitmapInWPF.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// 覆盖当前线程的 CurrentUICulture 属性
56 | /// 使用此强类型的资源类的资源查找。
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/WriteableBitmapInWPF/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/WriteableBitmapInWPF/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace WriteableBitmapInWPF.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/WriteableBitmapInWPF/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/WriteableBitmapInWPF/WriteableBitmapInWPF.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {3EB601C6-F129-4522-96A7-A802E9FEFD7A}
8 | WinExe
9 | Properties
10 | WriteableBitmapInWPF
11 | WriteableBitmapInWPF
12 | v4.5
13 | 512
14 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
15 | 4
16 |
17 |
18 | AnyCPU
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | AnyCPU
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | 4.0
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 | MSBuild:Compile
56 | Designer
57 |
58 |
59 | MSBuild:Compile
60 | Designer
61 |
62 |
63 | App.xaml
64 | Code
65 |
66 |
67 | MainWindow.xaml
68 | Code
69 |
70 |
71 |
72 |
73 |
74 |
75 | Code
76 |
77 |
78 | True
79 | True
80 | Resources.resx
81 |
82 |
83 | True
84 | Settings.settings
85 | True
86 |
87 |
88 | ResXFileCodeGenerator
89 | Resources.Designer.cs
90 |
91 |
92 | SettingsSingleFileGenerator
93 | Settings.Designer.cs
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
108 |
--------------------------------------------------------------------------------