营销网站的优势是什么,网站开发及推广是怎么回事,网上开的公司网站打不开,一个人在线观看免费社区弄一个大屏显示的界面例子#xff0c;但是代码有点多#xff0c;还有用户控件。
目前还有一点问题在解决#xff0c;先看一下界面效果。
圆形控件
前端代码
UserControl xmlnshttps://github.com/avaloniauixmlns:xhttp://schemas.microsoft.com/…弄一个大屏显示的界面例子但是代码有点多还有用户控件。
目前还有一点问题在解决先看一下界面效果。
圆形控件
前端代码
UserControl xmlnshttps://github.com/avaloniauixmlns:xhttp://schemas.microsoft.com/winfx/2006/xamlxmlns:dhttp://schemas.microsoft.com/expression/blend/2008xmlns:mchttp://schemas.openxmlformats.org/markup-compatibility/2006mc:Ignorabled d:DesignWidth800 d:DesignHeight450x:ClassProAvalonia.Controls.CircularProgressBarGrid Namelayout Ellipse StrokeThickness8 NamebackEllipse/Path DataM75.001 5 A70 70 0 1 1 75 5 StrokeThickness6 Stroke#CC2BB6FENamepath/Viewbox Margin14TextBlock VerticalAlignmentCenter HorizontalAlignmentCenter//ViewboxGrid VerticalAlignmentTop Margin0,-3,0,0Grid.ColumnDefinitionsColumnDefinition/ColumnDefinition//Grid.ColumnDefinitionsCanvasTextBlock HorizontalAlignmentRight FontSize9 Foreground#55FFFFFFCanvas.Right8//Canvas/Grid/Grid
/UserControl后台代码
using Avalonia.Controls;
using System.ComponentModel;
using System;
using Avalonia;
using System.Drawing;
using Avalonia.Media;
using Brush System.Drawing.Brush;
using Color System.Drawing.Color;namespace ProAvalonia.Controls
{public partial class CircularProgressBar : UserControl{public static readonly StyledPropertydouble ValueProperty AvaloniaProperty.RegisterCircularProgressBar,double(nameof(Value),0);public double Value{get { return (double)GetValue(ValueProperty); }set { SetValue(ValueProperty, value); }}//private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)//{// (d as CircularProgressBar).UpdateValue();//}public static readonly StyledPropertySolidColorBrush BackColorProperty AvaloniaProperty.RegisterCircularProgressBar, SolidColorBrush(nameof(BackColor));public SolidColorBrush BackColor{get { return (SolidColorBrush)GetValue(BackColorProperty); }set { SetValue(ValueProperty, value); }}public string Title{get { return (string)GetValue(TitleProperty); }set { SetValue(TitleProperty, value); }}public static readonly StyledPropertystring TitleProperty AvaloniaProperty.RegisterCircularProgressBar, string(nameof(Title));public CircularProgressBar(){InitializeComponent();this.SizeChanged CircularProgressBar_SizeChanged;}private void CircularProgressBar_SizeChanged(object sender, SizeChangedEventArgs e){UpdateValue();}private void UpdateValue(){this.layout.Width Math.Min(this.Width, this.Height);double radius this.layout.Width / 2;if (radius 0 || Value 0) return;double newX 0.0, newY 0.0;newX radius (radius - 3) * Math.Cos((Value % 100 * 100 * 3.6 - 90) * Math.PI / 180);newY radius (radius - 3) * Math.Sin((Value % 100 * 100 * 3.6 - 90) * Math.PI / 180);string pathStr $M{radius 0.01} 3 $A{radius - 3} {radius - 3} 0 {(this.Value 0.5 ? 0 : 1)} 1 {newX} {newY};var converter TypeDescriptor.GetConverter(typeof(Geometry));this.path.Data (Geometry)converter.ConvertFrom(pathStr);}}
}另外还有GroupBox库和主界面很多代码就不贴代码了完善的效果展示一下。 下一篇给大家展示一个物联的演示界面请期待。