当前位置: 首页 > news >正文

C# WPF 布局

C#  

0、WPF 布局

1、ON/OFF按钮

2、textBox

3、ComboBox

4、TabControl

5、Button

<Window x:Class="WpfApp5.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:WpfApp5"mc:Ignorable="d"Title="MainWindow" Height="450" Width="800"WindowStyle="None" AllowsTransparency="True" Background="Transparent"  WindowStartupLocation="CenterScreen"><Window.Resources><Style x:Key="RoundedButtonStyle" TargetType="Button"><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="Button"><Border CornerRadius="10"BorderBrush="{TemplateBinding BorderBrush}"BorderThickness="{TemplateBinding BorderThickness}"Background="{TemplateBinding Background}"><ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/></Border></ControlTemplate></Setter.Value></Setter></Style><!--通用按钮样式--><Style x:Key="WindowButtonStyle" TargetType="Button"><Setter Property="Background" Value="Transparent"/><Setter Property="BorderThickness" Value="0"/><Setter Property="Foreground" Value="Black"/><Style.Triggers><Trigger Property="IsMouseOver" Value="True"><Setter Property="Background" Value="#E5E5E5"/></Trigger></Style.Triggers></Style><!--关闭按钮专用样式--><Style x:Key="CloseButtonStyle" TargetType="Button" BasedOn="{StaticResource WindowButtonStyle}"><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="Button"><BorderBorderBrush="{TemplateBinding BorderBrush}"BorderThickness="{TemplateBinding BorderThickness}"Background="{TemplateBinding Background}"><ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/></Border></ControlTemplate></Setter.Value></Setter></Style><!-- 颜色块模板(用于菜单图标) --><Style x:Key="ColorMenuItemStyle" TargetType="MenuItem"><Setter Property="Width" Value="80"/><Setter Property="Height" Value="25"/><Setter Property="BorderThickness" Value="0"/></Style><!-- //OFF/ON 按钮 --><Style x:Key="CheckBoxSwitchStyle" TargetType="CheckBox"><Setter Property="IsChecked" Value="False"/><Setter Property="Cursor" Value="Hand"/><Setter Property="FontFamily" Value="/MESToolIntegration;component/Fonts/#iconfont"/><Setter Property="Background" Value="#FFFFFF"/><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="CheckBox"><Border Width="54" Name="CheckTrueBG" Height="22" BorderThickness="2" Background="#22B14C"  CornerRadius="10" BorderBrush="#188137" ><Grid><Border BorderThickness="1" Background="#FFFFFF" x:Name="border" Width="20" Height="20" CornerRadius="9" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0"  ><Border.RenderTransform><TranslateTransform  X="1"/></Border.RenderTransform></Border><TextBlock x:Name="txt" Text="{TemplateBinding Content}" FontFamily="iconfont"  FontSize="{TemplateBinding FontSize}" Margin="6.996,2.798,0,2.798" VerticalAlignment="Stretch" Foreground="#FFFFFF" HorizontalAlignment="Left" d:LayoutOverrides="Height" ><TextBlock.RenderTransform><TranslateTransform   X="17"></TranslateTransform></TextBlock.RenderTransform></TextBlock></Grid></Border><ControlTemplate.Triggers><Trigger Property="IsChecked" Value="true"><Setter Property="Background" TargetName="CheckTrueBG"  Value="#5FB878"/><Setter Property="Foreground" TargetName="txt"  Value="#FFFFFF"/><Setter Property="Background" TargetName="border"  Value="#FFFFFF"/><Setter Property="Text" TargetName="txt" Value="{Binding Tag,RelativeSource={RelativeSource TemplatedParent}}"/><Trigger.EnterActions><BeginStoryboard><Storyboard><DoubleAnimation Storyboard.TargetName="border" Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" To="32" Duration="00:00:0.2"/><DoubleAnimation Storyboard.TargetName="txt" Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" To="0" Duration="00:00:0.2"/></Storyboard></BeginStoryboard></Trigger.EnterActions><Trigger.ExitActions><BeginStoryboard><Storyboard><DoubleAnimation Storyboard.TargetName="border" Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" To="0" Duration="00:00:0.2"/><DoubleAnimation Storyboard.TargetName="txt" Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" To="17" Duration="00:00:0.2"/></Storyboard></BeginStoryboard></Trigger.ExitActions></Trigger><Trigger Property="IsChecked" Value="False"><Setter Property="Text" TargetName="txt" Value="{Binding Content,RelativeSource={RelativeSource TemplatedParent}}"/></Trigger></ControlTemplate.Triggers></ControlTemplate></Setter.Value></Setter></Style><!-- //=================================== --><!-- 自定义 CheckBox 样式 --><!-- 自定义 CheckBox 样式 --><Style x:Key="GreenCheckBoxStyle" TargetType="CheckBox"><!-- 默认前景色(勾选标记颜色) --><Setter Property="Foreground" Value="White" /><!-- 默认背景色(未选中时) --><Setter Property="Background" Value="#22B14C" /><!-- 边框颜色 --><Setter Property="BorderBrush" Value="#D0D0D0" /><!-- 模板定义 --><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="CheckBox"><Grid><!-- 背景和边框 --><Border x:Name="Border"BorderThickness="1"BorderBrush="{TemplateBinding BorderBrush}"Background="{TemplateBinding Background}"CornerRadius="3"><!-- 勾选标记(Path 绘制对勾) --><Path x:Name="CheckMark"Data="M 2,6 L 6,10 L 14,2" Stroke="{TemplateBinding Foreground}"StrokeThickness="2"Visibility="Collapsed" Margin="2"/></Border></Grid><!-- 触发器:控制选中状态外观 --><ControlTemplate.Triggers><!-- 选中时显示勾选标记,背景变绿色 --><Trigger Property="IsChecked" Value="True"><Setter TargetName="CheckMark" Property="Visibility" Value="Visible" /><Setter TargetName="Border" Property="Background" Value="#22B14C" /><Setter TargetName="Border" Property="BorderBrush" Value="DarkGreen" /></Trigger><!-- 鼠标悬停时轻微变色(可选) --><Trigger Property="IsMouseOver" Value="True"><Setter TargetName="Border" Property="Background" Value="#E0F0E0" /></Trigger><!-- 禁用状态样式(可选) --><Trigger Property="IsEnabled" Value="False"><Setter Property="Foreground" Value="#AAAAAA" /><Setter TargetName="Border" Property="Background" Value="#F5F5F5" /></Trigger></ControlTemplate.Triggers></ControlTemplate></Setter.Value></Setter></Style><!-- 自定义 TextBox 样式 --><Style x:Key="CustomTextBoxStyle" TargetType="TextBox"><!-- 设置背景色为绿色 --><Setter Property="Background" Value="#22B14C"/><!-- 设置字体颜色为白色 --><Setter Property="Foreground" Value="White"/><!-- 设置边框厚度 --><Setter Property="BorderThickness" Value="1"/><!-- 设置边框颜色 --><Setter Property="BorderBrush" Value="DarkGreen"/><!-- 设置圆角 --><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="TextBox"><Border x:Name="border"BorderThickness="{TemplateBinding BorderThickness}"BorderBrush="{TemplateBinding BorderBrush}"Background="{TemplateBinding Background}"CornerRadius="10"><ScrollViewer x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/></Border><ControlTemplate.Triggers><!-- 当获得焦点时的样式 --><Trigger Property="IsFocused" Value="True"><Setter TargetName="border" Property="BorderBrush" Value="LightGreen"/></Trigger><!-- 当禁用时的样式 --><Trigger Property="IsEnabled" Value="False"><Setter Property="Background" Value="#CCCCCC"/><Setter Property="Foreground" Value="#666666"/></Trigger></ControlTemplate.Triggers></ControlTemplate></Setter.Value></Setter></Style><!-- 定义下拉箭头的几何形状 --><PathGeometry x:Key="DownArrowGeometry">M 0 0 L 3.5 4 L 7 0 Z</PathGeometry><!-- 自定义 ComboBox 下拉箭头按钮的 ControlTemplate --><ControlTemplate x:Key="ComboBoxToggleButtonTemplate" TargetType="ToggleButton"><Borderx:Name="Border"Background="Transparent"BorderBrush="Transparent"BorderThickness="0"CornerRadius="0 5 5 0" Margin="3,0,3,0"><PathWidth="7" VerticalAlignment="Top" x:Name="Arrow" Height="4" HorizontalAlignment="Left" Fill="White" Data="{StaticResource DownArrowGeometry}" Margin="113,9,0,0"/></Border><!-- 触发器 --><ControlTemplate.Triggers><!-- 鼠标悬停时的样式 --><Trigger Property="IsMouseOver" Value="True"><Setter TargetName="Border" Property="Background" Value="Transparent"/></Trigger><!-- 按下时的样式 --><Trigger Property="IsPressed" Value="True"><Setter TargetName="Border" Property="Background" Value="Transparent"/></Trigger><!-- 下拉列表打开时的样式 --><Trigger Property="IsChecked" Value="True"><Setter TargetName="Border" Property="Background" Value="Transparent"/></Trigger><!-- 禁用时的样式 --><Trigger Property="IsEnabled" Value="False"><Setter Property="Foreground" Value="#AAAAAA"/></Trigger></ControlTemplate.Triggers></ControlTemplate><!-- 自定义 ComboBox 样式 --><Style x:Key="CustomComboBoxStyle" TargetType="ComboBox"><!-- 设置基本属性 --><Setter Property="Foreground" Value="#FFFFFF"/><Setter Property="Background" Value="#22B14C"/><Setter Property="BorderBrush" Value="DarkGreen"/><Setter Property="BorderThickness" Value="1"/><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="ComboBox"><Grid><!-- 边框 --><Borderx:Name="Border"BorderThickness="{TemplateBinding BorderThickness}"BorderBrush="{TemplateBinding BorderBrush}"Background="{TemplateBinding Background}"CornerRadius="5"><Grid><!-- 显示选中项的区域 --><ContentPresenterx:Name="ContentSite"HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"VerticalAlignment="{TemplateBinding VerticalContentAlignment}"Margin="{TemplateBinding Padding}"Content="{TemplateBinding SelectionBoxItem}"ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/><!-- 下拉箭头按钮 --><ToggleButtonx:Name="ToggleButton"Template="{StaticResource ComboBoxToggleButtonTemplate}"IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"Focusable="false"/></Grid></Border><!-- 下拉列表 --><Popupx:Name="Popup"IsOpen="{TemplateBinding IsDropDownOpen}"Placement="Bottom"AllowsTransparency="true"Focusable="false"PopupAnimation="Slide"><Borderx:Name="DropDownBorder"BorderThickness="1"BorderBrush="Transparent"Background="#22B14C"CornerRadius="5"Width="{Binding ActualWidth, ElementName=Border}"><!-- 绑定下拉列表宽度到 ComboBox 边框宽度 --><ScrollViewerx:Name="DropDownScrollViewer"><Gridx:Name="Grid"RenderOptions.ClearTypeHint="Enabled"><Canvasx:Name="Canvas"HorizontalAlignment="Left"Height="0"VerticalAlignment="Top"Width="0"><Rectanglex:Name="OpaqueRect"Fill="{Binding Background, ElementName=DropDownBorder}"Height="{Binding ActualHeight, ElementName=DropDownBorder}"Width="{Binding ActualWidth, ElementName=DropDownBorder}"/></Canvas><ItemsPresenterx:Name="ItemsPresenter"KeyboardNavigation.DirectionalNavigation="Contained"SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/></Grid></ScrollViewer></Border></Popup></Grid><!-- 触发器 --><ControlTemplate.Triggers><!-- 鼠标悬停时的样式 --><Trigger Property="IsMouseOver" Value="True"><Setter TargetName="Border" Property="BorderBrush" Value="LightGreen"/></Trigger><!-- 获得焦点时的样式 --><Trigger Property="IsKeyboardFocusWithin" Value="True"><Setter TargetName="Border" Property="BorderBrush" Value="LightGreen"/></Trigger><!-- 禁用时的样式 --><Trigger Property="IsEnabled" Value="False"><Setter Property="Foreground" Value="#AAAAAA"/><Setter TargetName="Border" Property="Background" Value="#CCCCCC"/></Trigger></ControlTemplate.Triggers></ControlTemplate></Setter.Value></Setter></Style></Window.Resources><Grid><!-- 自定义标题栏 --><Grid.RowDefinitions><RowDefinition Height="30"/><RowDefinition Height="*"/></Grid.RowDefinitions><Border Grid.Row="0" Background="#EEEEF2" CornerRadius="5 5 0 0"MouseLeftButtonDown="TitleBar_MouseLeftButtonDown" ><Grid><Grid.ColumnDefinitions><!-- 为图标预留的列,宽度自动调整 --><ColumnDefinition Width="Auto"/><!-- 为 Label 预留的列,宽度自动调整 --><ColumnDefinition Width="Auto"/><!-- 剩余空间的列 --><ColumnDefinition Width="*"/><ColumnDefinition Width="Auto"/><ColumnDefinition Width="Auto"/><ColumnDefinition Width="Auto"/><ColumnDefinition Width="Auto"/></Grid.ColumnDefinitions><!-- 添加图标 Image 控件 --><!-- 添加图标 Image 控件 --><Image Grid.Column="0" Source="/icons8-app-store-480.png" Margin="5,0,5,0" VerticalAlignment="Center" Height="20" MouseLeftButtonDown="Image_MouseLeftButtonDown"/><!-- Label --><Label Content="标题2000" VerticalAlignment="Center"  Foreground="black" FontWeight="Bold"  Grid.Column="1" Margin="5,0,5,0"/><!-- 设置按钮 --><Button Content="⚙" Margin="5,5,5,5" Grid.Column="2"  Width="20" HorizontalAlignment="Right"  BorderThickness="0" Background="Transparent" Click="Button_Click_1" MouseEnter="Button_MouseEnter" MouseLeave="Button_MouseLeave" Style="{StaticResource CloseButtonStyle}"><Button.ToolTip><ToolTip Content="设置" /></Button.ToolTip></Button><!-- 皮肤按钮 --><!-- 主题按钮(带下拉菜单) --><Button Content="🎨" Grid.Column="3" Style="{StaticResource CloseButtonStyle}"Margin="5,5,5,5" Width="20"><Button.ToolTip><ToolTip Content="主题"/></Button.ToolTip><Button.ContextMenu><ContextMenu x:Name="ThemeMenu" PlacementTarget="{Binding PlacementTarget, RelativeSource={RelativeSource Self}}"><MenuItem Header="绿色" Click="ColorMenuItem_Click"Style="{StaticResource ColorMenuItemStyle}"><MenuItem.Background><SolidColorBrush Color="#FF4CAF50"/></MenuItem.Background></MenuItem><MenuItem Header="红色" Click="ColorMenuItem_Click"Style="{StaticResource ColorMenuItemStyle}"><MenuItem.Background><SolidColorBrush Color="#FFF44336"/></MenuItem.Background></MenuItem><MenuItem Header="蓝色" Click="ColorMenuItem_Click"Style="{StaticResource ColorMenuItemStyle}"><MenuItem.Background><SolidColorBrush Color="#FF2196F3"/></MenuItem.Background></MenuItem><MenuItem Header="黄色" Click="ColorMenuItem_Click"Style="{StaticResource ColorMenuItemStyle}"><MenuItem.Background><SolidColorBrush Color="#FFFFEB3B"/></MenuItem.Background></MenuItem><MenuItem Header="灰色" Click="ColorMenuItem_Click"Style="{StaticResource ColorMenuItemStyle}"><MenuItem.Background><SolidColorBrush Color="#FF9E9E9E"/></MenuItem.Background></MenuItem><MenuItem Header="暗色" Click="ColorMenuItem_Click"Style="{StaticResource ColorMenuItemStyle}"><MenuItem.Background><SolidColorBrush Color="#FF212121"/></MenuItem.Background></MenuItem><MenuItem Header="亮色" Click="ColorMenuItem_Click"Style="{StaticResource ColorMenuItemStyle}"><MenuItem.Background><SolidColorBrush Color="#FFFFFFFF"/></MenuItem.Background></MenuItem></ContextMenu></Button.ContextMenu></Button><!-- 最小化按钮 --><Button Content="-" Margin="5,5,0,5" Grid.Column="4" Width="20" Foreground="black" BorderThickness="0" Background="Transparent" Click="MinimizeButton_Click" MouseEnter="Button_MouseEnter" MouseLeave="Button_MouseLeave" Style="{StaticResource CloseButtonStyle}"><Button.ToolTip><ToolTip Content="最小化" /></Button.ToolTip></Button><!-- 最大化按钮 --><Button Content="□" Margin="0,5,0,5" Grid.Column="5" Width="20" Foreground="black" BorderThickness="0" Background="Transparent" Click="MaximizeButton_Click" MouseEnter="Button_MouseEnter" MouseLeave="Button_MouseLeave" Style="{StaticResource CloseButtonStyle}"><Button.ToolTip><ToolTip Content="最大化" /></Button.ToolTip></Button><!-- 关闭按钮 --><Button Content="✕" Margin="0,5,0,5" Grid.Column="6" Width="20" Foreground="black" BorderThickness="0" Background="Transparent" Click="CloseButton_Click"  MouseEnter="CloseButton_MouseEnter" MouseLeave="Button_MouseLeave"  Style="{StaticResource CloseButtonStyle}"><Button.ToolTip><ToolTip Content="关闭" /></Button.ToolTip></Button></Grid></Border><!-- 主内容区域 --><Grid Grid.Row="1" x:Name="MainContentGrid" Background="White"><Grid.ColumnDefinitions><ColumnDefinition Width="200"/><ColumnDefinition Width="400"/></Grid.ColumnDefinitions><StackPanel Grid.Column="0" Background="LightGray"><Button Content="主页" Margin="5" Padding="10"MouseEnter="Button_MouseEnter" MouseLeave="Button_MouseLeave"Click="Button_Click"Style="{StaticResource RoundedButtonStyle}"Height="30"Width="180"BorderThickness="1"BorderBrush="Gray"/><Button Content="设置" Margin="5" Padding="10"MouseEnter="Button_MouseEnter" MouseLeave="Button_MouseLeave"Click="Button_Click"Style="{StaticResource RoundedButtonStyle}"Height="30" Width="180"BorderThickness="1"BorderBrush="Gray"/><Button Content="联系" Margin="5" Padding="10"MouseEnter="Button_MouseEnter" MouseLeave="Button_MouseLeave"Click="Button_Click"Style="{StaticResource RoundedButtonStyle}"Height="30" Width="180"BorderThickness="1"BorderBrush="Gray"><Button.Background><LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" Opacity="0.3"><GradientStop Color="#FF55CC19" Offset="1"/><GradientStop Color="White" Offset="0"/></LinearGradientBrush></Button.Background></Button><Button Content="备注" Margin="5" Padding="10"MouseEnter="Button_MouseEnter" MouseLeave="Button_MouseLeave"Click="Button_Click"Style="{StaticResource RoundedButtonStyle}"Height="30" Width="180"BorderThickness="1"BorderBrush="Gray"/><CheckBox BorderThickness="1,1,0,1" Style="{DynamicResource CheckBoxSwitchStyle}"  Content="OFF" Tag="NO" /><CheckBox Content="启用功能" Style="{StaticResource GreenCheckBoxStyle}" Margin="10" Height="20" Width="22" /><TextBox Style="{StaticResource CustomTextBoxStyle}" Text="自定义样式TextBox" Margin="10" Height="30" Width="180" FontSize="20"/><ComboBoxStyle="{StaticResource CustomComboBoxStyle}"Margin="10" Width="128"><ComboBoxItem>选项 1000000</ComboBoxItem><ComboBoxItem>选项 2000000</ComboBoxItem><ComboBoxItem>选项 3000000</ComboBoxItem></ComboBox></StackPanel><Frame x:Name="ContentArea" Grid.Column="1" NavigationUIVisibility="Hidden" Margin="0,0,-200,0"/></Grid></Grid>
</Window><Page x:Class="WpfApp5.Page2"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:WpfApp5"mc:Ignorable="d"Title="Page2" Height="450" Width="800"><Page.Resources><Style TargetType="TabControl"><Setter Property="BorderThickness" Value="0"/><!-- 去掉 TabControl 的边框 --><Setter Property="Padding" Value="0"/></Style><!-- 自定义 TabItem 样式 --><Style TargetType="TabItem"><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="TabItem"><Grid><Border x:Name="Border"BorderBrush="Transparent"BorderThickness="0,0,0,1" Background="{TemplateBinding Background}"Padding="{TemplateBinding Padding}"><ContentPresenter x:Name="ContentSite"VerticalAlignment="Center"HorizontalAlignment="Center"ContentSource="Header"Margin="12,2,12,2"/></Border></Grid><ControlTemplate.Triggers><Trigger Property="IsSelected" Value="True"><Setter TargetName="Border" Property="BorderBrush" Value="#C3C3C3"/><!-- 选中时横线颜色 --></Trigger></ControlTemplate.Triggers></ControlTemplate></Setter.Value></Setter></Style></Page.Resources><Grid><TabControl x:Name="MyTabControl"><TabItem Header="View1" BorderThickness="0" Background="Transparent" Width="200"><local:Window1 /></TabItem><TabItem Header="View2" BorderThickness="0" Background="Transparent" Width="200"><TabItem.DataContext><local:Page3/></TabItem.DataContext><local:Win2/></TabItem><TabItem Header="View3" BorderThickness="0" Background="Transparent" Width="200"><TabItem.DataContext><local:Page3/></TabItem.DataContext></TabItem></TabControl></Grid>
</Page>

相关文章:

C# WPF 布局

C# 0、WPF 布局 1、ON/OFF按钮 2、textBox 3、ComboBox 4、TabControl 5、Button <Window x:Class"WpfApp5.MainWindow"xmlns"http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x"http://schemas.microsoft.com/winfx/20…...

【PaaS与AI融合】MLOps平台的架构设计

PaaS与AI融合:MLOps平台的架构设计 一、技术背景与发展趋势二、技术架构核心特征1. 全生命周期管理闭环2. 混合编排引擎3. 智能资源调度三、关键技术实现细节1. 持续集成流水线2. 异构资源管理3. 安全治理体系四、行业实践与未来演进典型案例分析发展趋势展望五、架构设计建议…...

硬件工程师面试常见问题(15)

第七十一问&#xff1a;运放增益带宽积解读&#xff08;有待改进&#xff09; 增益带宽积顾名思义&#xff1a;增益&#xff08;就是开环增益&#xff09;与带宽的乘积&#xff1b; 第七十二问&#xff1a;运放输出摆幅 定义&#xff1a;输出摆幅是指输出信号在最大值和最小值…...

SpringMVC——第6章:RESTFul编程风格

一、RESTFul编程风格 1.RESTFul是什么 RESTFul是WEB服务接口的一种设计风格。 RESTFul定义了一组约束条件和规范&#xff0c;可以让WEB服务接口更加简洁、易于理解、易于扩展、安全可靠。 RESTFul对一个WEB服务接口都规定了哪些东西&#xff1f; 对请求的URL格式有约束和规范…...

深度解析:从 GPT-4o“谄媚”到 Deepseek“物理腔”,透视大模型行为模式的底层逻辑与挑战

深度解析&#xff1a;从 GPT-4o“谄媚”到 AI“物理腔”&#xff0c;透视大模型行为模式的底层逻辑与挑战 标签&#xff1a;人工智能, GPT-4o, 大语言模型, AI伦理, 人机交互, 技术思考 大家好&#xff01;最近AI圈最火的“瓜”之一&#xff0c;莫过于OpenAI的GPT-4o模型在一…...

2025 年最新树莓派 Pico 连接 OLED 显示字模汉字详细教程

OLED 概述 OLED&#xff08;Organic Light-Emitting Diode&#xff0c;有机发光二极管&#xff09;是一种基于有机材料的发光技术&#xff0c;通过电流驱动有机薄膜发光&#xff0c;具有自发光、高对比度、柔性可弯曲等特点。 4 针脚 OLED 硬件电路如图所示&#xff0c;GND 接…...

【Ubuntu 安装Docker CE-Jenkins】

安装Docker CE(Ubuntu) Install | Docker Docs官网 使用apt仓库安装 DNS配置(可选) #手动替换 sudo vim /etc/systemd/resolved.conf #典型配置如下 [Resolve] DNS8.8.8.8 DNS114.114.114.114 FallbackDNS1.1.1.1 # 备用 DNS#sed替换 sudo sed -i /^#DNS/ {s/#DNS/DNS8.8.8…...

知识图谱 + 大语言模型:打造更聪明、更可靠的AI大脑 —— 探索 GraphRAG 中文优化与可视化实践

大语言模型&#xff08;LLMs&#xff09;无疑是近年来人工智能领域最耀眼的明星。它们强大的自然语言理解和生成能力&#xff0c;在文本创作、代码生成、对话交互等众多领域展现了惊人的潜力。然而&#xff0c;当前的 LLMs 并非完美无缺&#xff0c;它们常常面临着“幻觉”&…...

三、【LLaMA-Factory实战】模型微调进阶:从LoRA到MoE的技术突破与工程实践

一、引言 在大模型微调领域&#xff0c;选择合适的训练策略直接决定了效率与效果的平衡。LLaMA-Factory深度整合了参数高效微调&#xff08;PEFT&#xff09;、全量微调、混合专家模型&#xff08;MoE&#xff09;等12种训练策略&#xff0c;支持从消费级GPU到多卡集群的全场景…...

Photo-SLAM论文理解、环境搭建、代码理解与实测效果

前言&#xff1a;第一个解耦式Photo-SLAM&#xff0c;亮点和效果。 参考&#xff1a;https://zhuanlan.zhihu.com/p/715311759 全网最细PhotoSLAM的conda环境配置教程&#xff0c;拒绝环境污染&#xff01;&#xff01;-CSDN博客 1. 环境搭建 硬件&#xff1a;RTX 4090D wi…...

解决pycharm检测不到已经装好的conda的pytorch环境

问题 1.找装anaconda的位置&#xff08;我装到了py-anacon下&#xff09; 2.找到下图中的conda.bat 3.pycharm社区版右下角&#xff0c;添加新解释器 4.选conda环境&#xff0c;选择2.中conda.bat的位置&#xff0c;加载环境&#xff0c;使用现有环境&#xff0c;可以看到有选…...

【计算机视觉】3d人脸重建:3DDFA_V2:实时高精度3D人脸重建与密集对齐技术指南

3d人脸重建&#xff1a;3DDFA_V2&#xff1a;实时高精度3D人脸重建与密集对齐技术指南 一、项目概述与技术背景1.1 3DDFA_V2核心价值1.2 技术演进路线1.3 核心技术指标 二、环境配置与模型部署2.1 硬件要求2.2 软件安装基础环境搭建关键组件安装 2.3 模型下载 三、核心算法原理…...

谈判模拟器 - Gemini 2.5 商业优化版

核心目标&#xff1a; 基于深厚的理论知识、丰富的实战经验和前沿的技术洞察&#xff0c;结合麦肯锡领先的谈判策略框架&#xff0c;为用户提供全面、深入、可操作的商业谈判策略指导和建议&#xff0c;助力其在复杂商业环境中达成最优谈判结果&#xff0c;并实现商业价值最大化…...

深度学习系统学习系列【4】之反向传播(BP)四个基本公式推导

文章目录 补充知识&#xff1a;∇ 和 ⊙ 运算符详解∇ (nabla) 运算符⊙ (圆圈点) 运算符 反向传播基本公式计算图和基本定义BP1&#xff1a;输出层误差推导BP1公式的重要性实际例子BP2第 l l l层误差推导BP3 &#xff1a;损失函数关于偏置(b)偏导的推导BP4&#xff1a; 损失函…...

算法每日一题 | 入门-顺序结构-上学迟到

上学迟到 题目描述 学校和 yyy 的家之间的距离为 s 米&#xff0c;而 yyy 以 v 米每分钟的速度匀速走向学校。 在上学的路上&#xff0c;yyy 还要额外花费 10 分钟的时间进行垃圾分类。 学校要求必须在上午 8:00 到达&#xff0c;请计算在不迟到的前提下&#xff0c;yyy 最…...

开源库测试

yolov10 https://github.com/THU-MIG/yolov10 conda create -n yolov10 python3.9 conda activate yolov10 pip install -r requirements.txt pip install -e .报错 找不到对应版本 Could not find a version that satisfies the requirement gradio4.31.5 (from versions:…...

因为gromacs必须安装cuda(系统自带的NVIDIA驱动不行),这里介绍下如何安装cuda

1. 安装步骤 查看是否安装了cuda # 法1 cat /usr/local/cuda/version.txt # 法2 nvcc --version 若没有安装&#xff0c;则查看是否有N卡驱动&#xff0c;若无N卡驱动&#xff0c;则到软件与更新 -> 附加驱动中安装驱动 查看N卡驱动支持的cuda版本 nvidia-smi 如下…...

ABC 404

1.C 题&#xff1a; 1.思路&#xff1a; NM&每个点读数为2&#xff0c;但图中有可能出现多环&#xff0c;需要判断所有点是否都在同一连通块上&#xff0c;有俩种解法&#xff1a;搜索&#xff0c;循环 2.代码&#xff08;循环做法&#xff09; #include<bits/stdc.h&g…...

机器学习朴素贝叶斯算法

1.朴素贝叶斯算法 1.1基本概念 其分类原理是利用贝叶斯公式根据某特征的先验概率计算出其后验概率&#xff0c;然后选择具有最大后验概率作为该特征所属的类。之所以称之为“朴素”&#xff0c;是因为贝叶斯分类只做最原始、最简单的假设&#xff1a;所有的特征之间是相对独立…...

Linux:深入理解数据链路层

实际上一台主机中&#xff0c;报文并没有通过网络层直接发送出去&#xff0c;而是交给了自己的下一层协议——数据链路层&#xff01;&#xff01; 一、理解数据链路层 网络层交付给链路层之前&#xff0c;会先做决策再行动&#xff08;会先查一下路由表&#xff0c;看看目标网…...

健康养生:从生活点滴启航

养生并非遥不可及的高深学问&#xff0c;只需把握生活中的细微之处&#xff0c;就能为健康保驾护航。 清晨睁眼&#xff0c;先在床上做简单的搓脸动作&#xff0c;从下巴到额头轻柔按摩&#xff0c;促进面部血液循环&#xff0c;唤醒肌肤活力。随后空腹喝一杯温水&#xff0c;可…...

【向量数据库】用披萨点餐解释向量数据库:一个美味的技术类比

文章目录 前言场景设定&#xff1a;披萨特征向量化顾客到来&#xff1a;生成查询向量相似度计算实战1. 欧氏距离计算&#xff08;值越小越相似&#xff09;2. 余弦相似度计算&#xff08;值越大越相似&#xff09; 关键发现&#xff1a;度量选择影响结果现实启示结语 前言 想象…...

CloudCompare 中 ccDrawableObject

CloudCompare 中 ccDrawableObject 类的主要内容与使用 1. ccDrawableObject 概述 在 CloudCompare 中&#xff0c;ccDrawableObject 是一个基类&#xff0c;主要用于管理 3D 可绘制对象 的显示属性&#xff0c;如颜色、可见性、LOD&#xff08;层次细节&#xff09;、光照等…...

【Linux】进程控制

&#x1f31f;&#x1f31f;作者主页&#xff1a;ephemerals__ &#x1f31f;&#x1f31f;所属专栏&#xff1a;Linux 目录 前言 一、什么是进程控制 二、进程创建 三、进程终止&#xff08;进程退出&#xff09; 退出码 main函数返回 _exit() exit() 测试 四、进…...

设计模式-基础概念学习总结(继承、多态、虚方法、方法重写)

概念使用例子的方式介绍&#xff08;继承&#xff0c;多态&#xff0c;虚方法&#xff0c;方法重写&#xff09;&#xff0c;实现代码python 1. 继承&#xff08;Inheritance&#xff09; 概念&#xff1a;子类继承父类的属性和方法&#xff0c;可以直接复用父类的代码&#…...

分析rand()和srand()函数的功能

rand()和srand()函数原型&#xff1a; int rand(void) 返回一个范围在 0 到 RAND_MAX 之间的伪随机数。 void srand(unsigned int seed)用来给rand() 设置随机数发生器&#xff0c;随机数发生器输出不同的数值&#xff0c;rand() 就会生成不同的随机数 1)、在“D:\Keil_v5\AR…...

架构师如何构建个人IP:职业规划与业务战略的双重提升

在数字化时代&#xff0c;软件架构师的角色已从单纯的技术专家转变为兼具技术领导力和业务影响力的复合型人才。如何构建个人IP&#xff0c;提升行业影响力&#xff0c;成为架构师职业发展的关键课题。本文从个人认知、业务战略、架构决策、产品思维四个维度&#xff0c;探讨架…...

CSS知识总结

一、CSS核心概念解析 1.1 选择器体系&#xff08;重点&#xff09; 基础选择器&#xff1a; /* ID选择器 */ #header { background: #333; }/* 类选择器 */ .btn-primary { color: white; }/* 属性选择器 */ input[type"text"] { border: 1px solid #ccc; } 组合…...

CRS 16 slot 设备硬件架构

目录 1. 核心组件 1.1 线路卡与物理接口模块 1.2 交换结构与容量 1.3 控制与管理 1.4 风扇与散热 1.5 电源与告警 2. 插槽编号与机箱布局 2.1 前侧&#xff08;PLIM 面&#xff09; 2.2 后侧&#xff08;MSC 面&#xff09; 2.3 插槽配对 1. 核心组件 1.1 线路卡与物…...

人工智能浪潮中Python的核心作用与重要地位

在人工智能&#xff08;Artificial Intelligence&#xff0c;AI&#xff09;蓬勃发展的时代&#xff0c;Python已然成为推动这一技术进步的关键编程语言。从复杂的机器学习算法实现&#xff0c;到前沿的深度学习模型构建&#xff0c;再到智能系统的部署&#xff0c;Python无处不…...

【了解】数字孪生网络(Digital Twin Network,DTN)

目录 一、为什么&#xff1f;二、是什么&#xff1f;三、什么架构&#xff1f;四、如何应用&#xff1f;参考 一、为什么&#xff1f; 一方面&#xff0c;网络负载不断增加,&#xff0c;网络规模持续扩大带来的网络复杂性&#xff0c;使得网络的运行和维护变得越来越复杂。另一…...

[C语言]第一章-初识

目录 一.引言 二.MinGW 下载与安装 1.什么是 MinGW 2.下载 MinGW 3.安装 MinGW 4.配置 MinGW 环境变量 三.VS Code 下载与安装 1.什么是 VS Code 2.下载 VS Code 3.安装 VS Code 4.汉化 5.安装扩展插件 C/C 截图 四.编写并运行 Hello World 程序 代码解释 运行…...

如何用git将项目上传到github

步骤 1.创建仓库 2.记下仓库的url 3.在本地初始化仓库 路径要在项目下 cd /path/to/your/vue-project git init 4.创建touch .gitignore文件 在项目根目录下创建 .gitignore 文件&#xff0c;用于指定 Git 忽略哪些文件或文件夹 5.添加和提交项目文件 将文件提交到版本控…...

C++入门(上)--《Hello C++ World!》(1)(C/C++)

文章目录 前言命名空间域命名空间的用法 C的输入和输出缺省参数函数重载auto关键字(C11)范围for 前言 C不是C# C兼容大部分C的东西&#xff0c;但不是完全(98%的样子&#xff0c;除非遇到了不兼容的&#xff0c;那就记一下&#xff0c;不然就认为自己在C里面写的那些可以写到C里…...

架构思维:构建高并发读服务_基于流量回放实现读服务的自动化测试回归方案

文章目录 引言一、升级读服务架构&#xff0c;为什么需要自动化测试&#xff1f;二、自动化回归测试系统&#xff1a;整体架构概览三、日志收集1. 拦截方式2. 存储与优化策略3. 架构进化 四、数据回放技术实现关键能力 五、差异对比对比方式灵活配置 六、三种回放模式详解1. 离…...

代码随想录第33天:动态规划6(完全背包基础)

一、完全平方数&#xff08;Leetcode 279&#xff09; 本题与“零钱兑换”基本一致。 1.确定dp数组以及下标的含义 dp[j]&#xff1a;和为j的完全平方数的最少数量为dp[j] 2.确定递推公式 dp[j] 可以由dp[j - i * i]推出&#xff0c; dp[j - i * i] 1 便可以凑成dp[j]。 …...

Android控件View、ImageView、WebView用法

一 控件清单 View、ImageView、WebView 二 控件UI代码 <?xml version="1.0" encoding="utf-8"?> <androidx.coordinatorlayout.widget.CoordinatorLayoutxmlns:android="http://schemas.android.com/apk/res/android"xmlns:app=&qu…...

关于浏览器页面自动化操作

Selenium 是一个用于自动化浏览器操作的强大框架&#xff0c;广泛应用于Web应用程序的测试自动化。它主要由以下几个核心组件组成&#xff1a; Selenium WebDriver&#xff1a; WebDriver 是 Selenium 的核心组件&#xff0c;它提供了一组API&#xff0c;允许开发者编写程序来…...

P5739 计算阶乘详解

此题目&#xff0c;对于会递归的很简单很简单&#xff0c;但作者是野人不会&#xff0c;只能是边刷边学&#xff0c;且题解比较有意思&#xff0c;所有我这次的重心不是题目&#xff0c;而是题解里面创作者展示的不一样的东西&#xff0c;先看题目 题目要求不用for循环&#xf…...

把Android设备变成“国标摄像头”:GB28181移动终端实战接入指南

把Android设备变成“国标摄像头”&#xff1a;GB28181移动终端实战接入指南 ——执法记录仪、巡检终端、布控球&#xff0c;如何通过大牛直播SDK直接挂到GB28181平台&#xff1f; 在过去&#xff0c;GB28181 通常用于固定摄像头、NVR等“设备端”。但在政务、安防、应急等行业…...

机器学习项目流程极简入门:从数据到部署的完整指南

前言 本文将通过一个简单案例&#xff08;根据水果外观特征判断是否为橘子&#xff09;&#xff0c;逐步拆解机器学习项目的完整流程&#xff0c;帮助读者掌握从数据收集到模型部署的全流程方法论。 通常&#xff0c;一个完整的机器学习项目可以分为以下几个步骤&#xff1a; …...

PrivKV: Key-Value Data Collection with Local Differential Privacy论文阅读

文献阅读课需要制作ppt但是感觉选的这篇论文都是公式&#xff0c;决定做点动画直观展示一下。还没有完成会继续更新这个笔记 manim动画代码 需要下载ffmpeg下载latex https://docs.manim.org.cn/getting_started/installation.html ffmpeg下载教程 texlive官网 但是其实不需要…...

RViz(机器人可视化工具)的配置文件(moveitcpp)

1. Panels&#xff08;面板设置&#xff09; 面板是RViz界面中的各个功能区域&#xff0c;用于显示和操作不同的数据。 Displays&#xff08;显示面板&#xff09; Class: rviz_common/Displays 指定面板的类型&#xff0c;这里是显示面板。 Help Height: 78 帮助区域的高度…...

kotlin 01flow-StateFlow 完整教程

一 Android StateFlow 完整教程&#xff1a;从入门到实战 StateFlow 是 Kotlin 协程库中用于状态管理的响应式流&#xff0c;特别适合在 Android 应用开发中管理 UI 状态。本教程将带全面了解 StateFlow 的使用方法。 1. StateFlow 基础概念 1.1 什么是 StateFlow? StateF…...

OpenGl实战笔记(1)基于qt5.15.2+mingw64+opengl绘制三角形

一、实现效果 二、实现原理 &#xff08;1&#xff09;各函数作用与原理 initialize() 作用&#xff1a; 初始化 OpenGL 函数&#xff08;initializeOpenGLFunctions()&#xff09; 设置背景清除颜色为 rgba(0.2, 0.3, 0.4, 1.0)。 原理&#xff1a; initializeOpenGLFunctio…...

S100平台调试RS485/RS232

提供一个C语言的测试程序Demo #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h>...

蓝桥杯 19. 植树

植树 题目描述 小明和朋友们一起去郊外植树&#xff0c;他们带了一些在实验室中精心研究出的小树苗。 一共有 n 个人&#xff0c;每个人挑选了一个适合植树的位置&#xff0c;一共 n 个位置。每人准备在自己的位置种下一棵树苗。 但他们遇到一个问题&#xff1a;有的树苗比…...

Spring Boot 中 @Bean 注解详解:从入门到实践

在 Spring Boot 开发中&#xff0c;Bean注解是一个非常重要且常用的注解&#xff0c;它能够帮助开发者轻松地将 Java 对象纳入 Spring 容器的管理之下&#xff0c;实现对象的依赖注入和生命周期管理。对于新手来说&#xff0c;理解并掌握Bean注解&#xff0c;是深入学习 Spring…...

git项目迁移,包括所有的提交记录和分支 gitlab迁移到gitblit

之前git都是全新项目上传&#xff0c;没有迁移过&#xff0c;因为迁移的话要考虑已有项目上的分支都要迁移过去&#xff0c;提交记录能迁移就好&#xff1b;分支如果按照全新项目上传的方式需要新git手动创建好老git已有分支&#xff0c;在手动一个一个克隆老项目分支代码依次提…...

前端面试每日三题 - Day 25

这是我为准备前端/全栈开发工程师面试整理的第25天每日三题练习&#xff0c;涵盖了&#xff1a; CSS中如何实现一个保持宽高比的自适应正方形元素Angular的变更检测&#xff08;Change Detection&#xff09;机制项目实战 - 设计一个微前端架构的前端应用。 ✅ 题目1&#xff…...