Leadtools.WinForms Namespace : RasterPictureBox Class |
[DefaultPropertyAttribute("Image")] [ToolboxBitmapAttribute()] [DockingAttribute(DockingBehavior.Ask)] public class RasterPictureBox : System.Windows.Forms.Control, System.ComponentModel.IComponent, System.ComponentModel.ISynchronizeInvoke, System.IDisposable, System.Windows.Forms.IBindableComponent, System.Windows.Forms.IDropTarget, System.Windows.Forms.IWin32Window
'Declaration <DefaultPropertyAttribute("Image")> <ToolboxBitmapAttribute()> <DockingAttribute(DockingBehavior.Ask)> Public Class RasterPictureBox Inherits System.Windows.Forms.Control Implements System.ComponentModel.IComponent, System.ComponentModel.ISynchronizeInvoke, System.IDisposable, System.Windows.Forms.IBindableComponent, System.Windows.Forms.IDropTarget, System.Windows.Forms.IWin32Window
'Usage Dim instance As RasterPictureBox
public sealed class RasterPictureBox : System.ComponentModel.IComponent, System.ComponentModel.ISynchronizeInvoke, IClosable //In WinRT the IDisposable interface is replaced by IClosable, System.Windows.Forms.IBindableComponent, System.Windows.Forms.IDropTarget, System.Windows.Forms.IWin32Window
function Leadtools.WinForms.RasterPictureBox()
[DefaultPropertyAttribute("Image")] [ToolboxBitmapAttribute()] [DockingAttribute(DockingBehavior.Ask)] public ref class RasterPictureBox : public System.Windows.Forms.Control, System.ComponentModel.IComponent, System.ComponentModel.ISynchronizeInvoke, System.IDisposable, System.Windows.Forms.IBindableComponent, System.Windows.Forms.IDropTarget, System.Windows.Forms.IWin32Window
Public Sub RasterPictureBox_RasterPictureBox() Dim form As MyForm1 = New MyForm1() form.ShowDialog() End Sub Private Class MyForm1 : Inherits Form Private thePictureBox As RasterPictureBox Public Sub New() ' Create the raster PictureBox thePictureBox = New RasterPictureBox() thePictureBox.Dock = DockStyle.Fill thePictureBox.BorderStyle = BorderStyle.Fixed3D thePictureBox.UseDpi = False ' Set the paint properties Dim p As RasterPaintProperties = New RasterPaintProperties() p.PaintDisplayMode = RasterPaintDisplayModeFlags.Bicubic p.PaintEngine = RasterPaintEngine.GdiPlus p.UsePaintPalette = True thePictureBox.PaintProperties = p Controls.Add(thePictureBox) thePictureBox.BringToFront() ' load an image into the viewer Dim codecs As RasterCodecs = New RasterCodecs() thePictureBox.Image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "eye.gif")) codecs.Dispose() Text = String.Format("Size mode = {0}, double click to change", thePictureBox.SizeMode) AddHandler thePictureBox.DoubleClick, AddressOf thePictureBox_DoubleClick End Sub Private Sub thePictureBox_DoubleClick(ByVal sender As Object, ByVal e As EventArgs) Select Case thePictureBox.SizeMode Case RasterPictureBoxSizeMode.Normal thePictureBox.SizeMode = RasterPictureBoxSizeMode.StretchImage Case RasterPictureBoxSizeMode.StretchImage thePictureBox.SizeMode = RasterPictureBoxSizeMode.Fit Case RasterPictureBoxSizeMode.Fit thePictureBox.SizeMode = RasterPictureBoxSizeMode.AutoSize Case RasterPictureBoxSizeMode.AutoSize thePictureBox.SizeMode = RasterPictureBoxSizeMode.CenterImage Case RasterPictureBoxSizeMode.CenterImage thePictureBox.SizeMode = RasterPictureBoxSizeMode.Normal End Select Text = String.Format("Size mode = {0}, double click to change", thePictureBox.SizeMode) MyBase.OnDoubleClick(e) End Sub End Class Public NotInheritable Class LEAD_VARS Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images" End Class
public void RasterPictureBox_RasterPictureBox() { MyForm1 form = new MyForm1(); form.ShowDialog(); } class MyForm1 : Form { RasterPictureBox thePictureBox; public MyForm1() { // Create the raster PictureBox thePictureBox = new RasterPictureBox(); thePictureBox.Dock = DockStyle.Fill; thePictureBox.BorderStyle = BorderStyle.Fixed3D; thePictureBox.UseDpi = false; // Set the paint properties RasterPaintProperties p = new RasterPaintProperties(); p.PaintDisplayMode = RasterPaintDisplayModeFlags.Bicubic; p.PaintEngine = RasterPaintEngine.GdiPlus; p.UsePaintPalette = true; thePictureBox.PaintProperties = p; Controls.Add(thePictureBox); thePictureBox.BringToFront(); // load an image into the viewer RasterCodecs codecs = new RasterCodecs(); thePictureBox.Image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir,"eye.gif")); codecs.Dispose(); Text = string.Format("Size mode = {0}, double click to change", thePictureBox.SizeMode); thePictureBox.DoubleClick += new EventHandler(thePictureBox_DoubleClick); } void thePictureBox_DoubleClick(object sender, EventArgs e) { switch (thePictureBox.SizeMode) { case RasterPictureBoxSizeMode.Normal: thePictureBox.SizeMode = RasterPictureBoxSizeMode.StretchImage; break; case RasterPictureBoxSizeMode.StretchImage: thePictureBox.SizeMode = RasterPictureBoxSizeMode.Fit; break; case RasterPictureBoxSizeMode.Fit: thePictureBox.SizeMode = RasterPictureBoxSizeMode.AutoSize; break; case RasterPictureBoxSizeMode.AutoSize: thePictureBox.SizeMode = RasterPictureBoxSizeMode.CenterImage; break; case RasterPictureBoxSizeMode.CenterImage: thePictureBox.SizeMode = RasterPictureBoxSizeMode.Normal; break; } Text = string.Format("Size mode = {0}, double click to change", thePictureBox.SizeMode); base.OnDoubleClick(e); } } static class LEAD_VARS { public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images"; }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2