惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
博客园 - 聂微东
人人都是产品经理
人人都是产品经理
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园_首页
量子位
阮一峰的网络日志
阮一峰的网络日志
酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hackread – Cybersecurity News, Data Breaches, AI and More
云风的 BLOG
云风的 BLOG
D
DataBreaches.Net
B
Blog
L
LangChain Blog
Apple Machine Learning Research
Apple Machine Learning Research
Vercel News
Vercel News
博客园 - 三生石上(FineUI控件)
爱范儿
爱范儿
Microsoft Azure Blog
Microsoft Azure Blog
IT之家
IT之家
aimingoo的专栏
aimingoo的专栏
B
Blog RSS Feed
H
Help Net Security
The Cloudflare Blog
U
Unit 42

博客园 - 颜昌钢

怎样做好一个项目经理? ICollection 与 IList 区别 oracle 数据库跨库查询方法 SetTimeOut 与 SetInterval 区别 - 颜昌钢 内存释放 机制 remoting 学习整理 wpf windows 放大缩小 疑问?? - 颜昌钢 GC 资源 回收 方法参数 Ref 与 引用类型 DataTrigger 以及 EnterActions 和ExitActions 学习笔记 - 颜昌钢 WPF xaml文件中使用大括号{} - 颜昌钢 - 博客园 WPF下的地图解决方案 关于WPF的Binding 的 ConverterParameter 参数的动态设置 关于 项目 投标相关文档 服务器计时器、Windows 计时器和线程计时器 wpf小控件 集合 仪表盘等 wpf button 事件的触发顺序 - 颜昌钢 c# 插件 体系 一个类似于 splittercontainer 控件的控件
WPF中代码画箭头
颜昌钢 · 2010-03-01 · via 博客园 - 颜昌钢

本文没什么内容,主要是一些代码的集合;

1:WPF中后台代码画一条类似于箭头线的线条;

箭头线

// Fields
    private double mArrowAngle = 0.17453292519943295;
    
private double mArrowLengh = 30.0;// Methods
    public override Geometry Create(double x1, double y1, double x2, double y2)
    {
        Point point 
= new Point(x1, y1);
        Point point2 
= new Point(x2, y2);
        
double num = Math.Atan((y2 - y1) / (x2 - x1));
        
double d = num - this.ArrowAngle;
        
double num3 = num + this.ArrowAngle;
        
int num4 = (x2 > x1) ? -1 : 1;
        
double x = x2 + ((num4 * this.ArrowLengh) * Math.Cos(d));
        
double y = y2 + ((num4 * this.ArrowLengh) * Math.Sin(d));
        
double num7 = x2 + ((num4 * this.ArrowLengh) * Math.Cos(num3));
        
double num8 = y2 + ((num4 * this.ArrowLengh) * Math.Sin(num3));
        Point point3 
= new Point(x, y);
        Point point4 
= new Point(num7, num8);
        PathGeometry geometry 
= new PathGeometry();
        PathFigure figure 
= new PathFigure();
        figure.IsFilled 
= true;
        figure.StartPoint 
= point2;
        Point[] points 
= new Point[] { point, point2, point3, point4, point2 };//从point2到point 然后在倒回来到point2,然后画箭头。及从point2到point3到point4到point2.....
        PolyLineSegment segment 
= new PolyLineSegment(points, true);
        figure.Segments.Add(segment);
        geometry.Figures.Add(figure);
        geometry.Freeze();
        
return geometry;
    }
// Properties
    public double ArrowAngle
    {
        
get
        {
            
return this.mArrowAngle;
        }
        
set
        {
            
this.mArrowAngle = value;
        }
    }
public double ArrowLengh
    {
        
get
        {
            
return this.mArrowLengh;
        }
        
set
        {
            
this.mArrowLengh = value;
        }
    }