stay 《.NET6: Based on Development WPF Modern 3D Industrial Software (1)》 We created one " roughcast " Interface , It's still a long way from being modern . This article will deepen the achievements of the previous stage , Realize the current popular Diablo style UI.
1 Set a dark theme
utilize MergedDictionaries To configure , Add Dark.Blue The theme . The code is as follows :
App.xaml
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/Fluent;Component/Themes/Generic.xaml" />
<ResourceDictionary Source="pack://application:,,,/Fluent;component/Themes/Themes/Dark.Blue.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Run it :
The theme has become a dark mode .
2 to Button Add Icon
2.1 Introduce pictures
Add... In the project directory Resources Catalog , hold circle.png Copied to the Resources Under the table of contents .
Add pictures to the project in the project browser , choice Resources Catalog , Right-click menu :
choice Resources/circle.png
2.2 Set picture properties
Select Picture , Set... In the property panel :
- Copy to output directory : Always copy
- Build operation : Content
Follow the above steps to add other pictures .
2.3 Ribbon Button Using pictures in
by Fluent:Button Set up Icon attribute , Reference picture resources
<!--Tabs-->
<Fluent:RibbonTabItem Header=" modeling ">
<Fluent:RibbonGroupBox Header=" Primitives " IsLauncherVisible="False">
<Fluent:Button Header=" A straight line " Icon="/Resources/line.png" Size="Large"/>
<Fluent:Button Header=" arc " Icon="/Resources/arc3pts.png" Size="Large"/>
<Fluent:Button Header=" circular " Icon="/Resources/circle.png" Size="Large"/>
</Fluent:RibbonGroupBox>
</Fluent:RibbonTabItem>
<Fluent:RibbonTabItem Header=" Set up ">
</Fluent:RibbonTabItem>
Run it :
3 increase Button The response message
3.1 Add routing commands
Definition RoutedCommand Used in the response Button Click events for .
MainWindow.xaml.cs
public partial class MainWindow
{
// Define routing commands
public static readonly RoutedCommand ExecuteCommand = new RoutedCommand("Rapid", typeof(MainWindow));
public MainWindow()
{
InitializeComponent();
// Binding response functions
CommandBindings.Add(new CommandBinding(ExecuteCommand, OnExecuteCommand));
}
private void RibbonWindow_Loaded(object sender, RoutedEventArgs e)
{
}
// Handle click commands
private void OnExecuteCommand(object sender, ExecutedRoutedEventArgs e)
{
}
}
3.2 XAML Binding inside Button The binding event
- Command: Bound command
- CommandParameter: Command parameter
MainWindow.xaml
<Fluent:Button Header=" A straight line " Icon="/Resources/line.png" Size="Large" Command="{x:Static local:MainWindow.ExecuteCommand}"
CommandParameter="line"/>
<Fluent:Button Header=" arc " Icon="/Resources/arc3pts.png" Size="Large" Command="{x:Static local:MainWindow.ExecuteCommand}"
CommandParameter="arc"/>
<Fluent:Button Header=" circular " Icon="/Resources/circle.png" Size="Large" Command="{x:Static local:MainWindow.ExecuteCommand}"
CommandParameter="circle"/>
3.3 Command processing functions
MainWindow.xaml.cscsharp // Handle click commands private void OnExecuteCommand(object sender, ExecutedRoutedEventArgs e) { switch (e.Parameter.ToString()) { case "line": { var shape = SketchBuilder.MakeLine(new GPnt(0, 0, 0), new GPnt(10, 10, 0)); mView3d.ShowShape(shape, ColorTable.AliceBlue); } break; case "arc": { var shape = SketchBuilder.MakeArcOfCircle(new GPnt(0, 0, 0), new GPnt(10, 10, 0), new GPnt(5,15,0)); mView3d.ShowShape(shape, ColorTable.AliceBlue); } break; case "circle": { var shape = SketchBuilder.MakeCircle(new GPnt(0, 0, 0), 5, GP.DZ()); mView3d.ShowShape(shape, ColorTable.AliceBlue); } break; } }
Run it , One by one Button Order it again :
4 Integrated modeling
Love chocolate
An implementation method :
- Generate the plane outline of love from lines
- The contour is filled into a face
- The surface is stretched into a body
- Chamfer the body
{
var arc1 = SketchBuilder.MakeArcOfCircle(new GPnt(0, 2, 0), new GPnt(10, 0, 0), new GPnt(5, 5, 0));
var arc2 = SketchBuilder.MakeArcOfCircle(new GPnt(0, 2, 0), new GPnt(-10, 0, 0), new GPnt(-5, 5, 0));
var bottomPt = new GPnt(0, -12, 0);
var line1 = SketchBuilder.MakeLine(new GPnt(-10, 0, 0), bottomPt);
var line2 = SketchBuilder.MakeLine(bottomPt, new GPnt(10, 0, 0));
var shapeList = new TopoShapeList();
shapeList.Add(arc1);
shapeList.Add(arc2);
shapeList.Add(line1);
shapeList.Add(line2);
var wire = SketchBuilder.MakeWire(shapeList);
var face = SketchBuilder.MakePlanarFace(wire);
var shape = FeatureTool.Extrude(face, 5, GP.DZ());
shape = FeatureTool.Fillet(shape, 1);
mView3d.ShowShape(shape, ColorTable.PaleVioletRed);
}
5 summary
This paper realizes the program interface of Diablo style through simple examples , by Ribbon increase Icon picture , And pass WPF The command routing mechanism of implements the button message processing method . Last , adopt AnyCAD Modeling of API Create complex shapes : Love chocolate . All code in this article :Valentine's Day
Last , I wish all programmers in the world a happy Valentine's day !
var mesh = FontManager.Instance().CreateMesh(" Happy Valentine's Day !");
var material = MeshPhongMaterial.Create("love-material");
material.SetColor(ColorTable.OrangeRed);
var shape = new PrimitiveSceneNode(mesh, material);
mView3d.ShowSceneNode(shape);
.NET6: Based on Development WPF Modern 3D Industrial Software (2) More articles about
- .NET6: Based on Development WPF Modern 3D Industrial Software
MS Office and VisualStudio Has been leading the fashion trend of desktop applications , Large scale industrial software will generally keep up with the trend , Match with Ribbon and DockPanel Style interface . This article will introduce WPF The next two lightweight Ribbon and ...
- encapsulation : A brief introduction of custom development based on WPF Of MVC frame
original text : encapsulation : A brief introduction of custom development based on WPF Of MVC frame One . Purpose : In the use of Asp.net Core when , deeply MVC Frame as the convenience of page Jump data processing , but WPF There seems to be no ready-made MVC frame , From this custom develop a set of MVC ...
- ( turn ) be based on WPF + Modern UI Of company OA Little helper Development summary
Original address :http://www.cnblogs.com/rainlam163/p/3365181.html Preface : From the last blog , It's been a whole month . People can't be lazy , There must be a periodic summary , It's for me ...
- be based on WPF + Modern UI Of company OA Little helper Development summary
Preface : From the last blog , It's been a whole month . People can't be lazy , There must be a periodic summary , It's a reflection on my stage . Only in the process of summing up can people find their shortcomings . The company has to work in every day OA Click Check in on the system , Click sign out after work ...
- 【 be based on WPF+OneNote+Oracle Chinese picture recognition system stage summary 】 Chapter two : be based on OneNote Difficulty breakthrough and batch identification
Article 1 :WPF Common knowledge and summary of the project design :http://www.cnblogs.com/baiboy/p/wpf.html Article 2 : be based on OneNote Difficulty breakthrough and batch identification :http://www.cnblog ...
- Rapid development is based on HTML5 Network topology application
use HT Developing a network topology is very easy , for example < Introduction Manual > The first small example of sparrow is that although it is small, it has all five internal organs :http://www.hightopo.com/guide/guide/core/beginners/e ...
- VSTO Learning notes ( 7、 ... and ) be based on WPF Of Excel analysis 、 Conversion applet
original text :VSTO Learning notes ( 7、 ... and ) be based on WPF Of Excel analysis . Conversion applet Recently, due to the need of work , Batch processing Excel file , So I wrote a little program , To improve work efficiency . The function of the applet is to Excel Do some analysis . verification , however ...
- For introduction C# and VS2015 Based on Development Unity Architecturally 2D、3D Game technology
[Unity]13.3 Realtime GI Example Abstract : classification :Unity.C#.VS2015 Date of creation :2016-04-19 One . brief introduction The advantage of using simple examples instead of actual ones is that it allows you to quickly understand lightmaps ...
- be based on WPF Cool GUI The whole process of window implementation
title: be based on WPF Cool GUI The whole process of window implementation date: 2020-08-14 permalink: /build/wpfgui sidebarDepth: 2 tags: wpf gui soft ...
- [Intel Edison Development board ] 05、Edison Based on Development MRAA Realization IO control , especially UART signal communication
One . Preface Here are the first few articles in this series : [Intel Edison Development board ] 01.Edison Brief introduction of development board performance [Intel Edison Development board ] 02.Edison Introduction to development board [Intel Edison ...
Random recommendation
- Redis Order collection 4 —— Collection types ( The order added )
Add the command of the last article collection . Part 1 address Blog garden snail http://www.cnblogs.com/tdws/p/5785939.html SCARD Key Get the number of elements in the execution set . SDIFFSTOR ...
- install cx_Oracle on Linux
step 1 : install oracle client library url: http://www.oracle.com/technetwork/topics/linuxsoft-08280 ...
- ubuntu install kvm technological process
1. see CPU Virtualization support for ~ egrep 'svm|vmx' /proc/cpuinfo # Check whether there is content output 2. Update source ~ sudo apt-get update install KVM And virt Management software ~ ...
- Robot Framework automated testing ( One )--- The first script ( turn )
Recently used in tools Robot Framework Framework to do automation , therefore , Took time to learn . ======= The environment required =================== Python: https://www.python. ...
- JDBC review 1
1. What is? JDBC JDBC yes java Short for database connection technology (Java DataBase Connectivity) jdbc It's the interface ,jdbc The driver is the implementation of the interface , Responsible for connecting various databases .jdbc Of AP ...
- PAT 1019 General Palindromic Number
1019 General Palindromic Number (20 branch ) A number that will be the same when it is written forwards ...
- C++ Study ( seventeen )(C The language part ) And The pointer
review Array definition format type Array name [ Array size ] Array name + Subscript int arr[2][3]={{1,2,3},{4,5,6}}; int arr[][3]={1,2,3,4,5,6};// When defining a two-dimensional array ...
- Advertising click through rate forecast (CTR) —— Online learning algorithm FTRL Application
FTRL from google Proposed by the Engineer , stay 13 Of paper Pseudo code and implementation details are given in ,paper Address :http://www.eecs.tufts.edu/~dsculley/papers/ad-click-p ...
- The Uncle_b's First Love
Description ACM After the founding meeting ,uncle_b Deeply attracted by one of the freshmen , But shy B Uncle doesn't know how to express his inner thoughts , the calmound God's guidance ,B Uncle decided to write a love letter to each other . He from Tamar ...
- 17 Nanning Regional Competition F - The Chosen One 【 law 】
Topic link https://nanti.jisuanke.com/t/19972 The question Give a n And then n Number Label for 1 -> n In order Every time I take it out The number of odd digits And then find the last remaining number ...