Hi all
I would appreciate some help with a program I have written from the Sams
teach your self c# book.
I have checked my code several times and even rewritten it.
when I compile (Sharp develop) I get the following error :
------ Build started: Project: Pic view 2 Configuration: Debug ------
Performing main compilation...
c:\Documents and Settings\Chris\My Documents\SharpDevelop Projects\Pic view
2\fclsViewer.cs(106,28): error CS0246: The type or namespace name 'Image'
could not be found (are you missing a using directive or an assembly
reference?)
Build complete -- 1 errors, 0 warnings
The code I have written is below. Any help would be greatly appreciated.
Thanks
Chris
.............................................................................
.............................................................................
.............................................................................
..................
/*
* Created by Sharp.
* User: Chris
* Date: 16/08/2004
* Time: 15:50
*
* To change this template use Tools | Options | Coding | Edit Standard
Headers.
*/
using System;
using System.Windows.Forms;
namespace DefaultNamespace
{
/// <summary>
/// Description of fclsViewer.
/// </summary>
public class fclsViewer : System.Windows.Forms.Form
{
private System.Windows.Forms.Button btnSelectPicture;
private System.Windows.Forms.Button btnQuit;
private System.Windows.Forms.PictureBox picShowPicture;
private System.Windows.Forms.OpenFileDialog ofdSelectPicture;
public fclsViewer()
{
//
// The InitializeComponent() call is required for Windows Forms designer
support.
//
InitializeComponent();
//
// TODO: Add constructor code after the InitializeComponent() call.
//
}
[STAThread]
public static void Main(string[] args)
{
Application.Run(new fclsViewer());
}
#region Windows Forms Designer generated code
/// <summary>
/// This method is required for Windows Forms designer support.
/// Do not change the method contents inside the source code editor. The
Forms designer might
/// not be able to load this method if it was changed manually.
/// </summary>
private void InitializeComponent() {
System.Resources.ResourceManager resources = new
System.Resources.ResourceManager(typeof(fclsViewer));
this.ofdSelectPicture = new System.Windows.Forms.OpenFileDialog();
this.picShowPicture = new System.Windows.Forms.PictureBox();
this.btnQuit = new System.Windows.Forms.Button();
this.btnSelectPicture = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// ofdSelectPicture
//
this.ofdSelectPicture.Filter = "Windows Bitmaps|*.Bmp|JPEG Files|*.jpg";
this.ofdSelectPicture.Title = "Select Picture";
//
// picShowPicture
//
this.picShowPicture.BorderStyle =
System.Windows.Forms.BorderStyle.FixedSingle;
this.picShowPicture.Location = new System.Drawing.Point(8, 8);
this.picShowPicture.Name = "picShowPicture";
this.picShowPicture.Size = new System.Drawing.Size(282, 275);
this.picShowPicture.TabIndex = 2;
this.picShowPicture.TabStop = false;
//
// btnQuit
//
this.btnQuit.Location = new System.Drawing.Point(301, 40);
this.btnQuit.Name = "btnQuit";
this.btnQuit.Size = new System.Drawing.Size(85, 23);
this.btnQuit.TabIndex = 1;
this.btnQuit.Text = "Quit";
this.btnQuit.Click += new System.EventHandler(this.BtnQuitClick);
//
// btnSelectPicture
//
this.btnSelectPicture.Location = new System.Drawing.Point(301, 10);
this.btnSelectPicture.Name = "btnSelectPicture";
this.btnSelectPicture.Size = new System.Drawing.Size(85, 23);
this.btnSelectPicture.TabIndex = 0;
this.btnSelectPicture.Text = "Select Picture";
this.btnSelectPicture.Click += new
System.EventHandler(this.BtnSelectPictureClick);
//
// fclsViewer
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(392, 291);
this.Controls.Add(this.picShowPicture);
this.Controls.Add(this.btnQuit);
this.Controls.Add(this.btnSelectPicture);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "fclsViewer";
this.Text = "Picture Viewer";
this.ResumeLayout(false);
}
#endregion
void BtnSelectPictureClick(object sender, System.EventArgs e)
{
//Show the open files dialog box.
if (ofdSelectPicture.ShowDialog()==DialogResult.OK)
{
//Load the Pitcure into the Picture box
picShowPicture.Image = Image.FromFile(ofdSelectPicture.FileName);
this.Text=String.Concat("picture Viewer ("+ ofdSelectPicture.FileName
+")"); }
}
void BtnQuitClick(object sender, System.EventArgs e)
{
this.Close();
}
}
}