duheng
2024-05-24 09738deea66327d1fe13237a7f4bc0bcc253d80e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Reflection;
using DevExpress.Utils;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;
using DevExpress.XtraEditors.Popup;
using DevExpress.XtraTab;
using DevExpress.XtraBars;
 
namespace Hydro.WinfrmUI.Viewer {
    public class PopupColor : XtraUserControl, IPopupColorPickEdit {
        public PopupColor(PopupControlContainer container, frmMain parent) {
            this._container = container;
            builder = CreatePopupColorEditBuilder();
            container.Controls.Add(builder.TabControl);
            Size _size = builder.CalcContentSize();
            this._container.Size = new Size(_size.Width + 3, _size.Height);
            this.main = parent;
        }
        PopupControlContainer _container;
        frmMain main;    
 
        protected PopupColorBuilderEx CreatePopupColorEditBuilder() {
            return new DemoPopupColorBuilderEx(this);
        }
        void IPopupColorEdit.ClosePopup() {
            _container.HidePopup();
        }
        Color IPopupColorEdit.Color {
            get { return (Color)PopupColorBuilder.ResultValue; }
        }
        ColorListBox IPopupColorEdit.CreateColorListBox() {
            return new ColorListBox();
        }
        object IPopupColorEdit.EditValue {
            get { return null; }
        }
        bool IPopupColorEdit.IsPopupOpen {
            get { return true; }
        }
        DevExpress.LookAndFeel.UserLookAndFeel IPopupColorEdit.LookAndFeel {
            get { return LookAndFeel; }
        }
        void IPopupColorEdit.OnColorChanged() {
        
        }
        DevExpress.XtraEditors.Repository.RepositoryItemColorEdit IPopupColorEdit.Properties {
            get { return new DevExpress.XtraEditors.Repository.RepositoryItemColorPickEdit(); }
        }
        PopupColorBuilderEx builder;
        public PopupColorBuilder PopupColorBuilder { get { return builder as PopupColorBuilder; } }
 
        ColorEditTabControlBase IPopupColorEdit.CreateTabControl() {
            return new PopupColorPickEditForm.ColorPickEditTabControl(this) as ColorEditTabControlBase;
        }
        IWin32Window IPopupColorPickEdit.OwnerWindow {
            get { return null; }
        }
        void IPopupColorPickEdit.ClosePopup(PopupCloseMode mode) {
            if(this._container != null) this._container.HidePopup();
        }
        ColorPickEditBase IPopupColorPickEdit.OwnerEdit {
            get { return null; }
        }
        void IPopupColorPickEdit.SetSelectedColorItem(ColorItem item) {
        }
        bool IPopupColorPickEdit.HasBorder { get { return false; } }
    }
 
    public class DemoPopupColorBuilderEx : PopupColorBuilderEx {
        public DemoPopupColorBuilderEx(IPopupColorPickEdit owner)
            : base(owner) {
        }
        protected override ColorEditTabControlBase CreateTabControl() {
            ColorEditTabControlBase tab = base.CreateTabControl();
            tab.Dock = DockStyle.Fill;
            return tab;
        }
    }
}