C# Class SANTA.UI.ZPImageBox

A zoom-able, pan-able image box for displaying and navigating around images.
Inheritance: System.Windows.Forms.ScrollableControl
Afficher le fichier Open project: siegleal/iSanta

Protected Properties

Свойство Type Description
_dragging bool
_image Image
_imageFocus Point
_mode Mode
_multipleFiles bool
_zoom float
grabCursor System.Windows.Forms.Cursor
grabbingCursor System.Windows.Forms.Cursor

Méthodes publiques

Méthode Description
SetImage ( Bitmap image ) : void

Change the currently displayed image.

SetImage ( Bitmap image, bool reset ) : void

Change the currently displayed image

SetMultipleFileMode ( bool multipleFiles ) : void

Change if multiple files are selected or not. Multiple images cannot be displayed if this is set to true.

ZPImageBox ( ) : System

Construct a ZPImageBox

Méthodes protégées

Méthode Description
Box2ImageCoord ( Point boxCoord ) : Point

Convert a point from mouse coordinates to image coordinates.

Near ( Point a, Point b, float dist ) : bool

Determine if two points are within a certain distance of each other.

ResetImage ( bool moveToBoxCenter ) : void

Change the zoom level so the image is entirely viewable.

Private Methods

Méthode Description
DrawImage ( object sender, PaintEventArgs e ) : void

Paint the image to the box.

SetEventHandlers ( ) : void
ZPImageBox_KeyDown ( object sender, KeyEventArgs e ) : void

If the Control key was pressed, put the image into Manipulate mode.

ZPImageBox_KeyUp ( object sender, KeyEventArgs e ) : void

If the Control key was released, put the image into Navigate mode.

ZPImageBox_MouseDown ( object sender, MouseEventArgs e ) : void

Handle navigation interaction

ZPImageBox_MouseEnter ( object sender, EventArgs e ) : void

This needs to grab focus when the mouse enters so that input can be handled.

ZPImageBox_MouseMove ( object sender, MouseEventArgs e ) : void

Move the image around.

ZPImageBox_MouseUp ( object sender, MouseEventArgs e ) : void

Disable dragging mode.

ZPImageBox_MouseWheel ( object sender, MouseEventArgs e ) : void

Zoom in or out of the image.

Method Details

Box2ImageCoord() protected méthode

Convert a point from mouse coordinates to image coordinates.
protected Box2ImageCoord ( Point boxCoord ) : Point
boxCoord Point Coordinate in the box's coordinate system.
Résultat Point

Near() protected static méthode

Determine if two points are within a certain distance of each other.
protected static Near ( Point a, Point b, float dist ) : bool
a Point First point.
b Point Second Point.
dist float The
Résultat bool

ResetImage() protected méthode

Change the zoom level so the image is entirely viewable.
protected ResetImage ( bool moveToBoxCenter ) : void
moveToBoxCenter bool Should the image be moved back to the center of the box
Résultat void

SetImage() public méthode

Change the currently displayed image.
public SetImage ( Bitmap image ) : void
image System.Drawing.Bitmap The new image to display.
Résultat void

SetImage() public méthode

Change the currently displayed image
public SetImage ( Bitmap image, bool reset ) : void
image System.Drawing.Bitmap The new image to display
reset bool Whether to reset the zoom level and focal point
Résultat void

SetMultipleFileMode() public méthode

Change if multiple files are selected or not. Multiple images cannot be displayed if this is set to true.
public SetMultipleFileMode ( bool multipleFiles ) : void
multipleFiles bool Are multiple files selected
Résultat void

ZPImageBox() public méthode

Construct a ZPImageBox
public ZPImageBox ( ) : System
Résultat System

Property Details

_dragging protected_oe property

Is the _image being dragged/moved around.
protected bool _dragging
Résultat bool

_image protected_oe property

Image to display
protected Image _image
Résultat Image

_imageFocus protected_oe property

_imageFocus is the point in the image's coordinate system that corresponds to the _boxFocus, which is the point in the ZPImageBox coordinate system where the user last clicked when moving the image.
protected Point _imageFocus
Résultat Point

_mode protected_oe property

The current method of interaction with the ZPImageBox.
protected Mode _mode
Résultat Mode

_multipleFiles protected_oe property

Have multiple files been selected.
protected bool _multipleFiles
Résultat bool

_zoom protected_oe property

These specify the range of scaling factors for the image.
protected float _zoom
Résultat float

grabCursor protected_oe static_oe property

Cursor to use when the mouse button is depressed. It looks like an opened hand.
protected static Cursor,System.Windows.Forms grabCursor
Résultat System.Windows.Forms.Cursor

grabbingCursor protected_oe static_oe property

Cursor to use when the mouse button is not depressed. It looks like a hand grabbing.
protected static Cursor,System.Windows.Forms grabbingCursor
Résultat System.Windows.Forms.Cursor