Source/Design/WarningBoxDesigner.cs

(开头部分) 5KB

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

#if FRAMEWORK20
using System;
using System.Text;
using System.Windows.Forms.Design;
using DevComponents.DotNetBar.Controls;
using System.ComponentModel;
using System.Drawing;
using System.ComponentModel.Design;

namespace DevComponents.DotNetBar.Design
{
    /// <summary>
    /// Represents the designer for WarningBox control.
    /// </summary>
    public class WarningBoxDesigner : ControlDesigner
    {
        #region Internal Implementation
        public override void InitializeNewComponent(System.Collections.IDictionary defaultValues)
        {
            base.InitializeNewComponent(defaultValues);
            SetDefaults();
        }

        private void SetDefaults()
        {
            WarningBox box = this.Control as WarningBox;
            if (box == null) return;

            TypeDescriptor.GetProperties(box)["Text"].SetValue(box, "<b>Warning Box</b> control with <i>text-markup</i> support.");
            Image image = GetDefaultImage();
            if (image != null)
                TypeDescriptor.GetProperties(box)["Image"].SetValue(box, image);
        }

        private Image GetDefaultImage()
        {
            string imageName = "images\\Warning.png";
            try
            {
                Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.LocalMachine;
                string path = "";
                try
                {
                    if (key != null)
                        key = key.OpenSubKey("Software\\DevComponents\\DotNetBar");
                    if (key != null)
                        path = key.GetValue("InstallationFolder", "").ToString();
                }
                finally { if (key != null) key.Close(); }

                if (path != "")
                {
                    if (path.Substring(path.Length - 1, 1) != "\\")
                        path += "\\";

                    if (System.IO.File.Exists(path + imageName))
                        path += imageName;
                    else
                        path = "";
                }
后面还有 108 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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