Beispiel #1
0
        protected override void OnControlAdded(ControlEventArgs e)
        {  // as controls are added, remember them in local variables.
           //System.Diagnostics.Debug.WriteLine((Environment.TickCount % 10000).ToString("00000") + " VS start");

            if (e.Control is VScrollBarCustom)
            {
                vsc         = e.Control as VScrollBarCustom;
                vsc.Width   = ScrollBarWidth;
                vsc.Scroll += new System.Windows.Forms.ScrollEventHandler(OnScrollBarChanged);
                vsc.Name    = "VScrollPanel";
            }

            e.Control.MouseWheel += Control_MouseWheel;         // grab the controls mouse wheel and direct to our scroll
        }
Beispiel #2
0
        public ListControlCustom() : base()
        {
            items = new List <string>();
            SetStyle(ControlStyles.SupportsTransparentBackColor | ControlStyles.OptimizedDoubleBuffer, true);
            vScrollBar             = new VScrollBarCustom();
            vScrollBar.SmallChange = 1;
            vScrollBar.LargeChange = 1;
            Controls.Add(vScrollBar);
            vScrollBar.Visible = false;
            vScrollBar.Scroll += new System.Windows.Forms.ScrollEventHandler(vScroll);

            lbsys = new ListBox();
            this.Controls.Add(lbsys);
            lbsys.SelectedIndexChanged += lbsys_SelectedIndexChanged;
        }
 public RichTextBoxScroll() : base()
 {
     TextBox   = new RichTextBoxBack();
     ScrollBar = new VScrollBarCustom();
     Controls.Add(TextBox);
     Controls.Add(ScrollBar);
     TextBox.ScrollBars  = RichTextBoxScrollBars.None;
     TextBox.BorderStyle = BorderStyle.None;
     TextBox.BackColor   = BackColor;
     TextBox.ForeColor   = ForeColor;
     TextBox.Show();
     ScrollBar.Show();
     TextBox.VScroll     += OnVscrollChanged;
     TextBox.MouseWheel  += new MouseEventHandler(MWheel);       // richtextbox without scroll bars do not handle mouse wheels
     TextBox.TextChanged += TextChangeEventHandler;
     ScrollBar.Scroll    += new System.Windows.Forms.ScrollEventHandler(OnScrollBarChanged);
 }