Source/AdvTree/Drawing/RectangleShape.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Text;
using System.Drawing;
using System.ComponentModel;
using DevComponents.AdvTree;
using System.Drawing.Drawing2D;
using DevComponents.DotNetBar;
namespace DevComponents.WinForms.Drawing
{
internal class RectangleShape : Shape
{
#region Internal Implementation
/// <summary>
/// Renders rectangle on canvas.
/// </summary>
/// <param name="g">Target graphics to render shape on.</param>
/// <param name="bounds">Shape bounds.</param>
public override void Paint(Graphics g, Rectangle bounds)
{
if (bounds.Width < 2 || bounds.Height < 2 || g == null || _Fill == null && _Border == null) return;
GraphicsPath path = null;
if (!_CornerRadius.IsZero)
{
path = DisplayHelp.GetRoundedRectanglePath(bounds, _CornerRadius.TopLeft, _CornerRadius.TopRight,
_CornerRadius.BottomRight, _CornerRadius.BottomLeft);
}
if (_Fill != null)
{
Brush brush = _Fill.CreateBrush(bounds);
if (brush != null)
{
if (path == null)
g.FillRectangle(brush, bounds);
else
g.FillPath(brush, path);
brush.Dispose();
}
}
if (_Border != null)
{
Pen pen = _Border.CreatePen();
if (pen != null)
{
if (path == null)
g.DrawRectangle(pen, bounds);
else
g.DrawPath(pen, path);
pen.Dispose();
}
}
Shape content = this.Content;
if (content != null)
后面还有 65 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。