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

推荐订阅源

腾讯CDC
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
P
Proofpoint News Feed
D
DataBreaches.Net
D
Docker
云风的 BLOG
云风的 BLOG
大猫的无限游戏
大猫的无限游戏
月光博客
月光博客
J
Java Code Geeks
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
罗磊的独立博客
Martin Fowler
Martin Fowler
U
Unit 42
Engineering at Meta
Engineering at Meta
IT之家
IT之家
Vercel News
Vercel News
B
Blog RSS Feed
人人都是产品经理
人人都是产品经理
博客园 - Franky
博客园 - 【当耐特】
Stack Overflow Blog
Stack Overflow Blog
G
Google Developers Blog
MongoDB | Blog
MongoDB | Blog

博客园 - 颜昌钢

怎样做好一个项目经理? 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;
        }
    }