Source/Design/GalleryContainerDesigner.cs

(开头部分) 4KB

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

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

namespace DevComponents.DotNetBar.Design
{
    /// <summary>
    /// Reprensents Windows Forms Designer for GalleryContainer object.
    /// </summary>
    public class GalleryContainerDesigner : ItemContainerDesigner
    {
        public override void Initialize(IComponent component)
        {
            base.Initialize(component);

            if (component is GalleryContainer)
                ((GalleryContainer)component).PopupGalleryItem.SetDesignMode(true);
        }

        protected override void SetDesignTimeDefaults()
        {
            GalleryContainer gc = this.Component as GalleryContainer;
            gc.StretchGallery = true;
            gc.BackgroundStyle.Class = Rendering.ElementStyleClassKeys.RibbonGalleryContainerKey;
            base.SetDesignTimeDefaults();
        }

        protected override void AddNewItem(BaseItem newItem)
        {
            GalleryContainer gc = this.Component as GalleryContainer;
            if (gc != null && !gc.DesignTimeMouseDownPoint.IsEmpty)
            {
                if (gc.PopupGalleryButtonBounds.Contains(gc.DesignTimeMouseDownPoint))
                {
                    gc.DesignTimeMouseDownPoint = Point.Empty;
                    // Add new item to the PopupGalleryItems collection instead of to SubItems...
                    System.ComponentModel.Design.IComponentChangeService change = this.GetService(typeof(System.ComponentModel.Design.IComponentChangeService)) as IComponentChangeService;
                    if (change != null)
                        change.OnComponentChanging(this.Component, TypeDescriptor.GetProperties(this.Component).Find("PopupGalleryItems", true));

                    gc.PopupGalleryItems.Add(newItem);

                    if (change != null)
                        change.OnComponentChanged(this.Component, TypeDescriptor.GetProperties(this.Component).Find("PopupGalleryItems", true), null, null);
                    return;
                }
            }

            base.AddNewItem(newItem);
        }

        protected override void NewItemAdded(BaseItem itemAdded)
        {
            base.NewItemAdded(itemAdded);
            GalleryContainer gc = this.Component as GalleryContainer;
            if (gc != null && gc.SubItems.Contains(itemAdded) && !(gc.Parent is ButtonItem))
后面还有 51 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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