WPF 自定義MessageBox 彈窗提示 彈窗載入
1. 下載Dll
https://pan.baidu.com/s/1sKGQ0uHXHkkhXtMvUYPQHA
2.在專案中新增引用
略
3.在Xaml中引入名稱空間
xmlns:myControl ="clr-namespace:MyCustomControlLibrary;assembly=MyCustomControlLibrary"
4.先看效果
5.使用程式碼
Xaml
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="提示效果" Foreground="Black" FontSize="16" FontWeight="DemiBold" HorizontalAlignment="Center"/>
<WrapPanel>
<myControl:IconButton Content="提示1" x:Name="AlertOne" Margin="5" Padding="2" IsShowIcon="False" Width="50" HorizontalAlignment="Center" Click="AlertOne_Click"/>
<myControl:IconButton Content="提示2" x:Name="AlertTwo" Margin="5" Padding="2" IsShowIcon="False" Width="50" HorizontalAlignment="Center" Click="AlertTwo_Click"/>
<myControl:IconButton Content="提示3" x:Name="AlertThree" Margin="5" Padding="2" IsShowIcon="False" Width="50" HorizontalAlignment="Center" Click="AlertThree_Click"/>
</WrapPanel>
<TextBlock Text="載入效果" Foreground="Black" FontSize="16" FontWeight="DemiBold" HorizontalAlignment="Center"/>
<WrapPanel>
<myControl:IconButton Content="載入1" x:Name="loadOne" Margin="5" Padding="2" IsShowIcon="False" Width="50" HorizontalAlignment="Center" Click="loadOne_Click"/>
<myControl:IconButton Content="載入2" x:Name="loadTwo" Margin="5" Padding="2" IsShowIcon="False" Width="50" HorizontalAlignment="Center" Click="loadTwo_Click"/>
<myControl:IconButton Content="載入3" x:Name="loadThree" Margin="5" Padding="2" IsShowIcon="False" Width="50" HorizontalAlignment="Center" Click="loadThree_Click"/>
</WrapPanel>
<WrapPanel>
<myControl:IconButton Content="載入4" x:Name="loadFour" Margin="5" Padding="2" IsShowIcon="False" Width="50" HorizontalAlignment="Center" Click="loadFour_Click"/>
<myControl:IconButton Content="載入5" x:Name="loadfive" Margin="5" Padding="2" IsShowIcon="False" Width="50" HorizontalAlignment="Center" Click="loadfive_Click"/>
<myControl:IconButton Content="載入6" x:Name="loadSix" Margin="5" Padding="2" IsShowIcon="False" Width="50" HorizontalAlignment="Center" Click="loadSix_Click"/>
</WrapPanel>
<WrapPanel>
<myControl:IconButton Content="載入7" x:Name="loadSever" Margin="5" Padding="2" IsShowIcon="False" Width="50" HorizontalAlignment="Center" Click="loadSever_Click"/>
<myControl:IconButton Content="載入8" x:Name="loadeight" Margin="5" Padding="2" IsShowIcon="False" Width="50" HorizontalAlignment="Center" Click="loadeight_Click"/>
<myControl:IconButton Content="載入9" x:Name="loadnine" Margin="5" Padding="2" IsShowIcon="False" Width="50" HorizontalAlignment="Center" Click="loadnine_Click"/>
</WrapPanel>
<WrapPanel>
<TextBlock Foreground="#787978" FontSize="14" Text="載入動畫很多,可以自由組織 。" Padding="10,15,0,0" MouseLeftButtonUp="OnePointLoading_MouseLeftButtonUp"/>
</WrapPanel>
<TextBlock Text="自定義MessageBox效果" Foreground="Black" FontSize="16" FontWeight="DemiBold" HorizontalAlignment="Center" Margin="0,10,0,0"/>
<WrapPanel>
<myControl:IconButton Content="效果1" x:Name="MessageboxOne" Margin="5" Padding="2" IsShowIcon="False" Width="50" HorizontalAlignment="Center" Click="MessageboxOne_Click"/>
<myControl:IconButton Content="效果2" x:Name="MessageboxTwo" Margin="5" Padding="2" IsShowIcon="False" Width="50" HorizontalAlignment="Center" Click="MessageboxTwo_Click"/>
<myControl:IconButton Content="效果3" x:Name="MessageboxThree" Margin="5" Padding="2" IsShowIcon="False" Width="50" HorizontalAlignment="Center" Click="MessageboxThree_Click"/>
</WrapPanel>
<!--<StackPanel>
--><!--<TextBlock Foreground="#787978" FontSize="14" Text="正在檢測新版本..." Padding="10,15,0,0" MouseLeftButtonUp="OnePointLoading_MouseLeftButtonUp"/>--><!--
</StackPanel>-->
</StackPanel>
Cs程式碼中
private void AlertOne_Click(object sender, RoutedEventArgs e)
{
MyCustomControlLibrary.MMessageBox.ShowAlert(
"Success!",
Orientation.Horizontal,
null,
"#3ca9fe",
false);
// MyCustomControlLibrary.MMessageBox.ShowSuccessAlert();
// MyCustomControlLibrary.MMessageBox.ShowSuccessAlert("Success!");
}
private void AlertTwo_Click(object sender, RoutedEventArgs e)
{
var point = this.Mborder.PointToScreen(new Point());
//Mborder 視窗內容區域的邊框
var size = new Size(this.Mborder.ActualWidth, this.Mborder.ActualHeight);
MyCustomControlLibrary.MMessageBox.ShowModalAlert(
"Success!",
point,
size,
Orientation.Vertical,
String.Empty,
"#3ca9fe");
//MyCustomControlLibrary.MMessageBox.ShowSuccessModelAlert(size,point);
//MyCustomControlLibrary.MMessageBox.ShowSuccessModelAlert(size, point, "Success!");
}
private void AlertThree_Click(object sender, RoutedEventArgs e)
{
var point = this.Mborder.PointToScreen(new Point());
//Mborder 視窗內容區域的邊框
var size = new Size(this.Mborder.ActualWidth, this.Mborder.ActualHeight);
MyCustomControlLibrary.MMessageBox.ShowModalAlert(
"Success!",
point,
size,
Orientation.Vertical,
null,
"#ffffffff");
}
private void loadOne_Click(object sender, RoutedEventArgs e)
{
MyCustomControlLibrary.MMessageBox.ShowLoading(
MyCustomControlLibrary.MMessageBox.LoadType.Circle,
"載入中。。。",
new Point(0, 0),
new Size(0, 0),
"",
Orientation.Horizontal,
"#ffffff",
3);
}
private void loadTwo_Click(object sender, RoutedEventArgs e)
{
var point = this.Mborder.PointToScreen(new Point());
//Mborder 視窗內容區域的邊框
var size = new Size(this.Mborder.ActualWidth, this.Mborder.ActualHeight);
MyCustomControlLibrary.MMessageBox.ShowLoading(
MyCustomControlLibrary.MMessageBox.LoadType.Circle,
String.Empty,
point,
size,
"",
Orientation.Horizontal,
"#ffffff",
3);
}
private void loadThree_Click(object sender, RoutedEventArgs e)
{
var point = this.Mborder.PointToScreen(new Point());
//Mborder 視窗內容區域的邊框
var size = new Size(this.Mborder.ActualWidth, this.Mborder.ActualHeight);
MyCustomControlLibrary.MMessageBox.ShowLoading(
MyCustomControlLibrary.MMessageBox.LoadType.Three,
"Loading...",
new Point(0, 0),
new Size(0, 0),
null,
Orientation.Vertical,
"#ffffff",
3);
}
private void loadFour_Click(object sender, RoutedEventArgs e)
{
var point = this.Mborder.PointToScreen(new Point());
//Mborder 視窗內容區域的邊框
var size = new Size(this.Mborder.ActualWidth, this.Mborder.ActualHeight);
MyCustomControlLibrary.MMessageBox.ShowLoading(
MyCustomControlLibrary.MMessageBox.LoadType.Foure,
"Loading...",
point,
size,
"",
Orientation.Vertical,
"#ffffff",
5);
}
private void loadfive_Click(object sender, RoutedEventArgs e)
{
var point = this.Mborder.PointToScreen(new Point());
//Mborder 視窗內容區域的邊框
var size = new Size(this.Mborder.ActualWidth, this.Mborder.ActualHeight);
MyCustomControlLibrary.MMessageBox.ShowLoading(
MyCustomControlLibrary.MMessageBox.LoadType.Two,
"Loading...",
point,
size,
"",
Orientation.Vertical,
"#ffffff",
3);
}
private void loadSix_Click(object sender, RoutedEventArgs e)
{
var point = this.Mborder.PointToScreen(new Point());
//Mborder 視窗內容區域的邊框
var size = new Size(this.Mborder.ActualWidth, this.Mborder.ActualHeight);
MyCustomControlLibrary.MMessageBox.ShowLoading(
MyCustomControlLibrary.MMessageBox.LoadType.Firve,
"Loading...",
point,
size,
"",
Orientation.Vertical,
"#ffffff",
3);
}
private void loadSever_Click(object sender, RoutedEventArgs e)
{
MyCustomControlLibrary.MMessageBox.ShowLoading(
MyCustomControlLibrary.MMessageBox.LoadType.One,
"Loading...",
new Point(0, 0),
new Size(0, 0),
null,
Orientation.Vertical,
"#ffffff",
3);
}
private void loadeight_Click(object sender, RoutedEventArgs e)
{
var point = this.Mborder.PointToScreen(new Point());
//Mborder 視窗內容區域的邊框
var size = new Size(this.Mborder.ActualWidth, this.Mborder.ActualHeight);
MyCustomControlLibrary.MMessageBox.ShowLoading(
MyCustomControlLibrary.MMessageBox.LoadType.Grid,
"Loading...",
point,
size,
"",
Orientation.Vertical,
"#ffffff",
3);
}
private void loadnine_Click(object sender, RoutedEventArgs e)
{
var point = this.Mborder.PointToScreen(new Point());
//Mborder 視窗內容區域的邊框
var size = new Size(this.Mborder.ActualWidth, this.Mborder.ActualHeight);
MyCustomControlLibrary.MMessageBox.ShowLoading(
MyCustomControlLibrary.MMessageBox.LoadType.One,
"Loading...",
point,
size,
"",
Orientation.Vertical,
"#ffffff",
3);
}
private void MessageboxOne_Click(object sender, RoutedEventArgs e)
{
MyCustomControlLibrary.MMessageBox.Reault reault = MyCustomControlLibrary.MMessageBox.ShouBox(
"操作成功!",
"資訊",
MyCustomControlLibrary.MMessageBox.ButtonType.No,
MyCustomControlLibrary.MMessageBox.IconType.success
);
if (reault == MyCustomControlLibrary.MMessageBox.Reault.No)
{
MyCustomControlLibrary.MMessageBox.ShowSuccessAlert("你點了 取消");
}
}
private void MessageboxTwo_Click(object sender, RoutedEventArgs e)
{
MyCustomControlLibrary.MMessageBox.Reault reault = MyCustomControlLibrary.MMessageBox.ShouBox(
"操作成功!",
"資訊",
MyCustomControlLibrary.MMessageBox.ButtonType.Yes,
MyCustomControlLibrary.MMessageBox.IconType.success
);
var point = this.Mborder.PointToScreen(new Point());
//Mborder 視窗內容區域的邊框
var size = new Size(this.Mborder.ActualWidth, this.Mborder.ActualHeight);
if (reault == MyCustomControlLibrary.MMessageBox.Reault.Yes)
{
MyCustomControlLibrary.MMessageBox.ShowSuccessModelAlert(size, point, "你點了 確定");
}
}
private void MessageboxThree_Click(object sender, RoutedEventArgs e)
{
MyCustomControlLibrary.MMessageBox.Reault reault = MyCustomControlLibrary.MMessageBox.ShouBox(
"是否要刪除!",
"警 告",
MyCustomControlLibrary.MMessageBox.ButtonType.YesNo,
MyCustomControlLibrary.MMessageBox.IconType.warring,
Orientation.Horizontal,
"是",
"否"
);
if (reault == MyCustomControlLibrary.MMessageBox.Reault.Yes)
{
MyCustomControlLibrary.MMessageBox.ShowSuccessAlert("你點了 是");
}
else
{
MyCustomControlLibrary.MMessageBox.ShowSuccessAlert("你點了 否");
}
}
相關文章
- avalonia自定義彈窗
- 自定義 alert 彈窗
- 自定義版本更新彈窗
- 自定義view————廣告彈窗View
- 彈出視窗messagebox
- uniapp 自定義彈窗元件APP元件
- avalonia實現自定義小彈窗
- iOS 自定義內容的彈窗iOS
- react-native 仿原生自定義彈窗|iOS/Android 彈窗效果ReactiOSAndroid
- Jquery實現自定義訊息彈窗jQuery
- iOS學習筆記--PresentedVC自定義彈窗iOS筆記
- Winform在主窗體載入前彈出登入窗體ORM
- 去掉RedisDesktopManager更新提示彈窗Redis
- 小程式自定義modal彈窗封裝實現封裝
- svelte元件:Svelte自定義彈窗Popup元件|svelte移動端彈框元件元件
- 34.qt quick-Popup彈出視窗自定義QTUI
- fastadmin新增自定義按鈕,並使用彈窗功能AST
- sweetalert載入彈窗完成自動關閉
- 圖片彈窗和下載彈窗wordpress外掛下載-Facebox download
- Android:PopWindow — 對Android的底部彈窗、頂部彈窗選單及自定義介面的使用封裝Android封裝
- 線上直播系統原始碼,彈出警告/提示類彈窗原始碼
- 直播軟體開發,工具類的自定義彈窗效果
- 關閉網頁彈出提示視窗網頁
- php 跳轉頁面之前彈窗提示PHP
- iView之Modal(一級彈窗和二級彈窗)View
- Jquery彈窗元件jQuery元件
- 彈出視窗
- Winform MessageBox訊息彈窗如何實現自動關閉ORM
- ArcGIS實現打點、線路圖、色塊、自定義彈窗
- 鴻蒙專案實戰(三):自定義彈窗開發實踐鴻蒙
- 廣告彈窗/小視窗程式碼
- Flutter 全域性彈窗Flutter
- js頁面彈窗JS
- winrar去廣告彈窗
- Prism 彈出視窗
- 一行js彈窗程式碼就能設計漂亮的彈窗廣告JS
- ArcGIS API for Silverlight 點選地圖彈出自定義窗體API地圖
- 學習筆記(二十八):ArkUi-自定義彈窗 (CustomDialog)筆記UI