/********************************************************************************************* * Copyright 2002 - Volian Enterprises, Inc. All rights reserved. * Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE * ------------------------------------------------------------------------------ * $Workfile: ImageDialog.cs $ $Revision: 2 $ * $Author: Kathy $ $Date: 1/08/03 10:24a $ * * $History: ImageDialog.cs $ * * ***************** Version 2 ***************** * User: Kathy Date: 1/08/03 Time: 10:24a * Updated in $/LibSource/ctlXMLEditLib * added header *********************************************************************************************/ using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; namespace ctlXMLEditLib { /// /// Summary description for ViewImage - View Image pops up a dialog /// which contains a display of the image file. /// public class ImageDialog : System.Windows.Forms.Form { private System.Windows.Forms.PictureBox roImage; private System.Windows.Forms.Button btnClose; /// /// Required designer variable. /// private System.ComponentModel.Container components = null; public ImageDialog(string filename) { // // Required for Windows Form Designer support // InitializeComponent(); Image.GetThumbnailImageAbort myCallback = new Image.GetThumbnailImageAbort(ThumbnailCallback); Bitmap bm = new Bitmap(filename); SizeF sizef = new SizeF(bm.Width/bm.HorizontalResolution, bm.Height/bm.VerticalResolution); // 504 & 384 is the size of the image window (roImage). float fscale = Math.Min(504/sizef.Width,384/sizef.Height); sizef.Width *= fscale; sizef.Height *= fscale; Image thmb = bm.GetThumbnailImage((int)sizef.Width, (int)sizef.Height, myCallback, IntPtr.Zero ); this.roImage.Image = thmb; } public bool ThumbnailCallback() { return false; } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if(components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.roImage = new System.Windows.Forms.PictureBox(); this.btnClose = new System.Windows.Forms.Button(); this.SuspendLayout(); // // roImage // this.roImage.Location = new System.Drawing.Point(32, 8); this.roImage.Name = "roImage"; this.roImage.Size = new System.Drawing.Size(504, 384); this.roImage.TabIndex = 0; this.roImage.TabStop = false; // // btnClose // this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.btnClose.Font = new System.Drawing.Font("Tahoma", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.btnClose.Location = new System.Drawing.Point(240, 432); this.btnClose.Name = "btnClose"; this.btnClose.Size = new System.Drawing.Size(112, 24); this.btnClose.TabIndex = 1; this.btnClose.Text = "Close"; // // ImageDialog // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(568, 477); this.Controls.AddRange(new System.Windows.Forms.Control[] { this.btnClose, this.roImage}); this.Name = "ImageDialog"; this.Text = "View Image"; this.ResumeLayout(false); } #endregion } }