Source/EllipticalShapeDescriptor.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Text;
using System.ComponentModel;
using System.Globalization;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.ComponentModel.Design.Serialization;
using System.Reflection;

namespace DevComponents.DotNetBar
{
    /// <summary>
    /// Describes the Elliptical Shape.
    /// </summary>
    [System.ComponentModel.ToolboxItem(false), System.ComponentModel.DesignTimeVisible(false), TypeConverter(typeof(EllipticalShapeDescriptorConverter))]
    public class EllipticalShapeDescriptor : ShapeDescriptor
    {
        public override System.Drawing.Drawing2D.GraphicsPath GetShape(Rectangle bounds)
        {
            GraphicsPath path = new GraphicsPath();
            path.AddEllipse(bounds);
            return path;
        }

        public override System.Drawing.Drawing2D.GraphicsPath GetInnerShape(Rectangle bounds, int borderSize)
        {
            return GetShape(bounds);
        }

        public override bool CanDrawShape(Rectangle bounds)
        {
            return bounds.Width > 2 && bounds.Height > 2;
        }
    }

    /// <summary>
    /// Represents EllipticalShapeDescriptor object converter.
    /// </summary>
    public class EllipticalShapeDescriptorConverter : TypeConverter
    {
        public EllipticalShapeDescriptorConverter() { }

        public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
        {
            if (destinationType == typeof(InstanceDescriptor))
                return true;
            return base.CanConvertTo(context, destinationType);
        }

        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            if (destinationType == null)
                throw new ArgumentNullException("destinationType");

            if ((destinationType == typeof(InstanceDescriptor)) && (value is EllipticalShapeDescriptor))
            {
                EllipticalShapeDescriptor doc = (EllipticalShapeDescriptor)value;
                Type[] constructorParams = null;
                MemberInfo constructorMemberInfo = null;
                object[] constructorValues = null;
后面还有 16 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。