AtalaImageViewerCenterInViewer Method |
' Add an event handler for the MouseUp event. Private Me.Viewer.MouseUp += New MouseButtonEventHandler(AddressOf Viewer_MouseUp) '... Sub Viewer_MouseUp(ByVal sender As Object, ByVal e As MouseButtonEventArgs) If Me.Viewer.Image Is Nothing Then Return End If Dim pt As Point = Me.Viewer.PointToImage(e.GetPosition(Me.Viewer)) Me.Viewer.CenterInViewer(pt) End Sub
// Add an event handler for the MouseUp event. this.Viewer.MouseUp += new MouseButtonEventHandler(Viewer_MouseUp); //... void Viewer_MouseUp(object sender, MouseButtonEventArgs e) { if (this.Viewer.Image == null) return; Point pt = this.Viewer.PointToImage(e.GetPosition(this.Viewer)); this.Viewer.CenterInViewer(pt); }
Name | Description | |
---|---|---|
CenterInViewer(Point) | Scrolls the image to center a pixel within the viewer (if possible). | |
CenterInViewer(Rect, Boolean) | Centers a rectangle, optionally changing the zoom level to fit the rectangle within the viewer. |
' Add an event handler for the MouseUp event. Private Me.Viewer.MouseUp += New MouseButtonEventHandler(AddressOf Viewer_MouseUp) '... Sub Viewer_MouseUp(ByVal sender As Object, ByVal e As MouseButtonEventArgs) If Me.Viewer.Image Is Nothing Then Return End If Dim pt As Point = Me.Viewer.PointToImage(e.GetPosition(Me.Viewer)) Me.Viewer.CenterInViewer(pt) End Sub
// Add an event handler for the MouseUp event. this.Viewer.MouseUp += new MouseButtonEventHandler(Viewer_MouseUp); //... void Viewer_MouseUp(object sender, MouseButtonEventArgs e) { if (this.Viewer.Image == null) return; Point pt = this.Viewer.PointToImage(e.GetPosition(this.Viewer)); this.Viewer.CenterInViewer(pt); }