大家好,又见面了,我是全栈君。
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Media;
namespace PhotovolaticRadar.Client.Tools
{
public class RadarTickBar: TickBar
{
protected override void OnRender(DrawingContext dc)
{
Double tickFrequencySize;
Brush foreBrush = this.Fill;
Pen line_Pen = new Pen(foreBrush, 1);
FormattedText font = null;
Size size = new Size(base.ActualWidth, base.ActualHeight);
int tickCount = (int)((this.Maximum - this.Minimum) / this.TickFrequency) + 1;
if ((this.Maximum - this.Minimum) % this.TickFrequency == 0)
tickCount -= 1;
tickFrequencySize = (size.Width * this.TickFrequency / (this.Maximum - this.Minimum));
string text = "";
double num = this.Maximum - this.Minimum;
int i = 0;
for (i = 0; i <= tickCount; i++)
{
if (i % 5 == 0)
{
text = Convert.ToString(Convert.ToInt32(this.Minimum + this.TickFrequency * i), 10);
font = new FormattedText(text, CultureInfo.GetCultureInfo("en-us"), FlowDirection.LeftToRight, new Typeface("Verdana"), 14, foreBrush);
dc.DrawText(font, new Point((tickFrequencySize * i), 20));
dc.DrawLine(line_Pen, new Point((tickFrequencySize * i), 44), new Point((tickFrequencySize * i), 64));
}
else
{
dc.DrawLine(line_Pen, new Point((tickFrequencySize * i), 54), new Point((tickFrequencySize * i), 64));
}
}
}
}
}
转载于:https://www.cnblogs.com/wrl-wuqingxue/p/7613792.html
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/108131.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...