Source/Design/SuperTooltipInfoConverter.cs

(开头部分) 3KB

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

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

namespace DevComponents.DotNetBar
{
    /// <summary>
    /// Represents SuperTooltipInfoConverter converter.
    /// </summary>
    public class SuperTooltipInfoConverter : TypeConverter
    {
        /// <summary>
        /// Creates new instance of the class.
        /// </summary>
        public SuperTooltipInfoConverter() { }

        /// <summary>
        /// Checks whether conversion can be made to specified type.
        /// </summary>
        /// <param name="context">Context Information.</param>
        /// <param name="destinationType">Destination type.</param>
        /// <returns></returns>
        public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
        {
            if (destinationType == typeof(InstanceDescriptor))
                return true;
            return base.CanConvertTo(context, destinationType);
        }

        /// <summary>
        /// Converts object to specified type.
        /// </summary>
        /// <param name="context">Context information.</param>
        /// <param name="culture">Culture information.</param>
        /// <param name="value">Object to convert.</param>
        /// <param name="destinationType">Destination type.</param>
        /// <returns>Object converted to destination type.</returns>
        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 SuperTooltipInfo))
            {
                SuperTooltipInfo info = (SuperTooltipInfo)value;
                Type[] constructorParams = null;
                MemberInfo constructorMemberInfo = null;
                object[] constructorValues = null;

                if (info.HeaderVisible && info.FooterVisible && info.CustomSize.IsEmpty)
                {
                    constructorParams = new Type[] { typeof(string), typeof(string), typeof(string), typeof(Image), typeof(Image), typeof(eTooltipColor) };
                    constructorMemberInfo = typeof(SuperTooltipInfo).GetConstructor(constructorParams);
                    constructorValues = new object[] { info.HeaderText, info.FooterText, info.BodyText, info.BodyImage, info.FooterImage, info.Color};
                }
                else
                {
后面还有 17 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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