예제 #1
0
        void control_MouseUp(object sender, MouseEventArgs e)
        {
            this.container.CloseOnOuterMouseClick = false;

            PWColorCellsControl control = sender as PWColorCellsControl;
            int cellIndex = viewInfo.GetCellIndex(new Point(e.X, e.Y));

            if ((e.Button & MouseButtons.Left) != 0 && control.Capture)
            {
                if (cellIndex != -1)
                {
                    control.SelectedCellIndex = cellIndex;
                    control.Capture           = false;
                    OnEnterColor(control.SelectedCellIndex);
                }
            }
            if ((e.Button & MouseButtons.Right) != 0 && cellIndex >= ColorCellsControlViewInfo.CellColors.Length && rItem.ShowColorDialog)
            {
                ColorDialog cd = new ColorDialog();
                cd.FullOpen = true;
                cd.Color    = viewInfo.GetCellColor(cellIndex);

                try
                {
                    if (cd.ShowDialog() == DialogResult.OK)
                    {
                        viewInfo.CustomColors[cellIndex - ColorCellsControlViewInfo.CellColors.Length] = cd.Color;
                        OnEnterColor(cellIndex);
                    }
                }
                catch (Exception ex)
                { }
            }
            this.container.CloseOnOuterMouseClick = true;
        }
예제 #2
0
        internal void CreateTabControl(PopupControlContainer container)
        {
            if (tabControl != null)
            {
                tabControl.Dispose();
            }
            tabControl = new XtraTabControl();
            tabControl.LookAndFeel.ParentLookAndFeel = container.LookAndFeel;
            tabControl.TabStop = false;
            ColorListBox colorListBox;

            if (signType.HasValue && signType.Value != SignType.RGB)
            {
                colorListBox = CreateColorListBox(MonoColorList);
            }
            else
            {
                colorListBox = CreateColorListBox(ColorListBoxViewInfo.WebColors);
            }

            PWColorCellsControl colorCellsControl = CreateColorCellsControl();

            AddTabPage(tabControl, colorCellsControl, StringId.ColorTabCustom);
            AddTabPage(tabControl, colorListBox, "Standard");
            //AddTabPage(tabControl, new DateEdit(), "Date");

            tabControl.Dock = DockStyle.Fill;
            this.container.Controls.Add(tabControl);
            Size size = colorCellsControl.GetBestSize();

            size.Height         = GetNearestBestClientHeight(size.Height, colorListBox);
            this.container.Size = tabControl.CalcSizeByPageClient(size);
        }
예제 #3
0
 public PWColorCellsControlViewInfo(PWColorCellsControl owner, int columnCount, int rowCount)
     : base(owner)
 {
     this.fCustomColors     = null;
     this.selectedCellIndex = 0;
     this.columnCount       = columnCount;
     this.rowCount          = rowCount;
 }
예제 #4
0
 protected override bool FindEditColor(Color clr)
 {
     if (Properties.ShowSystemColors)
     {
         for (int i = 0; i < ColorListBoxViewInfo.SystemColors.Length; i++)
         {
             if (ColorListBoxViewInfo.SystemColors[i].Equals(clr))
             {
                 TabControl.OnSelectPageByCaption(Localizer.Active.GetLocalizedString(StringId.ColorTabSystem));
                 (TabControl.SelectedTabPage.Controls[0] as ColorListBox).SetSelectedIndex(i);
                 return(true);
             }
         }
     }
     if (Properties.ShowWebColors)
     {
         for (int i = 0; i < ColorListBoxViewInfo.WebColors.Length; i++)
         {
             if (ColorListBoxViewInfo.WebColors[i].Equals(clr))
             {
                 TabControl.OnSelectPageByCaption(Localizer.Active.GetLocalizedString(StringId.ColorTabWeb));
                 (TabControl.SelectedTabPage.Controls[0] as ColorListBox).SetSelectedIndex(i);
                 return(true);
             }
         }
     }
     if (Properties.ShowCustomColors)
     {
         TabControl.OnSelectPageByCaption(Localizer.Active.GetLocalizedString(StringId.ColorTabCustom));
         PWColorCellsControl ctl = TabControl.SelectedTabPage.Controls[0] as PWColorCellsControl;
         //PWColorCellsControlEx ctl = TabControl.SelectedTabPage.Controls[0] as PWColorCellsControlEx;
         for (int i = 0; i < PWColorCellsControlViewInfo.CellColorsRGB.Length; i++)
         {
             if (PWColorCellsControlViewInfo.CellColorsRGB[i] == clr)
             {
                 ctl.SelectedCellIndex = i;
                 return(true);
             }
         }
         PWColorCellsControlViewInfo vi = ctl._ViewInfo as PWColorCellsControlViewInfo;
         for (int i = 0; i < vi.CustomColors.Length; i++)
         {
             if (vi.CustomColors[i] == clr)
             {
                 ctl.SelectedCellIndex = i + PWColorCellsControlViewInfo.CellColorsRGB.Length;
                 return(true);
             }
         }
         ctl.SelectedCellIndex = PWColorCellsControlViewInfo.CellColorsRGB.Length;
     }
     TabControl.SelectedTabPageIndex = 0;
     return(false);
 }
예제 #5
0
        PWColorCellsControl CreateColorCellsControl()
        {
            PWColorCellsControl control = new PWColorCellsControl(null, 8, 8);

            viewInfo = new PWColorCellsControlViewInfo(control, 8, 8);
            rItem    = new DevExpress.XtraEditors.Repository.RepositoryItemColorEdit();
            rItem.ShowColorDialog  = true;
            control.PopupContainer = container;
            control.Properties     = rItem;

            control.Properties.ShowCustomColors = false;
            control.EnterColor += new EnterColorEventHandler(OnEnterColor);
            //control.MouseUp += new MouseEventHandler(control_MouseUp);

            return(control);
        }
예제 #6
0
        protected override void SetTabPageProperties(int pageIndex, PopupBaseForm shadowForm)
        {
            BaseControl  control  = null;
            XtraTabPage  tabPage  = this.TabControl.TabPages[pageIndex];
            ColorListBox colorBox = null;

            control      = new PWColorCellsControl(shadowForm);
            control.Size = (control as PWColorCellsControl).GetBestSize();
            switch (pageIndex)
            {
            case 0:
                tabPage.Text = Localizer.Active.GetLocalizedString(StringId.ColorTabCustom);
                control      = new PWColorCellsControl(shadowForm);
                (control as PWColorCellsControl).Properties  = Owner.Properties;
                (control as PWColorCellsControl).EnterColor += new EnterColorEventHandler(OnEnterColor);
                control.Size        = (control as PWColorCellsControl).GetBestSize();
                tabPage.PageVisible = Properties.ShowCustomColors;
                break;

            case 1:
                tabPage.Text = Localizer.Active.GetLocalizedString(StringId.ColorTabWeb);
                colorBox     = CreateColorListBox();
                colorBox.HighlightedItemStyle = Properties.HighlightedItemStyle;

                if (signType.HasValue && signType.Value != SignType.RGB)
                {
                    colorBox.Items.AddRange(MonoColorList);
                }
                else
                {
                    colorBox.Items.AddRange(ColorListBoxViewInfo.WebColors);
                }
                colorBox.EnterColor           += new EnterColorEventHandler(OnEnterColor);
                colorBox.SelectedIndexChanged += new EventHandler(OnSelectedIndexChanged);
                colorBox.Size = control.Size;
                //colorBox.Size = GetBestListBoxSize(colorBox);
                control             = colorBox;
                tabPage.PageVisible = Properties.ShowWebColors;
                break;

            case 2:
                tabPage.Text = Localizer.Active.GetLocalizedString(StringId.ColorTabSystem);
                colorBox     = CreateColorListBox();
                colorBox.HighlightedItemStyle = Properties.HighlightedItemStyle;
                colorBox.Items.AddRange(ColorListBoxViewInfo.SystemColors);
                colorBox.EnterColor           += new EnterColorEventHandler(OnEnterColor);
                colorBox.SelectedIndexChanged += new EventHandler(OnSelectedIndexChanged);
                colorBox.Size = control.Size;
                //colorBox.Size = GetBestListBoxSize(colorBox);
                control             = colorBox;
                tabPage.PageVisible = false;
                break;
            }
            if (control == null)
            {
                return;
            }
            control.Dock        = DockStyle.Fill;
            control.BorderStyle = BorderStyles.NoBorder;
            if (Owner.LookAndFeel != null)
            {
                control.LookAndFeel.Assign(Owner.LookAndFeel);
            }
            tabPage.Controls.Add(control);
        }