WinFormsPopupAlerts/CornerRadiusEditor.cs

(完整代码) 1KB

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing.Design;
using System.ComponentModel;
using System.Windows.Forms.Design;

namespace WinFormsPopupAlerts
{
    /// <summary>
    /// Provide a user interface for representing and editing the value of objects of CornerRadius class.
    /// </summary>
    internal class CornerRadiusEditor : UITypeEditor
    {

        public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
        {
            return UITypeEditorEditStyle.DropDown;
        }

        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            CornerRadius cr = (CornerRadius)value;
            IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (edSvc != null)
            {
                CornerRadiusEditorControl control = new CornerRadiusEditorControl(cr);
                edSvc.DropDownControl(control);
            }
            return new CornerRadius(cr.TopLeft, cr.TopRight, cr.BottomLeft, cr.BottomRight);
        }
    }
}

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

AI 解读 AI

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

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