资源简介
metro 风格 ribbon Control,并提供简单的设计时支持
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
namespace cy.Drawing
{
public static class GraphicsEx
{
public static void DrawLine(this Graphics gPointF pt1PointF pt2ButtonBorderstyle style)
{
switch(style)
{
case ButtonBorderstyle.Inset:
Pen pInset = new Pen(Color.FromArgb(235 235 235) 3);
pInset.StartCap = System.Drawing.Drawing2D.LineCap.Round;
pInset.EndCap = System.Drawing.Drawing2D.LineCap.Round;
g.DrawLine(pInset pt1 pt2);
g.DrawLine(Pens.Gray pt1 pt2);
break;
case ButtonBorderstyle.Outset:
Pen pOutset = new Pen(Color.Gray 3);
pOutset.StartCap = System.Drawing.Drawing2D.LineCap.Round;
pOutset.EndCap = System.Drawing.Drawing2D.LineCap.Round;
g.DrawLine(pOutset pt1 pt2);
g.DrawLine(Pens.White pt1 pt2);
break;
default:
return;
}
}
///
/// 绘制图片,自动缩放
///
///
///
///
public static void DrawImageAutoFit(this Graphics g Image image RectangleF fitRect ContentAlignment alignment = ContentAlignment.MiddleCenter)
{
if (image != null && fitRect.Width > 0 && fitRect.Height > 0)
{
RectangleF drawRect = RectangleF.Empty;
float lWidth = fitRect.Width / image.Width;
float lHeight = fitRect.Height / image.Height;
float ratio = lWidth > lHeight ? lHeight : lWidth;
drawRect.Width = image.Width * ratio;
drawRect.Height = image.Height * ratio;
float x = fitRect.X;
float y = fitRect.Y;
float xShift = fitRect.Width - drawRect.Width;
float yShift = fitRect.Height - drawRect.Height;
switch (alignment)
{
case ContentAlignment.TopLeft:
break;
case ContentAlignment.TopCenter:
x += xShift / 2;
break;
case ContentAlignment.TopRight:
x += xShift;
break;
case ContentAlignment.MiddleLeft:
y += yShift / 2;
break;
case ContentAlignment.MiddleCenter:
x += xShift / 2;
y += yShift / 2;
break;
cas
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3480 2014-09-29 16:40 RibbonForm\cy.Drawing\cy.Drawing.csproj
文件 3783 2014-09-29 16:40 RibbonForm\cy.Drawing\GraphicsEx.cs
文件 1356 2014-08-15 15:48 RibbonForm\cy.Drawing\Properties\AssemblyInfo.cs
文件 2859 2014-09-29 16:40 RibbonForm\cy.Drawing\Properties\Resources.Designer.cs
文件 5612 2014-08-15 15:48 RibbonForm\cy.Drawing\Properties\Resources.resx
文件 1109 2014-09-29 16:40 RibbonForm\cy.Drawing\Properties\Settings.Designer.cs
文件 249 2014-08-15 15:48 RibbonForm\cy.Drawing\Properties\Settings.settings
文件 6368 2014-09-29 17:02 RibbonForm\cy.Windows.Forms\cy.Windows.Forms.csproj
文件 707 2014-09-29 16:40 RibbonForm\cy.Windows.Forms\Design\RibbonButtonDesigner.cs
文件 4695 2014-09-29 16:40 RibbonForm\cy.Windows.Forms\Design\RibbonCaptionBarDesigner.cs
文件 3034 2014-09-29 16:40 RibbonForm\cy.Windows.Forms\Design\RibbonTabGroupItemDesigner.cs
文件 421 2014-09-29 16:40 RibbonForm\cy.Windows.Forms\IRibbonItem.cs
文件 9210 2014-09-29 16:40 RibbonForm\cy.Windows.Forms\MetroForm.cs
文件 1616 2014-09-29 16:40 RibbonForm\cy.Windows.Forms\MetroForm.Designer.cs
文件 5817 2014-09-29 15:51 RibbonForm\cy.Windows.Forms\MetroForm.resx
文件 1005 2014-09-29 16:40 RibbonForm\cy.Windows.Forms\NotifyCollectionba
文件 1364 2014-08-15 13:53 RibbonForm\cy.Windows.Forms\Properties\AssemblyInfo.cs
文件 6328 2014-09-29 16:40 RibbonForm\cy.Windows.Forms\Properties\Resources.Designer.cs
文件 9297 2014-09-29 16:06 RibbonForm\cy.Windows.Forms\Properties\Resources.resx
文件 1115 2014-09-29 16:40 RibbonForm\cy.Windows.Forms\Properties\Settings.Designer.cs
文件 249 2014-08-15 13:53 RibbonForm\cy.Windows.Forms\Properties\Settings.settings
文件 251 2014-09-19 14:34 RibbonForm\cy.Windows.Forms\Resources\ico_sys_close.png
文件 243 2014-09-19 14:34 RibbonForm\cy.Windows.Forms\Resources\ico_sys_close_p.png
文件 160 2014-09-19 14:34 RibbonForm\cy.Windows.Forms\Resources\ico_sys_max.png
文件 162 2014-09-19 14:34 RibbonForm\cy.Windows.Forms\Resources\ico_sys_max_p.png
文件 138 2014-09-19 14:34 RibbonForm\cy.Windows.Forms\Resources\ico_sys_mini.png
文件 138 2014-09-19 14:34 RibbonForm\cy.Windows.Forms\Resources\ico_sys_mini_p.png
文件 262 2014-09-19 14:34 RibbonForm\cy.Windows.Forms\Resources\ico_sys_popdown.png
文件 263 2014-09-19 14:34 RibbonForm\cy.Windows.Forms\Resources\ico_sys_popdown_p.png
文件 245 2014-09-19 14:34 RibbonForm\cy.Windows.Forms\Resources\ico_sys_pupup.png
............此处省略40个文件信息
- 上一篇:《计算机网络教程》第五版++谢希仁编+
- 下一篇:七个完整rbf算法源程序
评论
共有 条评论