IGLib  1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
IG.Forms.ImageViewerControl Class Reference
+ Inheritance diagram for IG.Forms.ImageViewerControl:
+ Collaboration diagram for IG.Forms.ImageViewerControl:

Public Member Functions

 ImageViewerControl ()
 
void ShowViewedItem ()
 Shows / plays the viewed contents. More...
 
void Clear ()
 Clears the viewer and eventually releases any resources used. More...
 
bool IsEligibleForViewing (string fileLocation)
 Rerurns a flag indicating whether the file (or web resource) at the specified location is eligible for vieiwnig in the current viewer or not. More...
 
bool IsEligibleForViewing (Stream stream)
 Returnns a flag indicating whether the specified stream is eligible for vieiwnig or not. More...
 
void BrowseFile ()
 Opens a browser to select the file shown. More...
 
 ImageViewerControl ()
 
void ShowViewedItem ()
 Shows / plays the viewed contents. More...
 
void Clear ()
 Clears the viewer and eventually releases any resources used. More...
 
bool IsEligibleForViewing (string fileLocation)
 Rerurns a flag indicating whether the file (or web resource) at the specified location is eligible for vieiwnig in the current viewer or not. More...
 
bool IsEligibleForViewing (Stream stream)
 Returnns a flag indicating whether the specified stream is eligible for vieiwnig or not. More...
 
void BrowseFile ()
 Opens a browser to select the file shown. More...
 

Static Public Member Functions

static bool IsValidHttpUrl (string uriNamme)
 Chechks whether the specified URI is a valid HTTP URL. More...
 
static Image GetImageFromUrl (string url)
 Gets an image from the specified URL. More...
 
static bool IsValidHttpUrl (string uriNamme)
 Chechks whether the specified URI is a valid HTTP URL. More...
 
static Image GetImageFromUrl (string url)
 Gets an image from the specified URL. More...
 

Protected Member Functions

void UpdateControlsVisible ()
 Updates dependencies on IsControlsVisible. More...
 
void UpdateBrowsable ()
 Updates dependencies on IsBrowsable. More...
 
void UpdateDragAndDrop ()
 Updates dependencies on IsDragAndDrop. More...
 
override void Dispose (bool disposing)
 Clean up any resources being used. More...
 
void UpdateControlsVisible ()
 Updates dependencies on IsControlsVisible. More...
 
void UpdateBrowsable ()
 Updates dependencies on IsBrowsable. More...
 
void UpdateDragAndDrop ()
 Updates dependencies on IsDragAndDrop. More...
 
override void Dispose (bool disposing)
 Clean up any resources being used. More...
 

Protected Attributes

List< PictureBoxSizeMode > _availableSizeModes = Util.GetEnumValues<PictureBoxSizeMode>()
 
string _viewedFile
 
Stream _stream
 
bool _isShownImmediately = true
 
bool _canViewFiles = true
 
bool _canViewUrls = true
 
bool _canViewStreams = true
 Whether the current viewer can read streams. More...
 
bool _isBrowsable = true
 
bool _isDragAndDrop = true
 

Properties

PictureBoxSizeMode SizeMode [get, set]
 Enumeraton of type PictureBoxSizeMode that specifies how the image is sized and positioned witin the PictureBox control. More...
 
string ViewedFile [get, set]
 Gets or sets path to the file or URL of the file that is currently being viewed. More...
 
Stream ViewedStream [get, set]
 Gets or sets the stream containing the file that is currently being viewed. More...
 
bool IsShownImmediately [get, set]
 Flag that specifies whether content is shown immediately after the viewed object is set. More...
 
bool CanViewFiles [get, set]
 Whether the current viewer can view files from the file system. More...
 
bool CanViewUrls [get, set]
 Whether the current viewer can view web resources (files on the internet). More...
 
bool CanViewStreams [get, set]
 
bool IsControlsVisible [get, set]
 Gets / sets a flag that specified whether the viewer's controls are visible or not. More...
 
bool IsBrowsable [get, set]
 Gets or sets the flag specifying whether one can browse for the file to be opened (e.g. by using the file selection dialog). More...
 
bool IsDragAndDrop [get, set]
 Whether the viewer provides drag & drop capability. More...
 
- Properties inherited from IG.Forms.IFileViewer
string ViewedFile [get, set]
 Gets or sets path to the file or URL of the file that is currently being viewed. More...
 
Stream ViewedStream [get, set]
 Gets or sets the stream containing the file that is currently being viewed. More...
 
bool IsShownImmediately [get, set]
 Flag that specifies whether content is shown / played immediately after the viewed object is set. More...
 
bool CanViewFiles [get, set]
 Whether the current viewer can view files from the file system. More...
 
bool CanViewUrls [get, set]
 Whether the current viewer can view web resources (files on the internet). More...
 
bool CanViewStreams [get, set]
 Whether the current viewer can read streams. More...
 
bool IsControlsVisible [get, set]
 Gets / sets a flag that specified whether the viewer's controls are visible or not. More...
 
bool IsBrowsable [get, set]
 Gets or sets the flag specifying whether one can browse for the file to be opened (e.g. by using the file selection dialog). More...
 
bool IsDragAndDrop [get, set]
 Whether the viewer provides drag & drop capability. More...
 

Private Member Functions

void fileSelector1_FileSelected (object sender, EventArgs e)
 Triggered when file is selected by the embedded file selector control. More...
 
void pictureBox1_DragDrop (object sender, DragEventArgs e)
 
void pictureBox1_DragEnter (object sender, DragEventArgs e)
 
void comboSizeMode_SelectedIndexChanged (object sender, EventArgs e)
 
void menuShowControls_Click (object sender, EventArgs e)
 
void menuClearHistory_Click (object sender, EventArgs e)
 
void comboSizeMode_Click (object sender, EventArgs e)
 
void menuDragDrop_Click (object sender, EventArgs e)
 
void menuBrowse_Click (object sender, EventArgs e)
 
void showControlsToolStripMenuItem_Click (object sender, EventArgs e)
 
void ImageViewerControl_Load (object sender, EventArgs e)
 Handles the load event of the current control. More...
 
void InitializeComponent ()
 Required method for Designer support - do not modify the contents of this method with the code editor. More...
 
void fileSelector1_FileSelected (object sender, EventArgs e)
 Triggered when file is selected by the embedded file selector control. More...
 
void pictureBox1_DragDrop (object sender, DragEventArgs e)
 
void pictureBox1_DragEnter (object sender, DragEventArgs e)
 
void comboSizeMode_SelectedIndexChanged (object sender, EventArgs e)
 
void menuShowControls_Click (object sender, EventArgs e)
 
void menuClearHistory_Click (object sender, EventArgs e)
 
void comboSizeMode_Click (object sender, EventArgs e)
 
void menuDragDrop_Click (object sender, EventArgs e)
 
void menuBrowse_Click (object sender, EventArgs e)
 
void showControlsToolStripMenuItem_Click (object sender, EventArgs e)
 
void ImageViewerControl_Load (object sender, EventArgs e)
 Handles the load event of the current control. More...
 
void InitializeComponent ()
 Required method for Designer support - do not modify the contents of this method with the code editor. More...
 

Private Attributes

PictureBoxSizeMode _sizeMode = PictureBoxSizeMode.CenterImage
 
bool _closeStreamAfterUse = false
 
bool _isControlsVisible = true
 
System.ComponentModel.IContainer components = null
 Required designer variable. More...
 
System.Windows.Forms.PictureBox pictureBox1
 
IG.Forms.FileSelector fileSelector1
 
System.Windows.Forms.Panel pnlOptions
 
System.Windows.Forms.Label lblSzeMode
 
System.Windows.Forms.ComboBox comboSizeMode
 
System.Windows.Forms.Panel pnlPicture
 
System.Windows.Forms.ContextMenuStrip contextMenuMain
 
System.Windows.Forms.Panel pnlOuter
 
System.Windows.Forms.Panel pnlControls
 
System.Windows.Forms.ToolStripMenuItem menuClearHistory
 
System.Windows.Forms.ToolStripMenuItem menuOptions
 
System.Windows.Forms.ToolStripMenuItem menuDragDrop
 
System.Windows.Forms.ToolStripMenuItem menuBrowse
 
System.Windows.Forms.ToolStripMenuItem menuShowControls
 

Constructor & Destructor Documentation

IG.Forms.ImageViewerControl.ImageViewerControl ( )
inline
IG.Forms.ImageViewerControl.ImageViewerControl ( )
inline

Member Function Documentation

static bool IG.Forms.ImageViewerControl.IsValidHttpUrl ( string  uriNamme)
inlinestatic

Chechks whether the specified URI is a valid HTTP URL.

Parameters
uriNammeURL to be tested.
Returns
True iif the specified string is a valid HTTP URL, false otherwise.
static Image IG.Forms.ImageViewerControl.GetImageFromUrl ( string  url)
inlinestatic

Gets an image from the specified URL.

Parameters
urlURL of the image.
Returns
Image object (of class Image) obtained from the specified URL.
void IG.Forms.ImageViewerControl.ShowViewedItem ( )
inline

Shows / plays the viewed contents.

Can have the role of refresh when IsShownImmediately is true, or is used to actually show the contents after assigning it.

Implements IG.Forms.IFileViewer.

void IG.Forms.ImageViewerControl.Clear ( )
inline

Clears the viewer and eventually releases any resources used.

Implements IG.Forms.IFileViewer.

bool IG.Forms.ImageViewerControl.IsEligibleForViewing ( string  fileLocation)
inline

Rerurns a flag indicating whether the file (or web resource) at the specified location is eligible for vieiwnig in the current viewer or not.

Parameters
fileLocationPath to the file on a file system, or file URL.
Returns
True if the file can be viewed in the current viewer, false otherwise.

Implements IG.Forms.IFileViewer.

bool IG.Forms.ImageViewerControl.IsEligibleForViewing ( Stream  stream)
inline

Returnns a flag indicating whether the specified stream is eligible for vieiwnig or not.

Parameters
streamPath to the file on a file system, or file URL.
Returns
True if the stream can be viewed in the current viewer, false otherwise.

Implements IG.Forms.IFileViewer.

void IG.Forms.ImageViewerControl.UpdateControlsVisible ( )
inlineprotected

Updates dependencies on IsControlsVisible.

void IG.Forms.ImageViewerControl.BrowseFile ( )
inline

Opens a browser to select the file shown.

Available only when IsBrowsable property is true.

Implements IG.Forms.IFileViewer.

void IG.Forms.ImageViewerControl.UpdateBrowsable ( )
inlineprotected

Updates dependencies on IsBrowsable.

void IG.Forms.ImageViewerControl.UpdateDragAndDrop ( )
inlineprotected

Updates dependencies on IsDragAndDrop.

void IG.Forms.ImageViewerControl.fileSelector1_FileSelected ( object  sender,
EventArgs  e 
)
inlineprivate

Triggered when file is selected by the embedded file selector control.

void IG.Forms.ImageViewerControl.pictureBox1_DragDrop ( object  sender,
DragEventArgs  e 
)
inlineprivate
void IG.Forms.ImageViewerControl.pictureBox1_DragEnter ( object  sender,
DragEventArgs  e 
)
inlineprivate
void IG.Forms.ImageViewerControl.comboSizeMode_SelectedIndexChanged ( object  sender,
EventArgs  e 
)
inlineprivate
void IG.Forms.ImageViewerControl.menuShowControls_Click ( object  sender,
EventArgs  e 
)
inlineprivate
void IG.Forms.ImageViewerControl.menuClearHistory_Click ( object  sender,
EventArgs  e 
)
inlineprivate
void IG.Forms.ImageViewerControl.comboSizeMode_Click ( object  sender,
EventArgs  e 
)
inlineprivate
void IG.Forms.ImageViewerControl.menuDragDrop_Click ( object  sender,
EventArgs  e 
)
inlineprivate
void IG.Forms.ImageViewerControl.menuBrowse_Click ( object  sender,
EventArgs  e 
)
inlineprivate
void IG.Forms.ImageViewerControl.showControlsToolStripMenuItem_Click ( object  sender,
EventArgs  e 
)
inlineprivate
void IG.Forms.ImageViewerControl.ImageViewerControl_Load ( object  sender,
EventArgs  e 
)
inlineprivate

Handles the load event of the current control.

override void IG.Forms.ImageViewerControl.Dispose ( bool  disposing)
inlineprotected

Clean up any resources being used.

Parameters
disposingtrue if managed resources should be disposed; otherwise, false.
void IG.Forms.ImageViewerControl.InitializeComponent ( )
inlineprivate

Required method for Designer support - do not modify the contents of this method with the code editor.

static bool IG.Forms.ImageViewerControl.IsValidHttpUrl ( string  uriNamme)
inlinestatic

Chechks whether the specified URI is a valid HTTP URL.

Parameters
uriNammeURL to be tested.
Returns
True iif the specified string is a valid HTTP URL, false otherwise.
static Image IG.Forms.ImageViewerControl.GetImageFromUrl ( string  url)
inlinestatic

Gets an image from the specified URL.

Parameters
urlURL of the image.
Returns
Image object (of class Image) obtained from the specified URL.
void IG.Forms.ImageViewerControl.ShowViewedItem ( )
inline

Shows / plays the viewed contents.

Can have the role of refresh when IsShownImmediately is true, or is used to actually show the contents after assigning it.

Implements IG.Forms.IFileViewer.

void IG.Forms.ImageViewerControl.Clear ( )
inline

Clears the viewer and eventually releases any resources used.

Implements IG.Forms.IFileViewer.

bool IG.Forms.ImageViewerControl.IsEligibleForViewing ( string  fileLocation)
inline

Rerurns a flag indicating whether the file (or web resource) at the specified location is eligible for vieiwnig in the current viewer or not.

Parameters
fileLocationPath to the file on a file system, or file URL.
Returns
True if the file can be viewed in the current viewer, false otherwise.

Implements IG.Forms.IFileViewer.

bool IG.Forms.ImageViewerControl.IsEligibleForViewing ( Stream  stream)
inline

Returnns a flag indicating whether the specified stream is eligible for vieiwnig or not.

Parameters
streamPath to the file on a file system, or file URL.
Returns
True if the stream can be viewed in the current viewer, false otherwise.

Implements IG.Forms.IFileViewer.

void IG.Forms.ImageViewerControl.UpdateControlsVisible ( )
inlineprotected

Updates dependencies on IsControlsVisible.

void IG.Forms.ImageViewerControl.BrowseFile ( )
inline

Opens a browser to select the file shown.

Available only when IsBrowsable property is true.

Implements IG.Forms.IFileViewer.

void IG.Forms.ImageViewerControl.UpdateBrowsable ( )
inlineprotected

Updates dependencies on IsBrowsable.

void IG.Forms.ImageViewerControl.UpdateDragAndDrop ( )
inlineprotected

Updates dependencies on IsDragAndDrop.

void IG.Forms.ImageViewerControl.fileSelector1_FileSelected ( object  sender,
EventArgs  e 
)
inlineprivate

Triggered when file is selected by the embedded file selector control.

void IG.Forms.ImageViewerControl.pictureBox1_DragDrop ( object  sender,
DragEventArgs  e 
)
inlineprivate
void IG.Forms.ImageViewerControl.pictureBox1_DragEnter ( object  sender,
DragEventArgs  e 
)
inlineprivate
void IG.Forms.ImageViewerControl.comboSizeMode_SelectedIndexChanged ( object  sender,
EventArgs  e 
)
inlineprivate
void IG.Forms.ImageViewerControl.menuShowControls_Click ( object  sender,
EventArgs  e 
)
inlineprivate
void IG.Forms.ImageViewerControl.menuClearHistory_Click ( object  sender,
EventArgs  e 
)
inlineprivate
void IG.Forms.ImageViewerControl.comboSizeMode_Click ( object  sender,
EventArgs  e 
)
inlineprivate
void IG.Forms.ImageViewerControl.menuDragDrop_Click ( object  sender,
EventArgs  e 
)
inlineprivate
void IG.Forms.ImageViewerControl.menuBrowse_Click ( object  sender,
EventArgs  e 
)
inlineprivate
void IG.Forms.ImageViewerControl.showControlsToolStripMenuItem_Click ( object  sender,
EventArgs  e 
)
inlineprivate
void IG.Forms.ImageViewerControl.ImageViewerControl_Load ( object  sender,
EventArgs  e 
)
inlineprivate

Handles the load event of the current control.

override void IG.Forms.ImageViewerControl.Dispose ( bool  disposing)
inlineprotected

Clean up any resources being used.

Parameters
disposingtrue if managed resources should be disposed; otherwise, false.
void IG.Forms.ImageViewerControl.InitializeComponent ( )
inlineprivate

Required method for Designer support - do not modify the contents of this method with the code editor.

Member Data Documentation

List< PictureBoxSizeMode > IG.Forms.ImageViewerControl._availableSizeModes = Util.GetEnumValues<PictureBoxSizeMode>()
protected
PictureBoxSizeMode IG.Forms.ImageViewerControl._sizeMode = PictureBoxSizeMode.CenterImage
private
string IG.Forms.ImageViewerControl._viewedFile
protected
bool IG.Forms.ImageViewerControl._closeStreamAfterUse = false
private
Stream IG.Forms.ImageViewerControl._stream
protected
bool IG.Forms.ImageViewerControl._isShownImmediately = true
protected
bool IG.Forms.ImageViewerControl._canViewFiles = true
protected
bool IG.Forms.ImageViewerControl._canViewUrls = true
protected
bool IG.Forms.ImageViewerControl._canViewStreams = true
protected

Whether the current viewer can read streams.

bool IG.Forms.ImageViewerControl._isControlsVisible = true
private
bool IG.Forms.ImageViewerControl._isBrowsable = true
protected
bool IG.Forms.ImageViewerControl._isDragAndDrop = true
protected
System ComponentModel IContainer IG.Forms.ImageViewerControl.components = null
private

Required designer variable.

System Windows Forms PictureBox IG.Forms.ImageViewerControl.pictureBox1
private
IG Forms FileSelector IG.Forms.ImageViewerControl.fileSelector1
private
System Windows Forms Panel IG.Forms.ImageViewerControl.pnlOptions
private
System Windows Forms Label IG.Forms.ImageViewerControl.lblSzeMode
private
System Windows Forms ComboBox IG.Forms.ImageViewerControl.comboSizeMode
private
System Windows Forms Panel IG.Forms.ImageViewerControl.pnlPicture
private
System Windows Forms ContextMenuStrip IG.Forms.ImageViewerControl.contextMenuMain
private
System Windows Forms Panel IG.Forms.ImageViewerControl.pnlOuter
private
System Windows Forms Panel IG.Forms.ImageViewerControl.pnlControls
private
System Windows Forms ToolStripMenuItem IG.Forms.ImageViewerControl.menuClearHistory
private
System Windows Forms ToolStripMenuItem IG.Forms.ImageViewerControl.menuOptions
private
System Windows Forms ToolStripMenuItem IG.Forms.ImageViewerControl.menuDragDrop
private
System Windows Forms ToolStripMenuItem IG.Forms.ImageViewerControl.menuBrowse
private
System Windows Forms ToolStripMenuItem IG.Forms.ImageViewerControl.menuShowControls
private

Property Documentation

PictureBoxSizeMode IG.Forms.ImageViewerControl.SizeMode
getset

Enumeraton of type PictureBoxSizeMode that specifies how the image is sized and positioned witin the PictureBox control.

string IG.Forms.ImageViewerControl.ViewedFile
getset

Gets or sets path to the file or URL of the file that is currently being viewed.

Whether it is actually shown depends on the IsShownImmediately flag).

Stream IG.Forms.ImageViewerControl.ViewedStream
getset

Gets or sets the stream containing the file that is currently being viewed.

Whether it is actually shown depends on the IsShownImmediately flag).

bool IG.Forms.ImageViewerControl.IsShownImmediately
getset

Flag that specifies whether content is shown immediately after the viewed object is set.

If set to true and the viewer does not at all have such capability, this should NOT throw an exception (thus, user should check success by verifying if flag changed).

bool IG.Forms.ImageViewerControl.CanViewFiles
getset

Whether the current viewer can view files from the file system.

bool IG.Forms.ImageViewerControl.CanViewUrls
getset

Whether the current viewer can view web resources (files on the internet).

bool IG.Forms.ImageViewerControl.CanViewStreams
getset
bool IG.Forms.ImageViewerControl.IsControlsVisible
getset

Gets / sets a flag that specified whether the viewer's controls are visible or not.

Setting should have immediate effect and make controls visible / invisible.

This is important because viewers must be able to be used embedded in other controls, where all behavior is handled by those controls and viewer just provides the viewing area.

bool IG.Forms.ImageViewerControl.IsBrowsable
getset

Gets or sets the flag specifying whether one can browse for the file to be opened (e.g. by using the file selection dialog).

If the viewer does not at all have browser capability then setting to true should not throw an exception (therefore, the user should verify by getter if setting actually worked).

Setter can be used to disable drag & drop (e.g. for security, or when used as embedded control and drag & drop would be disturbing). If the viewer does not at all have drag & drop capability, setting this flag to true should NOT throw an exception (thus, user should check if it was successful).

bool IG.Forms.ImageViewerControl.IsDragAndDrop
getset

Whether the viewer provides drag & drop capability.

If the viewer does not at all have browser capability then setting to true should not throw an exception (therefore, the user should verify by getter if setting actually worked).

Setter can be used to disable drag & drop (e.g. for security, or when used as embedded control and drag & drop would be disturbing). If the viewer does not at all have drag & drop capability, setting this flag to true should NOT throw an exception (thus, user should check if it was successful).


The documentation for this class was generated from the following files: