8
Answers

help in making a program

lolz lolz

lolz lolz

16y
2.7k
1
Here is the GUI:

[URL=http://img403.imageshack.us/my.php?image=guessawordjo5.jpg][IMG]http://img403.imageshack.us/img403/4409/guessawordjo5.th.jpg[/IMG][/URL]


I am making a program, same as hang man, a word guessing game.

This program is for the player to guess a word consists of 4 alphabets.
When the player guess correctly, a '0' will show in the list box with the correct position of the word.
When the player guess wrongly, a 'X' will show in the list box with the correct position of the word.
When the player guess correctly the word, a message will appear tellin the player the number of tries.
Answers (8)
0
RahamanT

RahamanT

NA 6 0 20y
I am working on the same type of project. So far, I have been able to have the user type in the full path of a directory and then have the directory contents searched for all the files with the type I want and upload them all (without preserving directory structure though). I have removed the unnecessary functions from the program, so you may see some references to non-existant functions. They were mostly used for updating a database, so they are unnecessary. Basically, all I did was use Directory.GetDirectories (currDir) and Directory.GetFiles (currDir) to find out if there were any subdirectories or files in the directory. If there were directories, I would recurse each directory until I found one without any subdirectories. Then, if there were files, I would upload them. I do appreciate any help in creating a GUI for the form. Currently, I am having serious problems trying to use events with dynamically created objects. Any help is appreciated. Objects used: TextBox txtFolder Button btnSubmit Here is the code: using System; using System.IO; using System.Collections; using System.ComponentModel; using System.Data; using System.Data.SqlClient; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; namespace FolderUploadTest { public class WebForm1 : System.Web.UI.Page { protected System.Web.UI.WebControls.TextBox txtFolder; protected System.Web.UI.WebControls.Button btnSubmit; int intAID; int intCID; string A_Folder; string C_Folder; private void Page_Load(object sender, System.EventArgs e) { intAID = 24; //Album ID set for testing intCID = 35; //Category ID set for testing A_Folder = getAlbumFolder (); C_Folder = getCategoryFolder (); } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.btnSubmit.Click += new System.EventHandler(this.btnSubmit_Click); this.Load += new System.EventHandler(this.Page_Load); } #endregion private void btnSubmit_Click(object sender, System.EventArgs e) { if (testEntry (txtFolder.Text)) uploadFolder (txtFolder.Text); } private bool testEntry (string testDir) { if (Directory.Exists (testDir)) { return true; } return false; } public bool ThumbnailCallback () { return false; } //KEY PART!!! private void uploadFolder (string currDir) { string [] dirInfo = null; string [] fileInfo = null; dirInfo = Directory.GetDirectories (currDir); fileInfo = Directory.GetFiles (currDir); foreach (string counter in dirInfo) { uploadFolder (counter); } foreach (string counter in fileInfo) { uploadImage (counter); } return; } private void uploadImage (string currFile) { string strLongFilePath = currFile; string strFileName = ""; System.Drawing.Image newImg = System.Drawing.Image.FromFile (currFile); int counter = 0; //Isolate filename from path while (counter < strLongFilePath.Length) { strFileName = (strLongFilePath [counter].Equals ('\\')? "" : strFileName + strLongFilePath [counter]); counter++; } string thumbFileName = "thumb" + strFileName; string path = "C:\\inetpub\\www\\photoGallery\\images\\" + C_Folder + "\\" + A_Folder + "\\"; string ThumbPath = "C:\\inetpub\\www\\photoGallery\\images\\" + C_Folder + "\\" + A_Folder + "\\Thumbs\\"; } private void validImage (string currFile, string thumbFileName, string path, string ThumbPath, string strFileName) { int imageHeight; int imageWidth; System.Drawing.Image fullSizeImg; fullSizeImg = System.Drawing.Image.FromFile (currFile); fullSizeImg.Save (path + strFileName, System.Drawing.Imaging.ImageFormat.Jpeg); imageWidth = (fullSizeImg.Width * (40 / 100)); imageHeight = (fullSizeImg.Height * (40 / 100)); System.Drawing.Image.GetThumbnailImageAbort dummyCallBack = new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback); System.Drawing.Image thumbNailImg; thumbNailImg = fullSizeImg.GetThumbnailImage (imageWidth, imageHeight, dummyCallBack, IntPtr.Zero); thumbNailImg.Save (ThumbPath + thumbFileName); return; } } }
Next Recommended Forum