.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;且它的市场份额…

c语言学生成绩查询课设报告,C语言课设报告(学生考试成绩查询程序)【荐】.doc...

C语言课设报告(学生考试成绩查询程序)【荐】.doc学生考试成绩查询程序学号&#xff1a;********姓名&#xff1a;*****完成日期&#xff1a;****年月通过键盘输入学生的考试信息&#xff0c;包括&#xff1a;学号、姓名、课程名称、学分、考试分数(一个学生应考数门课程&#x…

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

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

蓝桥杯第四届初赛-买不到的数目-数论

题目描述 小明开了一家糖果店。他别出心裁&#xff1a;把水果糖包成4颗一包和7颗一包的两种。糖果不能拆包卖。 小朋友来买糖的时候&#xff0c;他就用这两种包装来组合。当然有些糖果数目是无法组合出来的&#xff0c;比如要买 10 颗糖。 你可以用计算机测试一下&#xff0c;…

【在路上4】在派件时效分析中剥离有效因素

昨天提到&#xff0c;即使有了末端派件时效的初步分析&#xff0c;也免不了各种各样数之不尽的主观客观因素&#xff0c;以至于进入困境。此时此刻&#xff0c;让我们重头再来&#xff0c;这个项目的核心目标是什么&#xff1f;---找到末端派件效率底下的关键点&#xff0c;并给…

c语言程序设计7.4思考题答案,C语言程序设计习题集及答案(7)

2 下面函数的功能是将一个整数字符串转换为一个整数&#xff0c;例如&#xff1a;\1234\转换为1234&#xff0c;请填空使程序完整。int chnum(char *p) { int num0,k,len,j; lenstrlen(p);for( ; 【3】 ; p){ k 【4】 ; j(--len); while( 【5】 ) kk*10; numnumk; }return (num…

蓝桥杯2018初赛-猴子分香蕉-模拟(易错)

题目描述 5只猴子是好朋友&#xff0c;在海边的椰子树上睡着了。这期间&#xff0c;有商船把一大堆香蕉忘记在沙滩上离去。 第1只猴子醒来&#xff0c;把香蕉均分成5堆&#xff0c;还剩下1个&#xff0c;就吃掉并把自己的一份藏起来继续睡觉。 第2只猴子醒来&#xff0c;重新把…

c语言函数求pi的近似值,C语言 用π/4=1-1/3+1/5-1/7+... 求π的近似值

vmware网卡设置详解转载请注明出处!本文连接及作者.不得用于商业用途! http://hi.baidu.com/quantumcloud/blog/item/9156a6c584996c179c163d5b.html B ...MediaInfo使用简介(新版本支持HEVC)MediaInfo 用来分析视频和音频文件的编码和内容信息,是一款是自由软件 (免费使用.免费…

如何快速融入团队(八)

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

全自动洗衣机单片机c语言程序,全自动洗衣机单片机程序

#include#define uchar unsigned char#define uint unsigned intsbit mo_r P3^2; //电机右控制线sbit mo_l P3^3; //电机左控制线sbit key_menu P3^4; // 菜单按键sbit key_on P3^5; // 开始按键sbit key_off P3^6; // 结束按键sbit key_se P3^7; // 菜单…

Docker:使用本地卷和tmpfs挂载

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

蓝桥杯2018初赛-哪天返回-模拟

题目描述 小明被不明势力劫持。后莫名其妙被扔到x星站再无问津。 小明得知每天都有飞船飞往地球&#xff0c;但需要108元的船票&#xff0c;而他却身无分文。 他决定在x星战打工。好心的老板答应包食宿&#xff0c;第1天给他1元钱。 并且&#xff0c;以后的每一天都比前一天多…

C语言用循环结构算平均值,C语言循环结构选择题().doc

1、若i,j已定义为int类型,则以下程序段中内循环体的总的执行次数是for (i5;i;i--)for (j0;j<4;j){...}A) 20 B) 25C) 24 D) 30Afor(i0,j10;i<j;i,j--) kij;2、设i,j,k均为int型变量,则执行完下面的for循环后,k的值为A) 12 B) 10C) 11 D) 9B3、当执行以下程序段时x-1&…

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

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

蓝桥杯真题-连号区间数-枚举

题目描述 小明这些天一直在思考这样一个奇怪而有趣的问题&#xff1a; 在1~N的某个全排列中有多少个连号区间呢&#xff1f;这里所说的连号区间的定义是&#xff1a; 如果区间[L, R] 里的所有元素&#xff08;即此排列的第L个到第R个元素&#xff09;递增排序后能得到一个长度…

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

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

C++手写gcd函数

C< cmath >库中的求最大公因数__gcd函数手写如下&#xff1a; int gcd(int a,int b) {return b?gcd(b,a%b):a; }

c语言树写入文件,如何安全地实现文件树遍历(C语言)

我在软呢帽上试过这个密码,但是No such file or directory和Permission denied错误。如何处理错误并继续扫描文件系统?ftw()从路径开始/#define _XOPEN_SOURCE 500#include #include #include FILE * output;static int display_info(const char * fpath, const struct stat *…

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

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