示例#1
0
        public ComboBox()
        {
            InitializeComponent();

            m_cpiLastSelected = null;

            m_clListControls = new List <ComboPopoutItem>();

            m_Panel  = new Panel();
            m_tsHost = new ToolStripControlHost(m_Panel);

            m_tsDropDown          = new ToolStripDropDown();
            m_tsDropDown.AutoSize = false;
            m_tsDropDown.Items.Add(m_tsHost);

            m_scItems              = new StringCollectionWithEvents();
            m_scItems.ItemAdded   += new StringCollectionWithEvents.ItemAddedEventHandler(m_scItems_ItemAdded);
            m_scItems.ItemRemoved += new StringCollectionWithEvents.ItemRemovedEventHandler(m_scItems_ItemRemoved);
            m_iSelectedIndex       = -1;

            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            this.SetStyle(ControlStyles.UserPaint, true);
            this.UpdateStyles();

            BorderColor = Color.FromArgb(152, 152, 152);
            BorderPen   = new Pen(BorderColor);

            this.Paint  += new PaintEventHandler(ComboBox_Paint);
            this.Resize += new EventHandler(ComboBox_Resize);

            Radius   = 5.0f;
            Diameter = 10.0f;

            GradientPen = new Pen(Color.Black);

            GradientStart  = Color.FromArgb(252, 252, 252);
            GradientFinish = Color.FromArgb(223, 223, 223);
            UpdateGradients();

            UpdateRegion();

            pFontSize       = 10;
            pFont           = FontVault.GetFontVault().GetFont(FontVault.AvailableFonts.MyriadPro, pFontSize);
            MeasureLbl.Font = pFont;

            TextColor = Color.Black;
            TextBrush = new SolidBrush(TextColor);

            this.MouseUp += new MouseEventHandler(ComboBox_MouseUp);

            UpdateRegion();
        }
        public SequentialListBox()
        {
            InitializeComponent();

            this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.UserPaint, true);
            this.UpdateStyles();

            m_scItems              = new StringCollectionWithEvents();
            m_scItems.ItemAdded   += new StringCollectionWithEvents.ItemAddedEventHandler(m_scItems_ItemAdded);
            m_scItems.ItemChanged += new StringCollectionWithEvents.ItemChangedEventHandler(m_scItems_ItemChanged);
            m_scItems.ItemRemoved += new StringCollectionWithEvents.ItemRemovedEventHandler(m_scItems_ItemRemoved);

            this.Resize += new EventHandler(SequentialListBox_Resize);
            this.Paint  += new PaintEventHandler(SequentialListBox_Paint);

            pRowControls = new ListRowCollection();

            pRowControls.EntryAdded     += new EventHandler(pRowControls_EntryAdded);
            pRowControls.EntryRemoved   += new ListRowCollection.EntryRemovedHandler(pRowControls_EntryRemoved);
            pRowControls.EntryChanged   += new ListRowCollection.EntryChangedHandler(pRowControls_EntryChanged);
            pRowControls.EntryClicked   += new ListRowCollection.EntryClickedHandler(pRowControls_EntryClicked);
            pRowControls.EntriesCleared += new EventHandler(pRowControls_EntriesCleared);
            pRowControls.CmdKeyPressed  += new CmdKeyPressedHandler(pRowControls_CmdKeyPressed);

            ListScroller.Scroll += new ScrollEventHandler(ListScroller_Scroll);

            BorderPen = new Pen(Color.FromArgb(152, 152, 152));

            pSelectedIndex = -1;

            this.BackColorChanged += new EventHandler(SequentialListBox_BackColorChanged);

            ListScroller.LargeChange = SCROLL_LARGE_CHANGE;
            ListScroller.SmallChange = SCROLL_SMALL_CHANGE;
            UpdateScrollBar();

            RowSelectedColor = Color.FromArgb(213, 218, 244);
            RowColor2        = Color.FromArgb(255, 255, 255);
            RowColor1        = Color.FromArgb(245, 245, 245);
        }