예제 #1
0
        //protected override void OnMouseMove(MouseEventArgs e)
        //{
        //    base.OnMouseMove(e);
        //    Point pos = this.PointToClient(Control.MousePosition);
        //    int index = IndexOf(pos);
        //    if (index != -1 && index != _hoverIndex)
        //    {
        //        _hoverIndex = index;
        //        toolTip1.SetToolTip(this, Items[index].ToString());
        //    }
        //}

        //protected override void OnPaint(PaintEventArgs e)
        //{
        //    Size MinArea = this.Size;

        //    e.Graphics.TranslateTransform(-_xOffset, -_yOffset);

        //    //int ColorsPerLine = 1; // (int)(MinArea.Width / (_gridSize.Width + _gridPadding));
        //    //int StartingLine = _yOffset == 0 ? 0 : (int)((_gridSize.Height + _gridPadding) / _yOffset);
        //    //int Index = StartingLine * ColorsPerLine;

        //    // Setup the StringFormat object
        //    StringFormat sf = new StringFormat();

        //    Rectangle gridBounds = new Rectangle(_padding.Left, _padding.Top, _gridSize.Width, _gridSize.Height);

        //    int TextX = _padding.Horizontal * 2 + _gridSize.Width;
        //    Rectangle TextBounds = new Rectangle(TextX, _padding.Top, this.Width - TextX - _padding.Right, _gridSize.Height);

        //    // Create a rectangle that represents the entire item.
        //    Rectangle EntryBounds = new Rectangle(TextX, _padding.Top, this.Width - _padding.Right, _gridSize.Height + _padding.Vertical);

        //    int DeltaY = _gridSize.Height + _padding.Vertical;

        //    using (SolidBrush brush = new SolidBrush(Color.Black))
        //    {
        //        for (int i = 0; i < Items.Count; i++)
        //        {
        //            // If this color has any alpha set, then draw a background grid to show this.
        //            if (Items[i].Color.A != 255)
        //                DrawTransparencyGrid(e.Graphics, gridBounds);

        //            brush.Color = Items[i].Color;

        //            // Paint the color
        //            e.Graphics.FillRectangle(brush, gridBounds);

        //            // Draw the boundary around the color section
        //            e.Graphics.DrawRectangle(SystemPens.ControlDark, gridBounds);

        //            // If selected, draw a highlight color rectangle around the entire entry.
        //            if (i == _selectedIndex)
        //            {
        //                Rectangle r = gridBounds;
        //                r.Inflate(2, 2);
        //                e.Graphics.DrawRectangle(SystemPens.Highlight, r);
        //            }

        //            // Move the gridBounds down one
        //            //gridBounds.X += (_gridSize.Width + _gridPadding);
        //            //if (gridBounds.X + _gridSize.Width > MinArea.Width)
        //            //    gridBounds.X = _xOffset == 0 ? _gridPadding : (int)((_gridSize.Width + _gridPadding) / _xOffset);

        //            //if (gridBounds.X == _gridPadding)
        //            gridBounds.Y += DeltaY;
        //            TextBounds.Y += DeltaY;
        //            EntryBounds.Y += DeltaY;
        //        }
        //    }
        //}

        //protected void OnSelectedIndexChange()
        //{
        //    if (SelectedIndexChange != null)
        //        SelectedIndexChange(null, null);
        //}

        #endregion [ Event Triggers ]

        #region [ Event Delegates ]

        private void lstColors_SelectedIndexChanged(object sender, EventArgs e)
        {
            _suppressEvents = true;
            if (lstColors.SelectedIndex >= 0)
            {
                txtSearch.Text = ((ColorItem)lstColors.SelectedItem).Text;
            }
            _suppressEvents = false;

            SelectedIndexChange?.Invoke(null, null);
        }
예제 #2
0
        //protected override void OnGotFocus(EventArgs e)
        //{
        //    base.OnGotFocus(e);
        //    this.Refresh();
        //    MakeVisible();
        //}

        protected void OnSelectedIndexChange()
        {
            SelectedIndexChange?.Invoke(null, null);
        }