.NET CORE(C#) WPF 值得推荐的动画菜单设计

微信公众号:Dotnet9,网站:Dotnet9,问题或建议:请网站留言, 如果对您有所帮助:欢迎赞赏。

.NET CORE(C#) WPF 值得推荐的动画菜单设计

阅读导航

  1. 本文背景

  2. 代码实现

  3. 本文参考

  4. 源码

1. 本文背景

YouTube上老外的一个设计,站长觉得不错,分享给大家作为参考,抽屉菜单的动画做的非常不错。

运行起始界面:

站长运行操作一遍,录制了动画大家看看:

2. 代码实现

使用 .NET CORE 3.1 创建名为 “AnimatedMenu” 的WPF模板项目,添加1个Nuget库:MaterialDesignThemes,版本为最新预览版3.1.0-ci948。

解决方案主要文件目录组织结构:

  • AnimatedMenu

    • MainWindow.xaml.cs

    • App.xaml

    • MainWindow.xaml

2.1 引入样式

文件【App.xaml】,在 StartupUri 中设置启动的视图【MainWindow.xaml】,并在【Application.Resources】节点增加 MaterialDesignThemes库的样式文件:

<Application.Resources><ResourceDictionary><ResourceDictionary.MergedDictionaries><ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Dark.xaml" /><ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" /><ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Blue.xaml" /><ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Blue.xaml" /></ResourceDictionary.MergedDictionaries></ResourceDictionary>
</Application.Resources>

2.2 演示窗体

文件【MainWindow.xaml】,布局代码、动画代码都在此文件中,源码如下:

<Window x:Class="AnimatedMenu.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"mc:Ignorable="d" MouseLeftButtonDown="MoveWindow_MouseLeftButtonDown"Height="600" Width="1024" WindowStyle="None" WindowStartupLocation="CenterScreen"><WindowChrome.WindowChrome><WindowChrome CaptionHeight="0"/></WindowChrome.WindowChrome><Window.Resources><Storyboard x:Key="OpenMenu"><DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="GridMain"><EasingDoubleKeyFrame KeyTime="0" Value="0"/><EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="250"/></DoubleAnimationUsingKeyFrames><DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="GridMain"><EasingDoubleKeyFrame KeyTime="0" Value="0"/><EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="50"/></DoubleAnimationUsingKeyFrames><DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="StackPanelMenu"><EasingDoubleKeyFrame KeyTime="0" Value="0"/><EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="250"/></DoubleAnimationUsingKeyFrames><DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="listViewItem"><EasingDoubleKeyFrame KeyTime="0" Value="-250"/><EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="-250"/><EasingDoubleKeyFrame KeyTime="0:0:0.7" Value="0"/></DoubleAnimationUsingKeyFrames><DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="listViewItem1"><EasingDoubleKeyFrame KeyTime="0" Value="-250"/><EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="-250"/><EasingDoubleKeyFrame KeyTime="0:0:0.9" Value="0"/></DoubleAnimationUsingKeyFrames><DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="listViewItem2"><EasingDoubleKeyFrame KeyTime="0" Value="-250"/><EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="-250"/><EasingDoubleKeyFrame KeyTime="0:0:1.1" Value="0"/></DoubleAnimationUsingKeyFrames><DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="listViewItem3"><EasingDoubleKeyFrame KeyTime="0" Value="-250"/><EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="-250"/><EasingDoubleKeyFrame KeyTime="0:0:1.3" Value="0"/></DoubleAnimationUsingKeyFrames><DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="listViewItem4"><EasingDoubleKeyFrame KeyTime="0" Value="-250"/><EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="-250"/><EasingDoubleKeyFrame KeyTime="0:0:1.5" Value="0"/></DoubleAnimationUsingKeyFrames><DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="button"><EasingDoubleKeyFrame KeyTime="0" Value="0"/><EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/><EasingDoubleKeyFrame KeyTime="0:0:1.5" Value="1"/></DoubleAnimationUsingKeyFrames><DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="button"><EasingDoubleKeyFrame KeyTime="0" Value="0"/><EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/><EasingDoubleKeyFrame KeyTime="0:0:1.5" Value="1"/></DoubleAnimationUsingKeyFrames></Storyboard><Storyboard x:Key="CloseMenu"><DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="GridMain"><EasingDoubleKeyFrame KeyTime="0" Value="250"/><EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/></DoubleAnimationUsingKeyFrames><DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="GridMain"><EasingDoubleKeyFrame KeyTime="0" Value="50"/><EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/></DoubleAnimationUsingKeyFrames><DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="StackPanelMenu"><EasingDoubleKeyFrame KeyTime="0" Value="250"/><EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/></DoubleAnimationUsingKeyFrames></Storyboard></Window.Resources><Window.Triggers><EventTrigger RoutedEvent="ButtonBase.Click" SourceName="ButtonOpenMenu"><BeginStoryboard Storyboard="{StaticResource OpenMenu}"/></EventTrigger><EventTrigger RoutedEvent="ButtonBase.Click" SourceName="ButtonCloseMenu"><BeginStoryboard x:Name="CloseMenu_BeginStoryboard" Storyboard="{StaticResource CloseMenu}"/></EventTrigger></Window.Triggers><Grid Background="#FF3580BF"><StackPanel x:Name="StackPanelMenu" Width="250" HorizontalAlignment="Left" Margin="-250 0 0 0" RenderTransformOrigin="0.5,0.5"><StackPanel.RenderTransform><TransformGroup><ScaleTransform/><SkewTransform/><RotateTransform/><TranslateTransform/></TransformGroup></StackPanel.RenderTransform><StackPanel Orientation="Horizontal" VerticalAlignment="Top" Height="100" HorizontalAlignment="Center"><Button Style="{StaticResource MaterialDesignFloatingActionMiniAccentButton}" Background="{x:Null}" BorderBrush="{x:Null}" Padding="0" Width="50" Height="50" Margin="10"><materialDesign:PackIcon Kind="Settings" Width="40" Height="40"/></Button><Button x:Name="button" Style="{StaticResource MaterialDesignFloatingActionMiniAccentButton}" BorderBrush="{x:Null}" Padding="0" Width="80" Height="80" Margin="10" RenderTransformOrigin="0.5,0.5"><Button.RenderTransform><TransformGroup><ScaleTransform/><SkewTransform/><RotateTransform/><TranslateTransform/></TransformGroup></Button.RenderTransform><Button.Background><ImageBrush ImageSource="https://img.dotnet9.com/logo.png" Stretch="UniformToFill"/></Button.Background></Button><Button Style="{StaticResource MaterialDesignFloatingActionMiniAccentButton}" Background="{x:Null}" BorderBrush="{x:Null}" Padding="0" Width="50" Height="50" Margin="10"><materialDesign:PackIcon Kind="InformationOutline" Width="40" Height="40"/></Button></StackPanel><ListView><ListViewItem x:Name="listViewItem" Height="60" RenderTransformOrigin="0.5,0.5"><ListViewItem.RenderTransform><TransformGroup><ScaleTransform/><SkewTransform/><RotateTransform/><TranslateTransform/></TransformGroup></ListViewItem.RenderTransform><StackPanel Orientation="Horizontal" Margin="10 0"><materialDesign:PackIcon Kind="Home" Width="30" Height="30" VerticalAlignment="Center" Margin="5"/><TextBlock Text="主页" Margin="10" VerticalAlignment="Center"/></StackPanel></ListViewItem><ListViewItem x:Name="listViewItem1" Height="60" RenderTransformOrigin="0.5,0.5"><ListViewItem.RenderTransform><TransformGroup><ScaleTransform/><SkewTransform/><RotateTransform/><TranslateTransform/></TransformGroup></ListViewItem.RenderTransform><StackPanel Orientation="Horizontal" Margin="10 0"><materialDesign:PackIcon Kind="AccountSearch" Width="30" Height="30" VerticalAlignment="Center" Margin="5"/><TextBlock Text="搜索" Margin="10" VerticalAlignment="Center"/></StackPanel></ListViewItem><ListViewItem x:Name="listViewItem2" Height="60" RenderTransformOrigin="0.5,0.5"><ListViewItem.RenderTransform><TransformGroup><ScaleTransform/><SkewTransform/><RotateTransform/><TranslateTransform/></TransformGroup></ListViewItem.RenderTransform><StackPanel Orientation="Horizontal" Margin="10 0"><materialDesign:PackIcon Kind="Wechat" Width="30" Height="30" VerticalAlignment="Center" Margin="5"/><TextBlock Text="微信" Margin="10" VerticalAlignment="Center"/></StackPanel></ListViewItem><ListViewItem x:Name="listViewItem3" Height="60" RenderTransformOrigin="0.5,0.5"><ListViewItem.RenderTransform><TransformGroup><ScaleTransform/><SkewTransform/><RotateTransform/><TranslateTransform/></TransformGroup></ListViewItem.RenderTransform><StackPanel Orientation="Horizontal" Margin="10 0"><materialDesign:PackIcon Kind="Qqchat" Width="30" Height="30" VerticalAlignment="Center" Margin="5"/><TextBlock Text="QQ" Margin="10" VerticalAlignment="Center"/></StackPanel></ListViewItem><ListViewItem x:Name="listViewItem4" Height="60" RenderTransformOrigin="0.5,0.5"><ListViewItem.RenderTransform><TransformGroup><ScaleTransform/><SkewTransform/><RotateTransform/><TranslateTransform/></TransformGroup></ListViewItem.RenderTransform><StackPanel Orientation="Horizontal" Margin="10 0"><materialDesign:PackIcon Kind="Facebook" Width="30" Height="30" VerticalAlignment="Center" Margin="5"/><TextBlock Text="脸书" Margin="10" VerticalAlignment="Center"/></StackPanel></ListViewItem></ListView></StackPanel><Grid x:Name="GridMain" Background="#FFFBFBFB" Width="1024" RenderTransformOrigin="0.5,0.5"><Grid.RenderTransform><TransformGroup><ScaleTransform/><SkewTransform/><RotateTransform/><TranslateTransform/></TransformGroup></Grid.RenderTransform><Grid.ColumnDefinitions><ColumnDefinition Width="*"/><ColumnDefinition Width="250"/></Grid.ColumnDefinitions><Grid Grid.Column="1" Background="#FF3580BF"><Image Height="150" VerticalAlignment="Top" Source="https://dotnet9.com/wp-content/uploads/2017/04/About-Header.jpg" Stretch="UniformToFill"/><Ellipse Height="100" Width="100" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="20 100" Stroke="White"><Ellipse.Fill><ImageBrush ImageSource="https://img.dotnet9.com/logo.png" Stretch="UniformToFill"/></Ellipse.Fill></Ellipse><TextBlock Text="Dotnet9" Foreground="White" FontSize="28" FontFamily="Nirmala UI Semilight" Margin="10 100" VerticalAlignment="Top"/><StackPanel Margin="0 150"><Grid Height="60" Margin="20 50 20 0"><Grid.ColumnDefinitions><ColumnDefinition Width="*"/><ColumnDefinition Width="*"/></Grid.ColumnDefinitions><Grid.RowDefinitions><RowDefinition Height="30"/><RowDefinition Height="30"/></Grid.RowDefinitions><TextBlock Text="追随者" VerticalAlignment="Bottom" Foreground="#FFFBFBFB" Margin="5,0,5,5"/><TextBlock Text="1.5K" VerticalAlignment="Top" Foreground="#FFFBFBFB" Grid.Row="1" Margin="10 0"/><TextBlock Text="跟随" VerticalAlignment="Bottom" Foreground="#FFFBFBFB" Margin="5,0,5,5" Grid.Column="1"/><TextBlock Text="2.3K" VerticalAlignment="Top" Foreground="#FFFBFBFB" Grid.Row="1" Margin="10 0" Grid.Column="1"/></Grid><TextBlock TextWrapping="Wrap" Margin="10" Foreground="#FFFBFBFB" FontSize="14"><Run Text="网名:沙漠尽头的狼"/><LineBreak/><LineBreak/><Run Text="网站:https://dotnet9.com"/><LineBreak/><Run Text="    Dotnet9的博客 - 一个热衷于互联网分享精神的个人博客站点"/><LineBreak/><LineBreak/><Run Text="座右铭:时间如流水,只能流去不流回。"/></TextBlock></StackPanel></Grid><Grid><Grid.RowDefinitions><RowDefinition Height="40"/><RowDefinition Height="50"/><RowDefinition Height="*"/><RowDefinition Height="*"/><RowDefinition Height="*"/></Grid.RowDefinitions><Grid.ColumnDefinitions><ColumnDefinition Width="*"/><ColumnDefinition Width="*"/><ColumnDefinition Width="*"/></Grid.ColumnDefinitions><Button x:Name="ButtonCloseMenu" Style="{StaticResource MaterialDesignFloatingActionMiniAccentButton}" Width="30" Height="30" Padding="0" Background="{x:Null}" BorderBrush="{x:Null}" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="5" Click="ButtonCloseMenu_Click" Visibility="Collapsed"><materialDesign:PackIcon Kind="Menu" Foreground="#FF3580BF"/></Button><Button x:Name="ButtonOpenMenu" Style="{StaticResource MaterialDesignFloatingActionMiniAccentButton}" Width="30" Height="30" Padding="0" Background="{x:Null}" BorderBrush="{x:Null}" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="5" Click="ButtonOpenMenu_Click"><materialDesign:PackIcon Kind="Menu" Foreground="#FF3580BF"/></Button><TextBlock Text="照片" Foreground="#FF3580BF" FontSize="30" FontWeight="Bold" Margin="5" Grid.Row="1"/><Grid Margin="5" Grid.Row="2" Grid.Column="0"><Grid.Effect><DropShadowEffect BlurRadius="20" Color="#FFEEEEEE" ShadowDepth="1"/></Grid.Effect><Image Source="https://dotnet9.com/wp-content/uploads/2019/12/wpf.png" Stretch="UniformToFill"/><StackPanel Orientation="Horizontal" Margin="5" HorizontalAlignment="Right" VerticalAlignment="Bottom"><materialDesign:PackIcon Kind="Heart" Foreground="#FFFBFBFB"/><TextBlock Text="25" Foreground="#FFFBFBFB"/></StackPanel></Grid><Grid Margin="5" Grid.Row="2" Grid.Column="1"><Grid.Effect><DropShadowEffect BlurRadius="20" Color="#FFEEEEEE" ShadowDepth="1"/></Grid.Effect><Image Source="https://dotnet9.com/wp-content/uploads/2019/12/winform.png" Stretch="UniformToFill"/><StackPanel Orientation="Horizontal" Margin="5" HorizontalAlignment="Right" VerticalAlignment="Bottom"><materialDesign:PackIcon Kind="Heart" Foreground="#FFFBFBFB"/><TextBlock Text="50" Foreground="#FFFBFBFB"/></StackPanel></Grid><Grid Margin="5" Grid.Row="2" Grid.Column="2"><Grid.Effect><DropShadowEffect BlurRadius="20" Color="#FFEEEEEE" ShadowDepth="1"/></Grid.Effect><Image Source="https://dotnet9.com/wp-content/uploads/2019/12/asp-net-core.png" Stretch="UniformToFill"/><StackPanel Orientation="Horizontal" Margin="5" HorizontalAlignment="Right" VerticalAlignment="Bottom"><materialDesign:PackIcon Kind="Heart" Foreground="#FFFBFBFB"/><TextBlock Text="18" Foreground="#FFFBFBFB"/></StackPanel></Grid><Grid Margin="5" Grid.Row="3" Grid.Column="0"><Grid.Effect><DropShadowEffect BlurRadius="20" Color="#FFEEEEEE" ShadowDepth="1"/></Grid.Effect><Image Source="https://img.dotnet9.com/Xamarin.Forms.png" Stretch="UniformToFill"/><StackPanel Orientation="Horizontal" Margin="5" HorizontalAlignment="Right" VerticalAlignment="Bottom"><materialDesign:PackIcon Kind="Heart" Foreground="#FFFBFBFB"/><TextBlock Text="32" Foreground="#FFFBFBFB"/></StackPanel></Grid><Grid Margin="5" Grid.Row="3" Grid.Column="1"><Grid.Effect><DropShadowEffect BlurRadius="20" Color="#FFEEEEEE" ShadowDepth="1"/></Grid.Effect><Image Source="https://dotnet9.com/wp-content/uploads/2019/12/front-end.png" Stretch="UniformToFill"/><StackPanel Orientation="Horizontal" Margin="5" HorizontalAlignment="Right" VerticalAlignment="Bottom"><materialDesign:PackIcon Kind="Heart" Foreground="#FFFBFBFB"/><TextBlock Text="32" Foreground="#FFFBFBFB"/></StackPanel></Grid></Grid></Grid><StackPanel Orientation="Horizontal" VerticalAlignment="Top" Height="40" HorizontalAlignment="Right" Margin="10"><Button Style="{StaticResource MaterialDesignFloatingActionMiniAccentButton}" Width="30" Height="30" Padding="0" Background="{x:Null}" BorderBrush="{x:Null}"><materialDesign:PackIcon Kind="Bell"/></Button><Button x:Name="ButtonClose" Style="{StaticResource MaterialDesignFloatingActionMiniAccentButton}" Width="30" Height="30" Padding="0" Background="{x:Null}" BorderBrush="{x:Null}" Click="ButtonClose_Click"><materialDesign:PackIcon Kind="Close"/></Button></StackPanel></Grid>
</Window>

简单说明下:

  1. "StackPanelMenu" 作为左侧菜单容器,默认是显示在窗体外,距离窗体左边缘-250,点击左上角菜单按钮图标可控制此容器的显示与隐藏,注:菜单开关由两个按钮组成 "ButtonOpenMenu" 和 "ButtonCloseMenu"。

  2. 左侧菜单项使用 "ListView" 进行布局,实际开发需要运用模板,使用MVVM做成动态菜单,方便扩展。

  3. 中间的5张演示照片,也和2类似。直接使用Grid进行的布局,实际上都需要做成模板。

  4. 抽屉菜单动画见 Window.Resouces 中的动画代码,展开抽屉菜单动画是 "OpenMenu",左侧菜单向右、向下移动,右侧展示区域及个人信息概况界面同时也是向右、向下移动;关闭抽屉菜单动画是 "CloseMenu",动画移动方向与展开时相反(说的是废话),这段动画代码值得好好学习、复用。

文件【MainWindow.xaml.cs】,后台关闭窗体、抽屉菜单按钮切换、窗体移动等事件处理:

private void ButtonClose_Click(object sender, RoutedEventArgs e)
{Application.Current.Shutdown();
}private void ButtonOpenMenu_Click(object sender, RoutedEventArgs e)
{ButtonOpenMenu.Visibility = Visibility.Collapsed;ButtonCloseMenu.Visibility = Visibility.Visible;
}private void ButtonCloseMenu_Click(object sender, RoutedEventArgs e)
{ButtonOpenMenu.Visibility = Visibility.Visible;ButtonCloseMenu.Visibility = Visibility.Collapsed;
}private void MoveWindow_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{DragMove();
}

代码已全部奉上...

3.本文参考

  1. 视频一:C# WPF Material Design UI: Animated Menu,配套源码:AnimatedMenu1。

  2. C# WPF开源控件库《MaterialDesignInXAML》

4.源码

效果图实现代码在文中已经全部给出,站长方便演示,文中的图片使用的本站外链图片,代码可直接Copy,按解决方案目录组织代码文件即可运行。

演示Demo下载


除非注明,文章均由 Dotnet9 整理发布,欢迎转载。
转载请注明本文地址:https://dotnet9.com/7669.html
欢迎扫描下方二维码关注 Dotnet9 的微信公众号,本站会及时推送最新技术文章


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

点击《【阅读原文】》,本站还有更多技术类文章等着您哦!!!

此刻顺便为我点个《【再看】》可好?

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/312146.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

蓝桥杯2017初赛-k倍区间-前缀和

题目描述 给定一个长度为N的数列&#xff0c;A1, A2, … AN。 如果其中一段连续的子序列Ai, Ai1, … Aj(i < j)之和是K的倍数&#xff0c;我们就称这个区间[i, j]是K倍区间。 你能求出数列中总共有多少个K倍区间吗&#xff1f; 输入 第一行包含两个整数N和K。(1 < N, K …

【在路上3】大数据离线分析快递的派件时效

【在路上1】快递物流大数据的由来【在路上2】快递的运单轨迹几乎人人都用过快递&#xff0c;如果说用户最在意什么&#xff1f;那必然是谁家送得快&#xff01;这也是整个快递物流行业被诟病最多的地方。都知道顺丰送得快&#xff0c;但价格摆在那里&#xff0c;且它的市场份额…

DevExpress作为企业赞助商加入.NET基金会

.NET基金会是一个独立的非营利组织&#xff0c;于2014年成立&#xff0c;旨在围绕 .NET 不断增长的开源技术集合&#xff0c;促进开放开发和协作。它是商业和社区开发人员的论坛&#xff0c;通过促进开放性&#xff0c;社区参与和快速创新来增强.NET生态系统的未来。要使.NET 基…

如何快速融入团队(八)

作者&#xff1a;邹溪源&#xff0c;长沙资深互联网从业者&#xff0c;架构师社区特邀嘉宾&#xff01;一感慨时间流逝&#xff0c;韶华易老似乎是我们与生俱来的焦虑&#xff0c;仿佛每当过年的时候总会感觉&#xff0c;呀&#xff0c;我这一年似乎什么都没干呀。你看&#xf…

Docker:使用本地卷和tmpfs挂载

卷是为Docker容器保留数据的首选方法。在本文中&#xff0c;将展示如何创建和使用卷来实现持久性&#xff0c;以及如何使用tmpfs来实现临时存储。最简单的说&#xff0c;创建和安装由本地目录支持的卷如下所示&#xff1a;# make host directory mkdir -p /data# create docker…

ASP.NET 开源导入导出库Magicodes.IE 导出Pdf教程

基础教程之导出Pdf收据说明本教程主要说明如何使用Magicodes.IE.Pdf完成Pdf收据导出要点导出PDF数据自定义PDF模板导出单据如何批量导出单据导出特性PdfExporterAttributeOrientation&#xff1a;方向(横向或纵向)PaperKind&#xff1a;纸张类型&#xff08;默认A4&#xff09;…

宅家过年 | 程序员消遣活动指南

点击上方蓝字关注“汪宇杰博客”导语大家新年好&#xff01;今年的春节由于病毒疫情不适合外出写代码了&#xff0c;那么程序员宅在家里可以干些啥呢&#xff1f;我给大家推荐一些能抱着电脑一边取暖一边消遣的好项目。命令行版星球大战你有没有看过 ASCII ART 版的《星球大战》…

angular 构建可以动态挂载的配置服务

angular 构建可以动态挂载的配置服务Intro在 angular 中可以指定 environment 来区分不同环境下的配置&#xff0c;然而 environment 中的配置会在打包时是固定的&#xff0c;想要像挂载 asp.net core 里的 appsettings.json 的配置文件一样挂载 environment 是做不到的&#x…

关于KN95口罩:可以使用多久?要不要呼吸阀?怎么佩戴?

再说一遍&#xff1a;为啥要戴口罩&#xff01;冠状病毒在人与人之间传播&#xff0c;通常是在某人接触到感染者的分泌物的时候。病毒的传染力直接影响了传播途径。目前流行的新型冠状病毒的传播途径尚不清楚&#xff0c;但是按照以往的经验&#xff0c;接触到感染者咳嗽或打喷…

android 拼音搜索汉字,android开发之使用拼音搜索汉字

国庆回了趟家&#xff0c;昨天真不想走&#xff0c;离家近的感觉太好。唉&#xff0c;不扯这些&#xff0c;说说今天的正事吧。上篇博客中介绍了自定义AutoCompleteTextView &#xff0c;但是用到了一个很蹩脚的技术&#xff0c;就是我们事先把每个汉字的拼音当作一个字段输入进…

从壹开始【学代码】|| 我开发中的用到的几个框架

本文梯子一、单层小Demo&#xff0c;开发小页面利器二、通用仓储三层模型&#xff0c;简单又封装性好三、通用权限框架开发全家桶&#xff0c;开箱即用服务子项目四、Blog.Core去Service层版本五、DDD-Lite 思想进行开发项目六、领域驱动设计&#xff0c;半落地项目七、企业级论…

C#的未来:简化参数空值验证

乍一看&#xff0c;提案#2145 似乎是 C# 8 可空引用类型特性的逻辑扩展。其基本思想是&#xff0c;开发人员不需要再显式地向接受非空参数的方法添加参数空值检查。然而&#xff0c;人们对于这个特性的争议很大。本文试图说明这些选项以及它们的利弊&#xff0c;以便读者能够得…

android一键截图代码,偷偷告诉你ADB命令葵花宝典【一键截图和录屏】

先导预告作为一名测试工程师&#xff0c;每天可能都会面临从不同的设备导出截图或视频的工作&#xff0c;有些可能是bug截图或bug回放视频&#xff0c;有些截图可能是提供给PM或UI验收等等。 常规操作是iOS设备可以借助于iTools等工具导出&#xff1b;而安卓设备可能需要从设备…

【C# 调用 Go 语言】0x1 Hello Golang

C# 和 Golang 都不是世界上最好的语言。在不同的业务场景下&#xff0c;C# 和 Golang 各有所长。如果要编写一个网络程序&#xff0c;显然 Golang 更擅长&#xff0c;而如果要编写一个桌面 GUI 程序&#xff0c;那么 C# 简直不要太爽。我们完全可以将两者用在同一个项目中&…

云原生时代, 选择.NET Core

在容器、Kubernetes、DevOps&#xff0c;以及微服务等技术的推动下&#xff0c;2020年云原生势不可挡。 .NET Core 也非常契合 云原生对应用运行时的不同需求&#xff0c;.NET Core和kubernetes 同年诞生发展&#xff0c; 2018年kubernetes 已经奠定了在容器编排领域的王者地位…

WebApi管理和性能测试工具WebApiBenchmarks

说到WebApi管理和测试工具其实已经非常多的了&#xff0c;Postman、Swagger等在管理和维护上都非常出色&#xff1b;在性能测试方面也有不少的工具如:wrk,bombardier,http_load和ab等等。不过这些工具都具有单一性&#xff0c;管理和维护好的在性能测试上比较低效&#xff0c;对…

android中的shape资源,Android Drawable资源讲解之shape篇

运用好Android的drawable资源&#xff0c;在开发中就可以减少图片的使用量&#xff0c;这样既缩小了app的体积&#xff0c;也省去了设计图片的时间&#xff0c;而且也容易适配不同的屏幕尺寸。今天首先来讲讲shape资源的使用。1. Shape的属性介绍shape共支持四种形状&#xff0…

C# WPF 一个设计界面

微信公众号&#xff1a;Dotnet9&#xff0c;网站&#xff1a;Dotnet9&#xff0c;问题或建议&#xff1a;请网站留言&#xff0c; 如果对您有所帮助&#xff1a;欢迎赞赏。C# WPF 一个设计界面今天正月初三&#xff0c;大家在家呆着挺好&#xff0c;不要忘了自我充电。武汉人民…

android中shape的属性,android中shape的属性

solid&#xff1a;实心&#xff0c;就是填充的意思android:color指定填充的颜色gradient&#xff1a;渐变android:startColor和android:endColor分别为起始和结束颜色&#xff0c;ndroid:angle是渐变角度&#xff0c;必须为45的整数倍。另外渐变默认的模式为android:type”line…

合集| 21 篇技术文章,带你从零入门 K8s

由阿里云与 CNCF 共同开发的《CNCF x Alibaba 云原生技术公开课》&#xff08;视频课程&#xff09;第一期已更新完毕。为了让大家有更好的学习体验&#xff0c;我们把视频课程转为图文&#xff0c;并请讲师重新编辑成文章&#xff0c;在公众号以“从零入门 K8s” 为系列进行每…