Source/Design/SuperTooltipInfoEditor.cs

(开头部分) 6KB

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

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

namespace DevComponents.DotNetBar.Design
{
    public class SuperTooltipInfoEditor : UITypeEditor 
    {

        /// <summary>
        /// Edits the value of the specified object using the editor style indicated by GetEditStyle.
        /// </summary>
        /// <param name="context">An ITypeDescriptorContext that can be used to gain additional context information.</param>
        /// <param name="provider">An IServiceProvider that this editor can use to obtain services.</param>
        /// <param name="value">The object to edit.</param>
        /// <returns>The new value of the object.</returns>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (context != null && context.Instance != null && provider != null)
            {
                IWindowsFormsEditorService m_EditorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;

                SuperTooltipInfo info = value as SuperTooltipInfo;

                SuperTooltip superTooltipInstance = null;
                if (context.PropertyDescriptor != null)
                {
                    string name = context.PropertyDescriptor.DisplayName;
                    IDesignerHost dh = provider.GetService(typeof(IDesignerHost)) as IDesignerHost;
                    if (dh != null && dh.Container!=null)
                    {
                        foreach (IComponent comp in dh.Container.Components)
                        {
                            SuperTooltip st = comp as SuperTooltip;
                            if (st != null && st.Site != null)
                            {
                                if (name.EndsWith(st.Site.Name))
                                {
                                    superTooltipInstance = st;
                                    break;
                                }
                            }
                        }
                    }
                }

                if (info == null)
                {
                    info = new SuperTooltipInfo();
                    if (!(context.Instance is SuperTooltip))
                    {
                        if (superTooltipInstance != null && superTooltipInstance.DefaultTooltipSettings!=null)
                        {
                            info.BodyImage = superTooltipInstance.DefaultTooltipSettings.BodyImage;
                            info.BodyText = superTooltipInstance.DefaultTooltipSettings.BodyText;
后面还有 65 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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