Hi, all.
I want to convert this form to a web service but my knowladge is not enough. Please help.
using System;<br />
using System.Drawing;<br />
using System.Collections;<br />
using System.ComponentModel;<br />
using System.Windows.Forms;<br />
using System.Data;<br />
using System.Data.SqlClient;<br />
<br />
namespace AlbumViewer<br />
{<br />
public class MainForm : System.Windows.Forms.Form<br />
{<br />
private System.Windows.Forms.PictureBox pictureBox;<br />
private System.Windows.Forms.MainMenu mainMenu;<br />
private System.Windows.Forms.MenuItem menuItem3;<br />
private System.Windows.Forms.TreeView treeAlbum;<br />
private System.Windows.Forms.MenuItem mnuFile;<br />
private System.Windows.Forms.MenuItem mnuOpen;<br />
private System.Windows.Forms.MenuItem mnuExit;<br />
private System.Windows.Forms.MenuItem mnuOptions;<br />
private System.Windows.Forms.MenuItem mnuSlideShow;<br />
private System.Data.SqlClient.SqlConnection sqlConn;<br />
<br />
private System.Windows.Forms.OpenFileDialog FileOpenDlg;<br />
private System.Windows.Forms.MenuItem mnuAddPhoto;<br />
private System.Windows.Forms.MenuItem mnuRenameAlbum;<br />
private System.Windows.Forms.MenuItem mnuDeleteAlbum;<br />
private System.Windows.Forms.ContextMenu mnuPhotoPopup;<br />
private System.Windows.Forms.MenuItem mnuRenamePhoto;<br />
private System.Windows.Forms.MenuItem mnuDeletePhoto;<br />
private System.Windows.Forms.ContextMenu mnuAlbumPopup;<br />
private System.Windows.Forms.MenuItem mnuNewAlbum;<br />
private System.Windows.Forms.TextBox txtDesc;<br />
private System.Windows.Forms.Button btnUpdate;<br />
private System.Windows.Forms.Label lblDesc;<br />
private System.Windows.Forms.MenuItem mnuEditDesc;<br />
private System.Windows.Forms.MenuItem mnuAlbumEdit;<br />
private System.Windows.Forms.MenuItem mnuPhotoEdit;<br />
private System.Windows.Forms.ContextMenu mnuImage;<br />
private System.Windows.Forms.MenuItem menuItem1;<br />
private System.Windows.Forms.MenuItem menuItem2;<br />
<br />
private System.ComponentModel.Container components = null;<br />
<br />
[STAThread]<br />
static void Main() <br />
{<br />
Application.Run(new MainForm());<br />
}<br />
<br />
<br />
public MainForm()<br />
{<br />
InitializeComponent();<br />
<br />
LoadTree();<br />
}<br />
<br />
<br />
protected override void Dispose( bool disposing )<br />
{<br />
if( disposing )<br />
{<br />
if (components != null) <br />
{<br />
components.Dispose();<br />
}<br />
}<br />
base.Dispose( disposing );<br />
}<br />
<br />
<br />
private void MainForm_Closing(object sender, System.ComponentModel.CancelEventArgs e)<br />
{<br />
if(sqlConn.State == ConnectionState.Open)<br />
sqlConn.Close();<br />
}<br />
<br />
<br />
private void LoadTree()<br />
{<br />
try<br />
{<br />
treeAlbum.Nodes.Clear();<br />
<br />
if(sqlConn.State == ConnectionState.Closed)<br />
sqlConn.Open();<br />
<br />
if(sqlConn.State == ConnectionState.Open)<br />
{<br />
SqlCommand sqlCmd = new SqlCommand("sp_GetPhotoAlbums", sqlConn);<br />
sqlCmd.CommandType = CommandType.StoredProcedure;<br />
<br />
SqlDataReader sqlPhotoAlbum = sqlCmd.ExecuteReader();<br />
<br />
int nAlbumID = 0;
int nAlbumIndex = -1;
<br />
while( sqlPhotoAlbum.Read() )<br />
{<br />
if( nAlbumID != (int)sqlPhotoAlbum["AlbumID"] )<br />
{<br />
InsertAlbum(sqlPhotoAlbum["Album"].ToString(), (int)sqlPhotoAlbum["AlbumID"], sqlPhotoAlbum["Album_Desc"].ToString());<br />
nAlbumID = (int)sqlPhotoAlbum["AlbumID"];<br />
nAlbumIndex++;<br />
}<br />
InsertPhoto(nAlbumIndex, sqlPhotoAlbum["Photo"].ToString(), (int)sqlPhotoAlbum["PhotoID"], sqlPhotoAlbum["Photo_Desc"].ToString());<br />
}<br />
sqlPhotoAlbum.Close();<br />
}<br />
}<br />
catch(SqlException e)<br />
{<br />
MessageBox.Show(e.Message);<br />
}<br />
}<br />
<br />
<br />
private void InsertAlbum(string strName, int nAlbum, string strDesc)<br />
{<br />
try<br />
{<br />
TreeNode node = new TreeNode(strName);<br />
node.Tag = new TreeItem(ItemType.Album, nAlbum, strDesc);<br />
<br />
treeAlbum.Nodes.Add(node); <br />
}<br />
catch(Exception e)<br />
{<br />
MessageBox.Show(e.Message);<br />
}<br />
}<br />
<br />
<br />
private void InsertPhoto(int nAlbum, string strName, int nPhoto, string strDesc)<br />
{<br />
try<br />
{<br />
TreeNode node = new TreeNode(strName);<br />
node.Tag = new TreeItem(ItemType.Photo, nPhoto, strDesc);;<br />
<br />
treeAlbum.Nodes[nAlbum].Nodes.Add(node);<br />
}<br />
catch(Exception e)<br />
{<br />
MessageBox.Show(e.Message);<br />
}<br />
}<br />
<br />
<br />
private void InsertImage(ref byte[] buffer, string strName, int nAlbum)<br />
{<br />
try<br />
{<br />
SqlCommand cmd = new SqlCommand("sp_InsertPhoto", sqlConn);<br />
cmd.CommandType = CommandType.StoredProcedure;<br />
<br />
SqlParameter param = cmd.Parameters.Add("RETURN_VALUE", SqlDbType.Int);<br />
param.Direction = ParameterDirection.ReturnValue;<br />
<br />
cmd.Parameters.Add("@name", SqlDbType.VarChar).Value = strName;<br />
cmd.Parameters.Add("@image", SqlDbType.Image).Value = buffer;<br />
cmd.Parameters.Add("@album", SqlDbType.Int).Value = nAlbum;<br />
<br />
cmd.ExecuteNonQuery();<br />
<br />
int nID = (int)cmd.Parameters["RETURN_VALUE"].Value;<br />
<br />
TreeNode node = new TreeNode(strName);<br />
node.Tag = new TreeItem(ItemType.Photo, nID, "Enter description");;<br />
<br />
nID = treeAlbum.SelectedNode.Index;<br />
treeAlbum.Nodes[nID].Nodes.Add(node);<br />
}<br />
catch(Exception e)<br />
{<br />
MessageBox.Show(e.Message);<br />
}<br />
}<br />
<br />
<br />
#region Main menu handlers<br />
<br />
private void OnExit(object sender, System.EventArgs e)<br />
{<br />
Close();<br />
}<br />
<br />
<br />
private void OnNewAlbum(object sender, System.EventArgs e)<br />
{<br />
try<br />
{<br />
SqlCommand cmd = new SqlCommand("sp_NewAlbum", sqlConn);<br />
cmd.CommandType = CommandType.StoredProcedure;<br />
<br />
SqlParameter param = cmd.Parameters.Add("RETURN_VALUE", SqlDbType.Int);<br />
param.Direction = ParameterDirection.ReturnValue;<br />
<br />
cmd.Parameters.Add("@name", SqlDbType.VarChar).Value = "New Album";<br />
<br />
cmd.ExecuteNonQuery();<br />
<br />
int nID = (int)cmd.Parameters["RETURN_VALUE"].Value;<br />
<br />
TreeNode node = new TreeNode("New Album");<br />
node.Tag = new TreeItem(ItemType.Album, nID, "Enter description"); <br />
treeAlbum.Nodes.Add(node); <br />
}<br />
catch(Exception ex)<br />
{<br />
MessageBox.Show(ex.Message);<br />
} <br />
}<br />
<br />
#endregion<br />
<br />
#region Treeview handlers<br />
<br />
private void OnMouseUp(object sender, System.Windows.Forms.MouseEventArgs e)<br />
{<br />
if( e.Button == MouseButtons.Right )<br />
{<br />
TreeNode node = treeAlbum.GetNodeAt(e.X, e.Y);<br />
if(node != null)<br />
{ <br />
treeAlbum.SelectedNode = node;<br />
<br />
TreeItem item = (TreeItem)node.Tag;<br />
if( ItemType.Album == item.Type )<br />
mnuAlbumPopup.Show(treeAlbum, new Point(e.X, e.Y)); <br />
else if( ItemType.Photo == item.Type )<br />
mnuPhotoPopup.Show(treeAlbum, new Point(e.X, e.Y)); <br />
}<br />
}<br />
}<br />
<br />
<br />
private void OnAfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)<br />
{<br />
try<br />
{<br />
if( true == btnUpdate.Visible )<br />
{<br />
btnUpdate.Visible = false;<br />
txtDesc.Visible = false;<br />
lblDesc.Visible = true;<br />
}<br />
<br />
TreeItem item = (TreeItem)e.Node.Tag;<br />
<br />
if( ItemType.Album == item.Type )<br />
{<br />
lblDesc.Text = item.Desc;
pictureBox.Image = null;
return;<br />
}<br />
<br />
ShowPhoto(item);<br />
}<br />
catch(Exception ex)<br />
{<br />
MessageBox.Show(ex.Message);<br />
}<br />
}<br />
<br />
private void OnAfterLabelEdit(object sender, System.Windows.Forms.NodeLabelEditEventArgs e)<br />
{<br />
try<br />
{<br />
TreeItem item = (TreeItem)treeAlbum.SelectedNode.Tag;<br />
<br />
string strCmd;<br />
if( ItemType.Album == item.Type )<br />
strCmd = String.Format("UPDATE Albums SET name = '{0}' WHERE id = {1}", e.Label, item.Id);<br />
else<br />
strCmd = String.Format("UPDATE Photos SET name = '{0}' WHERE id = {1}", e.Label, item.Id);<br />
<br />
SqlCommand cmd = new SqlCommand(strCmd, sqlConn);<br />
cmd.ExecuteNonQuery();<br />
}<br />
catch(Exception ex)<br />
{<br />
MessageBox.Show(ex.Message);<br />
} <br />
}<br />
<br />
<br />
private void OnKeyUp(object sender, System.Windows.Forms.KeyEventArgs e)<br />
{<br />
if( Keys.F2 == e.KeyCode )<br />
treeAlbum.SelectedNode.BeginEdit();<br />
}<br />
<br />
#endregion<br />
<br />
#region Context menu handlers<br />
private void OnRename(object sender, System.EventArgs e)<br />
{<br />
treeAlbum.SelectedNode.BeginEdit();<br />
}<br />
<br />
<br />
private void OnAddPhoto(object sender, System.EventArgs e)<br />
{<br />
if( DialogResult.OK == FileOpenDlg.ShowDialog() )<br />
{<br />
TreeItem item = (TreeItem)treeAlbum.SelectedNode.Tag;<br />
<br />
foreach( string file in FileOpenDlg.FileNames )<br />
{<br />
System.IO.FileStream stream = new System.IO.FileStream(file, System.IO.FileMode.Open, System.IO.FileAccess.Read);<br />
byte[] buffer = new byte[stream.Length];<br />
stream.Read(buffer, 0, (int)stream.Length);<br />
stream.Close();<br />
<br />
string strName = System.IO.Path.GetFileNameWithoutExtension(file);<br />
<br />
InsertImage(ref buffer, strName, item.Id);<br />
buffer = null;<br />
}<br />
treeAlbum.SelectedNode = treeAlbum.SelectedNode.LastNode;<br />
}<br />
}<br />
<br />
private void OnDelete(object sender, System.EventArgs e)<br />
{<br />
try<br />
{<br />
TreeItem item = (TreeItem)treeAlbum.SelectedNode.Tag;<br />
<br />
int nIndex = treeAlbum.SelectedNode.Index;<br />
<br />
string strCmd;<br />
if( ItemType.Album == item.Type )<br />
strCmd = String.Format("DELETE FROM Albums WHERE id = {0}", item.Id);<br />
else<br />
strCmd = String.Format("DELETE FROM Photos WHERE id = {0}", item.Id);<br />
<br />
SqlCommand cmd = new SqlCommand(strCmd, sqlConn);<br />
cmd.ExecuteNonQuery();<br />
<br />
TreeNode node = null;<br />
switch(item.Type)<br />
{<br />
case ItemType.Photo:<br />
node = treeAlbum.SelectedNode.NextNode;<br />
if( null == node )<br />
node = treeAlbum.SelectedNode.PrevNode;<br />
<br />
if( null == node )<br />
node = treeAlbum.SelectedNode.Parent;<br />
<br />
treeAlbum.Nodes[treeAlbum.SelectedNode.Parent.Index].Nodes.RemoveAt(nIndex);<br />
break;<br />
<br />
case ItemType.Album:<br />
node = treeAlbum.SelectedNode.NextNode;<br />
if( null == node )<br />
node = treeAlbum.SelectedNode.PrevNode;<br />
<br />
pictureBox.Image = null;<br />
<br />
treeAlbum.Nodes.RemoveAt(nIndex);<br />
break;<br />
}<br />
<br />
if( null != node )<br />
treeAlbum.SelectedNode = node;<br />
}<br />
catch(Exception ex)<br />
{<br />
MessageBox.Show(ex.Message);<br />
} <br />
}<br />
<br />
<br />
private void OnEditDesc(object sender, System.EventArgs e)<br />
{<br />
btnUpdate.Visible = true;<br />
txtDesc.Visible = true;<br />
lblDesc.Visible = false;<br />
<br />
txtDesc.Text = lblDesc.Text;<br />
}<br />
<br />
#endregion<br />
<br />
private void ShowPhoto(TreeItem item)<br />
{<br />
try<br />
{<br />
string strCmd = String.Format("SELECT photo FROM Photos WHERE id = {0}", item.Id);<br />
SqlCommand cmd = new SqlCommand(strCmd, sqlConn);<br />
<br />
lblDesc.Text = item.Desc;<br />
<br />
byte[] b = (byte[])cmd.ExecuteScalar();<br />
if(b.Length > 0)<br />
{<br />
System.IO.MemoryStream stream = new System.IO.MemoryStream(b, true);<br />
stream.Write(b, 0, b.Length);<br />
<br />
DrawToScale(new Bitmap(stream));<br />
<br />
stream.Close();<br />
}<br />
}<br />
catch(Exception e)<br />
{<br />
MessageBox.Show(e.Message);<br />
}<br />
}<br />
<br />
private void OnUpdate(object sender, System.EventArgs e)<br />
{<br />
try<br />
{<br />
TreeItem item = (TreeItem)treeAlbum.SelectedNode.Tag;<br />
<br />
string strCmd;<br />
if( ItemType.Album == item.Type )<br />
strCmd = String.Format("UPDATE Albums SET [desc] = '{0}' WHERE id = {1}", txtDesc.Text, item.Id);<br />
else<br />
strCmd = String.Format("UPDATE Photos SET [desc] = '{0}' WHERE id = {1}", txtDesc.Text, item.Id);<br />
<br />
SqlCommand cmd = new SqlCommand(strCmd, sqlConn);<br />
cmd.ExecuteNonQuery();<br />
<br />
item.Desc = txtDesc.Text;<br />
<br />
lblDesc.Text = txtDesc.Text;<br />
<br />
btnUpdate.Visible = false;<br />
txtDesc.Visible = false;<br />
lblDesc.Visible = true;<br />
}<br />
catch(Exception ex)<br />
{<br />
MessageBox.Show(ex.Message);<br />
} <br />
}<br />
<br />
private void DrawToScale(Image bmp)<br />
{<br />
Rectangle rc = pictureBox.ClientRectangle;<br />
<br />
SizeF size = new SizeF( bmp.Width / bmp.HorizontalResolution, bmp.Height / bmp.VerticalResolution);<br />
float fScale = Math.Min( rc.Width / size.Width, rc.Height / size.Height);<br />
<br />
size.Width *= fScale;<br />
size.Height *= fScale;<br />
<br />
pictureBox.Image = new Bitmap(bmp, size.ToSize());<br />
}<br />
<br />
#region Windows Form Designer generated code<br />
private void InitializeComponent()<br />
{<br />
this.treeAlbum = new System.Windows.Forms.TreeView();<br />
this.mnuAlbumPopup = new System.Windows.Forms.ContextMenu();<br />
this.mnuAddPhoto = new System.Windows.Forms.MenuItem();<br />
this.mnuAlbumEdit = new System.Windows.Forms.MenuItem();<br />
this.mnuRenameAlbum = new System.Windows.Forms.MenuItem();<br />
this.mnuDeleteAlbum = new System.Windows.Forms.MenuItem();<br />
this.pictureBox = new System.Windows.Forms.PictureBox();<br />
this.mnuImage = new System.Windows.Forms.ContextMenu();<br />
this.menuItem1 = new System.Windows.Forms.MenuItem();<br />
this.menuItem2 = new System.Windows.Forms.MenuItem();<br />
this.mainMenu = new System.Windows.Forms.MainMenu();<br />
this.mnuFile = new System.Windows.Forms.MenuItem();<br />
this.mnuOpen = new System.Windows.Forms.MenuItem();<br />
this.mnuNewAlbum = new System.Windows.Forms.MenuItem();<br />
this.menuItem3 = new System.Windows.Forms.MenuItem();<br />
this.mnuExit = new System.Windows.Forms.MenuItem();<br />
this.mnuOptions = new System.Windows.Forms.MenuItem();<br />
this.mnuSlideShow = new System.Windows.Forms.MenuItem();<br />
this.mnuEditDesc = new System.Windows.Forms.MenuItem();<br />
this.sqlConn = new System.Data.SqlClient.SqlConnection();<br />
this.FileOpenDlg = new System.Windows.Forms.OpenFileDialog();<br />
this.mnuPhotoPopup = new System.Windows.Forms.ContextMenu();<br />
this.mnuRenamePhoto = new System.Windows.Forms.MenuItem();<br />
this.mnuPhotoEdit = new System.Windows.Forms.MenuItem();<br />
this.mnuDeletePhoto = new System.Windows.Forms.MenuItem();<br />
this.txtDesc = new System.Windows.Forms.TextBox();<br />
this.btnUpdate = new System.Windows.Forms.Button();<br />
this.lblDesc = new System.Windows.Forms.Label();<br />
this.SuspendLayout();<br />
this.treeAlbum.ImageIndex = -1;<br />
this.treeAlbum.LabelEdit = true;<br />
this.treeAlbum.Name = "treeAlbum";<br />
this.treeAlbum.SelectedImageIndex = -1;<br />
this.treeAlbum.Size = new System.Drawing.Size(224, 504);<br />
this.treeAlbum.TabIndex = 0;<br />
this.treeAlbum.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OnMouseUp);<br />
this.treeAlbum.KeyUp += new System.Windows.Forms.KeyEventHandler(this.OnKeyUp);<br />
this.treeAlbum.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.OnAfterSelect);<br />
this.treeAlbum.AfterLabelEdit += new System.Windows.Forms.NodeLabelEditEventHandler(this.OnAfterLabelEdit);<br />
this.mnuAlbumPopup.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {<br />
this.mnuAddPhoto,<br />
this.mnuAlbumEdit,<br />
this.mnuRenameAlbum,<br />
this.mnuDeleteAlbum});<br />
this.mnuAddPhoto.Index = 0;<br />
this.mnuAddPhoto.Text = "Add Photo";<br />
this.mnuAddPhoto.Click += new System.EventHandler(this.OnAddPhoto);<br />
this.mnuAlbumEdit.Index = 1;<br />
this.mnuAlbumEdit.Text = "Edit Description";<br />
this.mnuAlbumEdit.Click += new System.EventHandler(this.OnEditDesc);<br />
this.mnuRenameAlbum.Index = 2;<br />
this.mnuRenameAlbum.Text = "Rename";<br />
this.mnuRenameAlbum.Click += new System.EventHandler(this.OnRename);<br />
this.mnuDeleteAlbum.Index = 3;<br />
this.mnuDeleteAlbum.Text = "Delete";<br />
this.mnuDeleteAlbum.Click += new System.EventHandler(this.OnDelete);<br />
this.pictureBox.ContextMenu = this.mnuImage;<br />
this.pictureBox.Location = new System.Drawing.Point(232, 0);<br />
this.pictureBox.Name = "pictureBox";<br />
this.pictureBox.Size = new System.Drawing.Size(500, 300);<br />
this.pictureBox.TabIndex = 1;<br />
this.pictureBox.TabStop = false;<br />
this.mnuImage.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {<br />
this.menuItem1,<br />
this.menuItem2});<br />
this.menuItem1.Index = 0;<br />
this.menuItem1.Text = "Rotate Left 90";<br />
this.menuItem1.Click += new System.EventHandler(this.OnRotateLeft);<br />
this.menuItem2.Index = 1;<br />
this.menuItem2.Text = "Rotate Right 90";<br />
this.menuItem2.Click += new System.EventHandler(this.OnRotateRight);<br />
this.mainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {<br />
this.mnuFile,<br />
this.mnuOptions});<br />
this.mnuFile.Index = 0;<br />
this.mnuFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {<br />
this.mnuOpen,<br />
this.mnuNewAlbum,<br />
this.menuItem3,<br />
this.mnuExit});<br />
this.mnuFile.Text = "File";<br />
this.mnuOpen.Index = 0;<br />
this.mnuOpen.Text = "Open";<br />
this.mnuNewAlbum.Index = 1;<br />
this.mnuNewAlbum.Text = "New Album";<br />
this.mnuNewAlbum.Click += new System.EventHandler(this.OnNewAlbum);<br />
this.menuItem3.Index = 2;<br />
this.menuItem3.Text = "-";<br />
this.mnuExit.Index = 3;<br />
this.mnuExit.Text = "E&xit";<br />
this.mnuExit.Click += new System.EventHandler(this.OnExit);<br />
this.mnuOptions.Index = 1;<br />
this.mnuOptions.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {<br />
this.mnuSlideShow,<br />
this.mnuEditDesc});<br />
this.mnuOptions.Text = "Options";<br />
this.mnuSlideShow.Index = 0;<br />
this.mnuSlideShow.Text = "Slide Show";<br />
this.mnuEditDesc.Index = 1;<br />
this.mnuEditDesc.Text = "Edit Description";<br />
this.mnuEditDesc.Click += new System.EventHandler(this.OnEditDesc);<br />
this.sqlConn.ConnectionString = "data source=HOMESVR;initial catalog=Photos;integrated security=SSPI;persist secur" +<br />
"ity info=False;workstation id=DAD;packet size=4096";<br />
this.FileOpenDlg.Filter = "Gif files|*.gif|Jpeg Files|*.jpg;*.jpeg|Bmp Files|*.bmp";<br />
this.FileOpenDlg.Multiselect = true;<br />
this.FileOpenDlg.Title = "Select Photos";<br />
this.mnuPhotoPopup.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {<br />
this.mnuRenamePhoto,<br />
this.mnuPhotoEdit,<br />
this.mnuDeletePhoto});<br />
this.mnuRenamePhoto.Index = 0;<br />
this.mnuRenamePhoto.Text = "Rename";<br />
this.mnuRenamePhoto.Click += new System.EventHandler(this.OnRename);<br />
this.mnuPhotoEdit.Index = 1;<br />
this.mnuPhotoEdit.Text = "Edit Description";<br />
this.mnuPhotoEdit.Click += new System.EventHandler(this.OnEditDesc);<br />
this.mnuDeletePhoto.Index = 2;<br />
this.mnuDeletePhoto.Text = "Delete";<br />
this.mnuDeletePhoto.Click += new System.EventHandler(this.OnDelete);<br />
this.txtDesc.Location = new System.Drawing.Point(232, 312);<br />
this.txtDesc.MaxLength = 200;<br />
this.txtDesc.Multiline = true;<br />
this.txtDesc.Name = "txtDesc";<br />
this.txtDesc.Size = new System.Drawing.Size(504, 112);<br />
this.txtDesc.TabIndex = 2;<br />
this.txtDesc.Text = "";<br />
this.txtDesc.Visible = false;<br />
this.btnUpdate.Location = new System.Drawing.Point(656, 432);<br />
this.btnUpdate.Name = "btnUpdate";<br />
this.btnUpdate.TabIndex = 3;<br />
this.btnUpdate.Text = "Update";<br />
this.btnUpdate.Visible = false;<br />
this.btnUpdate.Click += new System.EventHandler(this.OnUpdate);<br />
this.lblDesc.Location = new System.Drawing.Point(232, 312);<br />
this.lblDesc.Name = "lblDesc";<br />
this.lblDesc.Size = new System.Drawing.Size(504, 112);<br />
this.lblDesc.TabIndex = 4;<br />
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);<br />
this.ClientSize = new System.Drawing.Size(792, 566);<br />
this.Controls.AddRange(new System.Windows.Forms.Control[] {<br />
this.lblDesc,<br />
this.btnUpdate,<br />
this.txtDesc,<br />
this.pictureBox,<br />
this.treeAlbum});<br />
this.Menu = this.mainMenu;<br />
this.Name = "MainForm";<br />
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;<br />
this.Text = "Album Viewer";<br />
this.Closing += new System.ComponentModel.CancelEventHandler(this.MainForm_Closing);<br />
this.ResumeLayout(false);<br />
<br />
}<br />
#endregion<br />
<br />
#region PictureBox context menu handlers<br />
private void OnRotateLeft(object sender, System.EventArgs e)<br />
{<br />
try<br />
{<br />
Image img = pictureBox.Image;<br />
img.RotateFlip(RotateFlipType.Rotate270FlipNone);<br />
DrawToScale(img);<br />
}<br />
catch(Exception ex)<br />
{<br />
MessageBox.Show(ex.Message);<br />
}<br />
}<br />
<br />
private void OnRotateRight(object sender, System.EventArgs e)<br />
{<br />
try<br />
{<br />
Image img = pictureBox.Image;<br />
img.RotateFlip(RotateFlipType.Rotate90FlipNone);<br />
DrawToScale(img);<br />
}<br />
catch(Exception ex)<br />
{<br />
MessageBox.Show(ex.Message);<br />
}<br />
}<br />
<br />
#endregion<br />
}<br />
}
|