Ejemplo n.º 1
0
        private int GetItemCount(ImageComboStyle style)
        {
            switch (style)
            {
            case ImageComboStyle.FrameType:
                return(3);

            case ImageComboStyle.LinearGradient:
                return(4);

            case ImageComboStyle.LineStyle:
                return(5);

            case ImageComboStyle.LineWidth:
                return(10);

            case ImageComboStyle.PointShape:
                return(6);

            case ImageComboStyle.HatchStyle:
                return(53);

            case ImageComboStyle.HatchStyleWithNone:
                return(54);
            }
            return(0);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Constructor. Sets the style of combo and 2 both fill colors.
 /// </summary>
 public ImageCombo(ImageComboStyle style, Color color1, Color color2)
 {
     m_list.ColorDepth  = ColorDepth.Depth24Bit;
     this.OutlineColor  = Color.Black;
     this.DrawMode      = DrawMode.OwnerDrawFixed;
     this.DropDownStyle = ComboBoxStyle.DropDownList;
     m_style            = style;
     _color1            = color1;
     _color2            = color2;
     EnabledChanged    += (s, e) => RefreshImageList();
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Generates items for the given combo style
        /// </summary>
        private void GenerateItems(ImageComboStyle style)
        {
            Items.Clear();

            _itemCount = GetItemCount(style);

            var s = string.Empty;

            for (int i = 0; i < _itemCount; i++)
            {
                switch (style)
                {
                case ImageComboStyle.FrameType:
                {
                    s = ((FrameType)i).ToString();
                    break;
                }

                case ImageComboStyle.LinearGradient:
                {
                    s = ((LinearGradient)i).ToString();
                    break;
                }

                case ImageComboStyle.PointShape:
                {
                    s = ((VectorMarkerType)i).ToString();
                    break;
                }

                case ImageComboStyle.HatchStyle:
                {
                    s = ((HatchStyle)i).ToString();
                    break;
                }

                case ImageComboStyle.HatchStyleWithNone:
                {
                    s = i == 0 ? "None" : ((HatchStyle)i - 1).ToString();
                    break;
                }
                }

                Items.Add(new ImageComboItem(s, i));
            }

            RefreshImageList();
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Constructor. Sets the style of combo and fill color.
 /// </summary>
 public ImageCombo(ImageComboStyle style, Color color1) : this(style, color1, color1)
 {
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Constructor. Sets the style of combo.
 /// </summary>
 public ImageCombo(ImageComboStyle style) : this(style, Color.Gray, Color.Gray)
 {
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Generates items for the given combo style
        /// </summary>
        private void GenerateItems(ImageComboStyle style)
        {
            this.Items.Clear();

            // choosing number of items
            switch (style)
            {
            case ImageComboStyle.FrameType: _itemCount = 3; break;

            case ImageComboStyle.LinearGradient: _itemCount = 4; break;

            case ImageComboStyle.LineStyle: _itemCount = 5; break;

            case ImageComboStyle.LineWidth: _itemCount = 10; break;

            case ImageComboStyle.PointShape: _itemCount = 6; break;

            case ImageComboStyle.HatchStyle: _itemCount = 53; break;

            case ImageComboStyle.HatchStyleWithNone: _itemCount = 54; break;

            case ImageComboStyle.ColorSchemeGraduated:
            case ImageComboStyle.ColorSchemeRandom:
            {
                if (_colorSchemes != null)
                {
                    _itemCount = _colorSchemes.List.Count;
                }
                else
                {
                    _itemCount = 0;
                }
                break;
            }
            }

            // adding items
            string str = string.Empty;

            for (int i = 0; i < _itemCount; i++)
            {
                switch (style)
                {
                case ImageComboStyle.FrameType:
                {
                    if (i == 0)
                    {
                        str = "ftRectangle";
                    }
                    else if (i == 1)
                    {
                        str = "ftRounded rectangle";
                    }
                    else if (i == 2)
                    {
                        str = "ftPointed rectangle";
                    }
                    break;
                }

                case ImageComboStyle.LinearGradient:
                {
                    // TODO: temporary
                    str = "  Style " + (i + 1).ToString();
                    break;
                }

                case ImageComboStyle.LineStyle:
                {
                    str = "ls";
                    break;
                }

                case ImageComboStyle.LineWidth:
                {
                    str = "wd";
                    break;
                }

                case ImageComboStyle.PointShape:
                {
                    // TODO: temporary
                    //str = ((tkPointShapeType)i).ToString();
                    //str = str.Substring(5, str.Length - 5);

                    str = "  Style " + (i + 1).ToString();
                    break;
                }

                case ImageComboStyle.HatchStyle:
                {
                    // TODO: temporary
                    //str = ((tkGDIPlusHatchStyle)i).ToString();
                    str = "  Style " + (i + 1).ToString();
                    break;
                }

                case ImageComboStyle.HatchStyleWithNone:
                {
                    str = "  Style " + (i + 1).ToString();
                    break;
                }

                case ImageComboStyle.ColorSchemeGraduated:
                case ImageComboStyle.ColorSchemeRandom:
                {
                    str = "cl";
                    break;
                }
                }

                // getting rid of prefix
                str = str.Substring(2, str.Length - 2);

                this.Items.Add(new ImageComboItem(str, i));
            }

            // adds images
            RefreshImageList();
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ImageCombo"/> class.
 /// </summary>
 public ImageCombo()
 {
     _style  = ImageComboStyle.Common;
     _color1 = Color.Gray;
     _color2 = Color.Honeydew;
 }