Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2017
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. //some previous code
  2. this.pictureBox.Left = left;
  3. this.pictureBox.Top = top;
  4. this.AutoScroll = true;
  5.  
  6. // add this line under:
  7. this.AutoScrollPosition = new Point(this.Width / 2, this.Height / 2);
  8.  
  9. public ScalablePictureBox()
  10. {
  11. //some code ...
  12.  
  13.  
  14. this.pictureTracker.ScrollPictureEvent += new PictureTracker.ScrollPictureEventHandler(this.scalablePictureBoxImp.OnScrollPictureEvent);
  15. this.pictureTracker.PictureTrackerClosed += new PictureTracker.PictureTrackerClosedHandler(this.pictureTracker_PictureTrackerClosed);
  16.  
  17. //Enter the line below to hook on event
  18. this.scalablePictureBoxImp.ZoomRateChangedEvent += ScalablePictureBoxImp_ZoomRateChangedEvent;
  19. }
  20.  
  21. private void ScalablePictureBoxImp_ZoomRateChangedEvent(int zoomRate, bool isFullPictureShown)
  22. {
  23. this.scalablePictureBoxImp.AutoScrollPosition = new Point(this.Width / 2, this.Height / 2);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement