winforms - Scrolling PictureBox in .NET? -


I have a photo box that is taking 512x512 upwards. This is a big way, I can make it 256x1024 which is better but how can I scroll it out?

"post-text" itemprop = "text">
  class scrollable image box: picturebox {public picturebox picture = new image box (); Public Picture Box Picture = New Picture Box (); HScroller HScroll = new HScrollbar (); VScrollBar vScroll = new VScrollBar (); Int w, h, scrollAmount; Public scrollfile box (integer w_, int h_, image image, int scroll amount) {AddControls (); Set (w_, h_, img, scrollAmount); } Public ScrollBarb (Box) () {AddControls (); } Public Zero ScrollEvent (Object Sender, MouseEventArgs e) {if (e.Delta == 0) Return; Var v = vScroll.Value + (e.Delta> 120? -scrollAmount: scrollAmount); V = v & gt; VScroll.Maximum? VScroll.Maximum: v; V = v & lt; VScroll.Minimum? VScroll.Minimum: v; VScroll.Value = V; } Zero AddControls () {picCorner.BackColor = Color.Gray; VScroll.ValueChanged + = Vert_EventHandler; This.Controls.Add (picCorner); This.Controls.Add (vScroll); This.Controls.Add (hScroll); This.Controls.Add (pick); } Public Zero Set (int w_, int h_, image img, int scrollAmount_) {w = w_; H = H_; ScrollAmount = scrollAmount_; Pic.Image = img; Pic.Width = img.Width; Pic.Height = img.Height; If (w> = img.Width) {this.Width = w; HScroll.Visible = false; } Else {hScroll.Left = 0; HScroll.Top = h; HScroll.Width = w; HScroll.Minimum = 0; HScroll.Maximum = pic.Image.Width - w; HScroll.Scroll + = hScrollBar1_Scroll; HScroll.Visible = true; } If (H> = IMG. Height) {this.Width = w; VScroll.Visible = false; } And {vScroll.Left = w; VScroll.Top = 0; VScroll.Height = h; VScroll.Minimum = 0; VScroll.Maximum = pic.Image.Height - h; VScroll.Scroll + = vScrollBar1_Scroll; VScroll.Visible = true; } This.Width = vScroll.Visible? W + vScroll.Width: w; this. Hect = hscroll.view? H + hScroll.Height: h; PicCorner.Left = vScroll.Left; PicCorner.Width = vScroll.Width; PicCorner.Top = hScroll.Top; The movie Hect = hscroll.highth; PicCorner.BackColor = this.BackColor; PicCorner.Visible = (vScroll.Visible & Hscroll View); } Zero hScrollBar1_Scroll (Object Sender, ScrollEventArgs e) {pic.Left = -e.NewValue; } Zero vScrollBar1_Scroll (Object Sender, ScrollEventArgs e) {pic.Top = -e.NewValue; } Zero Vert_EventHandler (object sender, EventArgs e) {pic.Top = -vScroll.Value; }}  

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -