当前注册人数423093人 邮箱: 密码: 注册新用户 忘记密码
首页 C/C++/MFC C# ASP.NET VB.NET MATLAB Android   站内搜索 下载代码说明/积分规则
为什么要注册?

1. 可以直接免费从本站下载代码,防止邮件发送不到您的邮箱,或登录不了国外网站

2. 可以设定关键字,当有您关心的代码收录时,邮件通知您

3. 对这里的代码进行评分和评论

4. 可以和大家一起分享你的源代码,得到更多的建议

WPF PartiallyRoundedRectangle: Choose which corners you want rounded

WPF部分圆角绘制源代码

2007年12月13日
C#, Windows, .NET, VS, XAML, WPF, Dev, Design
本文的程序允许你在使用WPF时,只绘制单个圆角或者几个圆角,你可以把它用于Tab或者窗口的边框设计上。
相关知识

关键代码:

protected override Geometry DefiningGeometry {
        get {
            Geometry result = new RectangleGeometry(new Rect(0, 0, base.Width, base.Height), RadiusX, RadiusY);
            double halfWidth = base.Width / 2;
            double halfHeight = base.Height / 2;

            if (!RoundTopLeft)
                result = new CombinedGeometry(GeometryCombineMode.Union, result, new RectangleGeometry(new Rect(0, 0, halfWidth, halfHeight)));
            if (!RoundTopRight)
                result = new CombinedGeometry(GeometryCombineMode.Union, result, new RectangleGeometry(new Rect(halfWidth, 0, halfWidth, halfHeight)));
            if (!RoundBottomLeft)
                result = new CombinedGeometry(GeometryCombineMode.Union, result, new RectangleGeometry(new Rect(0, halfHeight, halfWidth, halfHeight)));
            if (!RoundBottomRight)
                result = new CombinedGeometry(GeometryCombineMode.Union, result, new RectangleGeometry(new Rect(halfWidth, halfHeight, halfWidth, halfHeight)));

            return result;
        }
    }
源代码原文下载:
WPF PartiallyRoundedRectangle: Choose which corners you want rounded I'm new to WPF so this is my first attempt at a reusable solution to a problem I had: although WPF is ridiculously powerful and customizable, for some reason Microsoft didn't build-in any logic to allow a rounded rectangle to be only rounded on certain corners, like you might use for a tab at the top or side of a window for example.

源码图片

点击链接查看大图
从本站下载附件及源代码(1个附件,已经成功下载352次)

最值得关注的外文源代码

Generic TCP/IP Client/Server
DrawMe - A network ink-chat application exploring .NET 3.5, WPF and WCF
WCF / WPF Chat Application
Not OLE .Net/WPF container of MFC applications
评论(评论是增加积分的一个有效途径)
字数在300字内
请如实评论
本源代码共评论42次,此处显示最近20次评论! 查看所有评论

vnena13  2015年06月01日
谢谢分享
么有蜡笔的小新  2014年04月15日
学习了
若柳芊妍  2014年04月15日
谢谢
sky123  2012年11月29日
很好的啊!
ximen  2012年10月22日
接到赞一个
pain  2012年08月28日
赞一个!
pain  2012年08月28日
很好。。。
秋叶  2012年08月13日
非常棒。。。
gu_xiaoliang  2012年07月11日
谢谢
suiyidodo  2012年02月20日
谢谢
lapertme  2011年11月15日
学习
被窝控  2011年10月23日
谢谢分享
hcxlc  2011年07月28日
就想要这样学学`````
xyh4320121  2010年10月05日
相当实用
weiping81  2009年12月23日
不错
weiping81  2009年12月23日
不错
ocean  2009年12月18日
相当实用。
jine1987  2009年11月13日
不错
sunnyj  2009年04月01日
Good.
.netfree  2008年12月26日
不错
字数在300字内
请如实评论
200万国内源码搜索
CopyRight (C) codesoso.com 2007-2009 All Rights Reserved zhihuishi   免责声明