├── .gitattributes ├── .gitignore ├── LICENSE ├── README.md ├── UpdateFromOrigin.bat ├── image └── ScreenShot.PNG └── src ├── BlurMessageBox.sln ├── BlurMessageBox ├── AnimateMsgBox.cs ├── AnimateStyle.cs ├── BlurMessageBox.csproj ├── BlurWindow.cs ├── Buttons.cs ├── FormMessageBox.cs ├── Icons.cs ├── MsgBox.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Localization.Designer.cs │ ├── Localization.ar.Designer.cs │ ├── Localization.ar.resx │ ├── Localization.az.Designer.cs │ ├── Localization.az.resx │ ├── Localization.fa-IR.Designer.cs │ ├── Localization.fa-IR.resx │ ├── Localization.fr-FR.Designer.cs │ ├── Localization.fr-FR.resx │ ├── Localization.resx │ ├── Localization.ru-RU.Designer.cs │ ├── Localization.ru-RU.resx │ ├── Localization.tr-TR.Designer.cs │ └── Localization.tr-TR.resx └── obj │ └── Debug │ └── BlurMessageBox.csproj.FileListAbsolute.txt ├── TestWPF ├── App.xaml ├── App.xaml.cs ├── MainWindow.xaml ├── MainWindow.xaml.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── TestWPF.csproj ├── app.config └── obj │ └── Debug │ ├── App.g.cs │ ├── App.g.i.cs │ ├── MainWindow.baml │ ├── MainWindow.g.cs │ ├── MainWindow.g.i.cs │ ├── TestWPF.Properties.Resources.resources │ ├── TestWPF.csproj.FileListAbsolute.txt │ └── TestWPF.g.resources └── TestWinForms ├── Form1.Designer.cs ├── Form1.cs ├── Form1.resx ├── Program.cs ├── Properties ├── AssemblyInfo.cs ├── Resources.Designer.cs ├── Resources.resx ├── Settings.Designer.cs └── Settings.settings ├── TestWinForms.csproj ├── app.config └── obj └── Debug ├── TestWinForms.Form1.resources ├── TestWinForms.Properties.Resources.resources └── TestWinForms.csproj.FileListAbsolute.txt /.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 | *.sln.docstates 8 | 9 | # Build results 10 | 11 | [Dd]ebug/ 12 | [Rr]elease/ 13 | x64/ 14 | build/ 15 | [Bb]in/ 16 | [Oo]bj/ 17 | [Oo]ut/ 18 | [Nn]uGetPackages/ 19 | 20 | 21 | # Disable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets 22 | [Pp]ackages/ 23 | 24 | # MSTest test Results 25 | [Tt]est[Rr]esult*/ 26 | [Bb]uild[Ll]og.* 27 | 28 | *_i.c 29 | *_p.c 30 | *.ilk 31 | *.meta 32 | *.obj 33 | *.pch 34 | *.pdb 35 | *.pgc 36 | *.pgd 37 | *.rsp 38 | *.sbr 39 | *.tlb 40 | *.tli 41 | *.tlh 42 | *.tmp 43 | *.tmp_proj 44 | *.log 45 | *.vspscc 46 | *.vssscc 47 | .builds 48 | *.pidb 49 | *.log 50 | *.scc 51 | 52 | # Visual C++ cache files 53 | ipch/ 54 | *.aps 55 | *.ncb 56 | *.opensdf 57 | *.sdf 58 | *.cachefile 59 | 60 | # Visual Studio profiler 61 | *.psess 62 | *.vsp 63 | *.vspx 64 | 65 | # Guidance Automation Toolkit 66 | *.gpState 67 | 68 | # ReSharper is a .NET coding add-in 69 | _ReSharper*/ 70 | *.[Rr]e[Ss]harper 71 | 72 | # TeamCity is a build add-in 73 | _TeamCity* 74 | 75 | # DotCover is a Code Coverage Tool 76 | *.dotCover 77 | 78 | # NCrunch 79 | *.ncrunch* 80 | .*crunch*.local.xml 81 | 82 | # Installshield output folder 83 | [Ee]xpress/ 84 | 85 | # DocProject is a documentation generator add-in 86 | DocProject/buildhelp/ 87 | DocProject/Help/*.HxT 88 | DocProject/Help/*.HxC 89 | DocProject/Help/*.hhc 90 | DocProject/Help/*.hhk 91 | DocProject/Help/*.hhp 92 | DocProject/Help/Html2 93 | DocProject/Help/html 94 | 95 | # Click-Once directory 96 | publish/ 97 | 98 | # Publish Web Output 99 | *.Publish.xml 100 | 101 | # NuGet Packages Directory 102 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line 103 | #packages/ 104 | 105 | # Windows Azure Build Output 106 | csx 107 | *.build.csdef 108 | 109 | # Windows Store app package directory 110 | AppPackages/ 111 | 112 | # Others 113 | sql/ 114 | *.Cache 115 | ClientBin/ 116 | [Ss]tyle[Cc]op.* 117 | ~$* 118 | *~ 119 | *.dbmdl 120 | *.[Pp]ublish.xml 121 | *.pfx 122 | *.publishsettings 123 | 124 | # RIA/Silverlight projects 125 | Generated_Code/ 126 | 127 | # Backup & report files from converting an old project file to a newer 128 | # Visual Studio version. Backup files are not needed, because we have git ;-) 129 | _UpgradeReport_Files/ 130 | Backup*/ 131 | UpgradeLog*.XML 132 | UpgradeLog*.htm 133 | 134 | # SQL Server files 135 | App_Data/*.mdf 136 | App_Data/*.ldf 137 | 138 | 139 | #LightSwitch generated files 140 | GeneratedArtifacts/ 141 | _Pvt_Extensions/ 142 | ModelManifest.xml 143 | 144 | # ========================= 145 | # Windows detritus 146 | # ========================= 147 | 148 | # Windows image file caches 149 | Thumbs.db 150 | ehthumbs.db 151 | 152 | # Folder config file 153 | Desktop.ini 154 | 155 | # Recycle Bin used on file shares 156 | $RECYCLE.BIN/ 157 | 158 | # Mac desktop service store files 159 | .DS_Store 160 | 161 | # UnitTest fakes assembly 162 | *.Fakes.dll 163 | *.Fakes.fakesconfig 164 | *.Fakes.messages 165 | *.Fakes.xml 166 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # BlurMessageBox 2 | The MessageBox form for WPF and WinForms application by ability to blurring that parent form 3 | 4 | ![ScreenShot.png](https://raw.githubusercontent.com/Behzadkhosravifar/BlurMessageBox/master/image/ScreenShot.PNG) 5 | -------------------------------------------------------------------------------- /UpdateFromOrigin.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | Echo Start Updating ... 3 | 4 | git checkout master 5 | git fetch 6 | git status 7 | git pull 8 | 9 | Echo Update Completed. 10 | 11 | Echo --------------------------------------------- 12 | 13 | Echo Start Building Project ... 14 | 15 | IF NOT "%VS110COMNTOOLS%" == "" (call "%VS110COMNTOOLS%vsvars32.bat") 16 | IF NOT "%VS120COMNTOOLS%" == "" (call "%VS120COMNTOOLS%vsvars32.bat") 17 | IF NOT "%VS130COMNTOOLS%" == "" (call "%VS130COMNTOOLS%vsvars32.bat") 18 | IF NOT "%VS140COMNTOOLS%" == "" (call "%VS140COMNTOOLS%vsvars32.bat") 19 | 20 | for /F %%A in ('dir /b src\*.sln') do call devenv src\%%A /Rebuild "Release" 21 | 22 | Echo --------------------------------------------- 23 | pause -------------------------------------------------------------------------------- /image/ScreenShot.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bezzad/BlurMessageBox/80984db3a61057ed2876fd875ad852f17a557744/image/ScreenShot.PNG -------------------------------------------------------------------------------- /src/BlurMessageBox.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.21005.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlurMessageBox", "BlurMessageBox\BlurMessageBox.csproj", "{036659E4-59F2-4485-BFED-3627ECEA2FBC}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestWinForms", "TestWinForms\TestWinForms.csproj", "{76B74219-8219-44E9-94F9-033FD04BA4EE}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestWPF", "TestWPF\TestWPF.csproj", "{C310DAEB-8258-40CE-A8DF-38A4AC5B9C89}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|Any CPU = Debug|Any CPU 15 | Release|Any CPU = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {036659E4-59F2-4485-BFED-3627ECEA2FBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {036659E4-59F2-4485-BFED-3627ECEA2FBC}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {036659E4-59F2-4485-BFED-3627ECEA2FBC}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {036659E4-59F2-4485-BFED-3627ECEA2FBC}.Release|Any CPU.Build.0 = Release|Any CPU 22 | {76B74219-8219-44E9-94F9-033FD04BA4EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {76B74219-8219-44E9-94F9-033FD04BA4EE}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {76B74219-8219-44E9-94F9-033FD04BA4EE}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {76B74219-8219-44E9-94F9-033FD04BA4EE}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {C310DAEB-8258-40CE-A8DF-38A4AC5B9C89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {C310DAEB-8258-40CE-A8DF-38A4AC5B9C89}.Debug|Any CPU.Build.0 = Debug|Any CPU 28 | {C310DAEB-8258-40CE-A8DF-38A4AC5B9C89}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {C310DAEB-8258-40CE-A8DF-38A4AC5B9C89}.Release|Any CPU.Build.0 = Release|Any CPU 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /src/BlurMessageBox/AnimateMsgBox.cs: -------------------------------------------------------------------------------- 1 | using System.Drawing; 2 | 3 | namespace BlurMessageBox 4 | { 5 | class AnimateMsgBox 6 | { 7 | public Size FormSize; 8 | public AnimateStyle Style; 9 | 10 | public AnimateMsgBox(Size formSize, AnimateStyle style) 11 | { 12 | this.FormSize = formSize; 13 | this.Style = style; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/BlurMessageBox/AnimateStyle.cs: -------------------------------------------------------------------------------- 1 | namespace BlurMessageBox 2 | { 3 | public enum AnimateStyle 4 | { 5 | SlideDown = 1, 6 | FadeIn = 2, 7 | ZoomIn = 3 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/BlurMessageBox/BlurMessageBox.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {036659E4-59F2-4485-BFED-3627ECEA2FBC} 8 | Library 9 | Properties 10 | BlurMessageBox 11 | BlurMessageBox 12 | v4.5 13 | 512 14 | 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | false 25 | 26 | 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | false 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | Localization.ru-RU.resx 52 | True 53 | True 54 | 55 | 56 | Localization.ar.resx 57 | True 58 | True 59 | 60 | 61 | Localization.tr-TR.resx 62 | True 63 | True 64 | 65 | 66 | Localization.az.resx 67 | True 68 | True 69 | 70 | 71 | Localization.fr-FR.resx 72 | True 73 | True 74 | 75 | 76 | True 77 | True 78 | Localization.resx 79 | 80 | 81 | Localization.fa-IR.resx 82 | True 83 | True 84 | 85 | 86 | 87 | 88 | Form 89 | 90 | 91 | 92 | 93 | 94 | ResXFileCodeGenerator 95 | Localization.ru-RU.Designer.cs 96 | 97 | 98 | ResXFileCodeGenerator 99 | Localization.ar.Designer.cs 100 | 101 | 102 | ResXFileCodeGenerator 103 | Localization.tr-TR.Designer.cs 104 | 105 | 106 | ResXFileCodeGenerator 107 | Localization.az.Designer.cs 108 | 109 | 110 | ResXFileCodeGenerator 111 | Localization.fr-FR.Designer.cs 112 | 113 | 114 | ResXFileCodeGenerator 115 | Localization.Designer.cs 116 | 117 | 118 | ResXFileCodeGenerator 119 | Localization.fa-IR.Designer.cs 120 | 121 | 122 | 123 | 124 | 131 | -------------------------------------------------------------------------------- /src/BlurMessageBox/BlurWindow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BlurMessageBox 4 | { 5 | public static class BlurWindows 6 | { 7 | private static System.Windows.Media.Effects.Effect effectBuffer; 8 | private static System.Windows.Media.Brush brushBuffer; 9 | 10 | /// 11 | /// Apply Blur Effect on the window 12 | /// 13 | /// parent window 14 | public static void ApplyEffect(this System.Windows.Window win) 15 | { 16 | // Create new effective objects 17 | var objBlur = new System.Windows.Media.Effects.BlurEffect { Radius = 5 }; 18 | var mask = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.DarkGray) { Opacity = 50 }; 19 | 20 | // Buffering ... 21 | effectBuffer = win.Effect; 22 | brushBuffer = win.OpacityMask; 23 | 24 | // Change this.win effective objects 25 | win.Dispatcher.Invoke(new Action(delegate { win.Effect = objBlur; }), System.Windows.Threading.DispatcherPriority.Normal); 26 | win.Dispatcher.Invoke(new Action(delegate { win.OpacityMask = mask; }), System.Windows.Threading.DispatcherPriority.Normal); 27 | } 28 | /// 29 | /// Remove Blur Effects 30 | /// 31 | /// parent window 32 | public static void ClearEffect(this System.Windows.Window win) 33 | { 34 | // Back changed effective objects 35 | win.Dispatcher.Invoke(new Action(delegate { win.Effect = effectBuffer; }), System.Windows.Threading.DispatcherPriority.Normal); 36 | win.Dispatcher.Invoke(new Action(delegate { win.OpacityMask = brushBuffer; }), System.Windows.Threading.DispatcherPriority.Normal); 37 | win.Dispatcher.Invoke(new Action(delegate { win.Focus(); }), System.Windows.Threading.DispatcherPriority.Normal); 38 | } 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/BlurMessageBox/Buttons.cs: -------------------------------------------------------------------------------- 1 | namespace BlurMessageBox 2 | { 3 | public enum Buttons 4 | { 5 | AbortRetryIgnore = 1, 6 | OK = 2, 7 | OKCancel = 3, 8 | RetryCancel = 4, 9 | YesNo = 5, 10 | YesNoCancel = 6 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/BlurMessageBox/FormMessageBox.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Forms; 2 | 3 | namespace BlurMessageBox 4 | { 5 | public static class FormMessageBox 6 | { 7 | #region BlurWindows MessageBox.Show Methods 8 | 9 | public static DialogResult MessageBoxShow(this System.Windows.Window win, string message) 10 | { 11 | return MsgBox.Show(message, win); 12 | } 13 | public static DialogResult MessageBoxShow(this System.Windows.DependencyObject dependencyObject, string message) 14 | { 15 | return MsgBox.Show(message, System.Windows.Window.GetWindow(dependencyObject)); 16 | } 17 | 18 | public static DialogResult MessageBoxShow(this System.Windows.Window win, string message, string title) 19 | { 20 | return MsgBox.Show(message, title, win); 21 | } 22 | public static DialogResult MessageBoxShow(this System.Windows.DependencyObject dependencyObject, string message, string title) 23 | { 24 | return MsgBox.Show(message, title, System.Windows.Window.GetWindow(dependencyObject)); 25 | } 26 | 27 | public static DialogResult MessageBoxShow(this System.Windows.Window win, string message, string title, Buttons buttons) 28 | { 29 | return MsgBox.Show(message, title, buttons, win); 30 | } 31 | public static DialogResult MessageBoxShow(this System.Windows.DependencyObject dependencyObject, string message, string title, Buttons buttons) 32 | { 33 | return MsgBox.Show(message, title, buttons, System.Windows.Window.GetWindow(dependencyObject)); 34 | } 35 | 36 | public static DialogResult MessageBoxShow(this System.Windows.Window win, string message, string title, Buttons buttons, Icons icon) 37 | { 38 | return MsgBox.Show(message, title, buttons, icon, win); 39 | } 40 | public static DialogResult MessageBoxShow(this System.Windows.DependencyObject dependencyObject, string message, string title, Buttons buttons, Icons icon) 41 | { 42 | return MsgBox.Show(message, title, buttons, icon, System.Windows.Window.GetWindow(dependencyObject)); 43 | } 44 | 45 | public static DialogResult MessageBoxShow(this System.Windows.Window win, string message, string title, Buttons buttons, Icons icon, AnimateStyle style) 46 | { 47 | return MsgBox.Show(message, title, buttons, icon, style, win); 48 | } 49 | public static DialogResult MessageBoxShow(this System.Windows.DependencyObject dependencyObject, string message, string title, Buttons buttons, Icons icon, AnimateStyle style) 50 | { 51 | return MsgBox.Show(message, title, buttons, icon, style, System.Windows.Window.GetWindow(dependencyObject)); 52 | } 53 | #endregion 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/BlurMessageBox/Icons.cs: -------------------------------------------------------------------------------- 1 | namespace BlurMessageBox 2 | { 3 | public enum Icons 4 | { 5 | Application = 1, 6 | Exclamation = 2, 7 | Error = 3, 8 | Warning = 4, 9 | Info = 5, 10 | Question = 6, 11 | Shield = 7, 12 | Search = 8 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/BlurMessageBox/MsgBox.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Drawing; 4 | using System.Collections.Generic; 5 | using System.Globalization; 6 | using System.Windows.Forms; 7 | using System.Runtime.InteropServices; 8 | using Application = System.Windows.Forms.Application; 9 | using FlowDirection = System.Windows.Forms.FlowDirection; 10 | using Point = System.Drawing.Point; 11 | using Size = System.Drawing.Size; 12 | using System.Text; 13 | 14 | namespace BlurMessageBox 15 | { 16 | [DebuggerStepThrough] 17 | public sealed class MsgBox : Form 18 | { 19 | #region Properties 20 | 21 | public static Font TitleFont = new System.Drawing.Font("Segoe UI", 18); 22 | public static Font MessageFont = new System.Drawing.Font("Segoe UI", 10); 23 | private static readonly object SyncLocker = new object(); 24 | private static readonly Padding BoxPadding = new Padding(200, 0, 0, 200); 25 | 26 | private const int CS_DROPSHADOW = 0x00020000; 27 | private const int MinWidth = 350; 28 | private const int MinHeight = 250; 29 | private readonly Graphics _graphics; 30 | private const int cGrip = 16; // Grip size 31 | private const int cCaption = 32; // Caption bar height; 32 | 33 | private DialogResult _buttonResult; 34 | private Timer _timer; 35 | private Point _lastMousePos; 36 | 37 | private Panel _plHeader; 38 | private Panel _plFooter; 39 | private Panel _plIcon; 40 | private PictureBox _picIcon; 41 | private FlowLayoutPanel _flpButtons; 42 | private Label _lblTitle; 43 | private Label _lblMessage; 44 | private List