您好,登錄后才能下訂單哦!
今天就跟大家聊聊有關C# 中怎么利用WPF實現一個注冊窗體,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結了以下內容,希望大家根據這篇文章可以有所收獲。
App.xaml添加MaterialDesign的樣式文件
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Purple.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
注冊窗體MainWindow.xaml
<Window x:Class="Register.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:Register"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
Title="MainWindow" Height="600" Width="1000">
<Grid Background="#FFDADADA">
<Border Margin="15" MaxWidth="600" Background="White" VerticalAlignment="Center" Padding="30" CornerRadius="15">
<Border.Effect>
<DropShadowEffect BlurRadius="30" Color="LightGray" ShadowDepth="0"/>
</Border.Effect>
<StackPanel>
<TextBlock Text="歡迎" FontSize="30" FontWeight="Bold" Margin="0 0 0 20"/>
<Grid Margin="0 0 0 20">
<Button Content="注冊" HorizontalAlignment="Left"/>
<Button Content="登錄" HorizontalAlignment="Right" Style="{StaticResource MaterialDesignFlatButton}"/>
</Grid>
<TextBox materialDesign:HintAssist.Hint="用戶名" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="0 5"/>
<PasswordBox materialDesign:HintAssist.Hint="密碼" Style="{StaticResource MaterialDesignFloatingHintPasswordBox}" Margin="0 5"/>
<PasswordBox materialDesign:HintAssist.Hint="確認密碼" Style="{StaticResource MaterialDesignFloatingHintPasswordBox}" Margin="0 5"/>
<TextBox materialDesign:HintAssist.Hint="電子郵件" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="0 5"/>
<Button Content="注冊" Margin="0 20"/>
</StackPanel>
</Border>
</Grid>
</Window>
看完上述內容,你們對C# 中怎么利用WPF實現一個注冊窗體有進一步的了解嗎?如果還想了解更多知識或者相關內容,請關注億速云行業資訊頻道,感謝大家的支持。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。