Source/Design/TextMarkupUIEditor.cs

(开头部分) 2KB

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

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

namespace DevComponents.DotNetBar.Design
{
    public class TextMarkupUIEditor : System.Drawing.Design.UITypeEditor
    {
        #region Private Variables
        private IWindowsFormsEditorService m_EditorService = null;
        #endregion

        #region Internal Implementation
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (context != null
                && context.Instance != null
                && provider != null)
            {
                m_EditorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;

                if (m_EditorService != null)
                {
                    TextMarkupEditor editor = new TextMarkupEditor();
                    editor.buttonOK.Click += new EventHandler(MarkupEditorButtonClick);
                    editor.buttonCancel.Click += new EventHandler(MarkupEditorButtonClick);
                    
                    if(value!=null)
                        editor.inputText.Text = value.ToString();

                    m_EditorService.DropDownControl(editor);

                    if (editor.DialogResult == DialogResult.OK)
                    {
                        string text = editor.inputText.Text;
                        editor.Dispose();
                        return text;
                    }
                    editor.Dispose();
                }
            }

            return value;
        }

        void MarkupEditorButtonClick(object sender, EventArgs e)
        {
            if (m_EditorService != null)
                m_EditorService.CloseDropDown();
        }

        /// <summary>
        /// Gets the editor style used by the EditValue method.
        /// </summary>
        /// <param name="context">An ITypeDescriptorContext that can be used to gain additional context information.</param>
后面还有 12 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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