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("你點了 否");
}
}
相關文章
- 彈出視窗messagebox
- avalonia自定義彈窗
- 自定義版本更新彈窗
- uniapp 自定義彈窗元件APP元件
- react-native 仿原生自定義彈窗|iOS/Android 彈窗效果ReactiOSAndroid
- avalonia實現自定義小彈窗
- 去掉RedisDesktopManager更新提示彈窗Redis
- iOS學習筆記--PresentedVC自定義彈窗iOS筆記
- Winform在主窗體載入前彈出登入窗體ORM
- 小程式自定義modal彈窗封裝實現封裝
- fastadmin新增自定義按鈕,並使用彈窗功能AST
- 圖片彈窗和下載彈窗wordpress外掛下載-Facebox download
- svelte元件:Svelte自定義彈窗Popup元件|svelte移動端彈框元件元件
- 34.qt quick-Popup彈出視窗自定義QTUI
- Winform MessageBox訊息彈窗如何實現自動關閉ORM
- sweetalert載入彈窗完成自動關閉
- 直播軟體開發,工具類的自定義彈窗效果
- php 跳轉頁面之前彈窗提示PHP
- iView之Modal(一級彈窗和二級彈窗)View
- 彈出視窗
- 去除nag彈窗
- 線上直播系統原始碼,彈出警告/提示類彈窗原始碼
- 學習筆記(二十八):ArkUi-自定義彈窗 (CustomDialog)筆記UI
- ArcGIS實現打點、線路圖、色塊、自定義彈窗
- WPF中實現彈出進度條視窗
- Flutter 入門指北(Part 9)之彈窗和提示(SnackBar、BottomSheet、Dialog)Flutter
- 鴻蒙專案實戰(三):自定義彈窗開發實踐鴻蒙
- Flutter 全域性彈窗Flutter
- 移動端彈窗
- Prism 彈出視窗
- 廣告彈窗/小視窗程式碼
- 基於NuxtJS/Vue自定義彈層元件|Vue長按彈窗|Vue全域性對話方塊UXJSVue元件
- uniapp彈窗24小時之後彈APP
- 2024-11-13 uniapp自定義全域性彈窗並可以透過uni來呼叫【轉載】APP
- 短視訊平臺搭建,收到通知後彈出相關提示的彈窗
- WKViewManager iOS 彈窗架構ViewiOS架構
- winrar去廣告彈窗
- vue3.x自定義彈框元件|vue3.0移動端彈窗|vue3全域性元件Vue元件