当前位置: 移动技术网 > IT编程>开发语言>.net > C# WPF有趣的登录加载窗体

C# WPF有趣的登录加载窗体

2019年12月20日  | 移动技术网IT编程  | 我要评论

网页传奇哪个好玩,婚宴菜单,星际炼金大师

时间如流水,只能流去不流回!

点赞再看,养成习惯,这是您给我创作的动力!

本文 dotnet9 https://dotnet9.com 已收录,站长乐于分享dotnet相关技术,比如winform、wpf、asp.net core等,亦有c++桌面相关的qt quick和qt widgets等,只分享自己熟悉的、自己会的。

阅读导航:

  • 一、先看效果
  • 二、本文背景
  • 三、代码实现
  • 四、文章参考
  • 五、代码下载

一、先看效果

c# wpf有趣的登录加载窗体

二、本文背景

在youtube上看到的一个视频,文末有链接,使用前端时间介绍的开源c# wpf 控件库handycontrol,用到了其中的头像控件、水波纹控件、拖动条控件等。

三、代码实现

站长使用.net core 3.1创建的wpf工程,创建名称为“customcontrolshandyorg”的解决方案后,需要添加nuget库:handycontrol。

c# wpf有趣的登录加载窗体

代码不多,首先在app.xaml中添加handycontrol两个样式文件:

 1 <application x:class="customcontrolshandyorg.app"
 2              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 3              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 4              xmlns:local="clr-namespace:customcontrolshandyorg"
 5              startupuri="mainwindow.xaml">
 6     <application.resources>
 7         <resourcedictionary>
 8             <resourcedictionary.mergeddictionaries>
 9                 <resourcedictionary source="pack://application:,,,/handycontrol;component/themes/skindefault.xaml"/>
10                 <resourcedictionary source="pack://application:,,,/handycontrol;component/themes/theme.xaml"/>
11             </resourcedictionary.mergeddictionaries>
12         </resourcedictionary>
13     </application.resources>
14 </application>

另外一个代码文件是mainwindow.xaml,首先引入handycontrol命名空间

 1 xmlns:hc="https://handyorg.github.io/handycontrol" 

代码确实不多,关键代码也就10行左右

 1 <window x:class="customcontrolshandyorg.mainwindow"
 2         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 3         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 4         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
 5         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 6         xmlns:local="clr-namespace:customcontrolshandyorg"
 7         mc:ignorable="d"
 8         xmlns:hc="https://handyorg.github.io/handycontrol"
 9         height="450" width="300" resizemode="noresize" windowstartuplocation="centerscreen" windowstyle="none">
10     <grid background="#ff222222">
11         <stackpanel verticalalignment="center">
12             <hc:gravatar id="{binding value,elementname=slider}"/>
13             <textblock fontsize="18" text="downloading" margin="5 15" foreground="white" horizontalalignment="center"/>
14             <hc:waveprogressbar value="{binding value,elementname=slider}" maximum="100" background="#ff555555" wavefill="#ff563380" wavestroke="#ff5675" wavethickness="1" foreground="white"/>
15             <button content="stop" margin="15" horizontalalignment="stretch" background="#ff563380" borderbrush="#ff482480" foreground="white"/>
16             <hc:previewslider x:name="slider" maximum="100" margin="20"/>
17         </stackpanel>
18     </grid>
19 </window>

四、文章参考

上面的代码是dotnet9看 disign com wpf 大神视频手敲的,下面是大神youtube地址及本实例学习视频。

参考:
design com wpf :  https://www.youtube.com/watch?v=8uw5uy6pvdq

五、代码下载

文章中代码已经全部贴出,就这么几行代码,不要奇怪,就是这么多。

除非注明,文章均由 dotnet9 整理发布,欢迎转载。

转载请注明本文地址:

如有所收获,请大力转发(能点赞及推荐那是极好的);如觉小编写文不易,欢迎给dotnet9站点打赏,小编谢谢了;谢谢大家对dotnet技术的关注和支持 。

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网