A few C questions

Hi guys. I'm writing a basic script in C# and there's a few areas where I am stuck, and I was wondering if you may be able to help me?

1) Can you embed an image into the source code so it will show in the windows GUI?
2) Can you change the background of the GUI?
3) How do you add an .ico to the source code so the icon looks better then the boring standard box and the top left image changes in the GUI?

If it helps here is my source code so far;

using System ;
using System.Windows.Forms ;

public class login
{
	static TextBox txt1 = new TextBox() ;
	static TextBox txt2 = new TextBox() ;
	static Button btn1 = new Button() ;
	static Label sysMsg = new Label() ;
	static Label usrMsg = new Label() ;
	static Label pwdMsg = new Label() ;
		
	public static void Main()
	{
		Form frmMain = new Form() ;
		frmMain.Text = "Login Client" ;
		frmMain.StartPosition = FormStartPosition.CenterScreen ;
		frmMain.Closed += new EventHandler(frmMain_Closed) ;
		
		txt1.Location = new System.Drawing.Point(100,10) ;
		txt2.Location = new System.Drawing.Point(100,50) ;
		
		btn1.Text = "Login" ;
		btn1.Location = new System.Drawing.Point(10,100) ;
		btn1.Click += new EventHandler(btn1_Click) ;
		
		usrMsg.Text = "Username" ;
		usrMsg.AutoSize = true ;
		usrMsg.Location = new System.Drawing.Point(10,15) ;
		
		pwdMsg.Text = "Password" ;
		pwdMsg.AutoSize = true ;
		pwdMsg.Location = new System.Drawing.Point(10,55) ;
		
		sysMsg.Text = " " ;
		sysMsg.AutoSize = true ;
		sysMsg.Location = new System.Drawing.Point(10,130) ;
		
		frmMain.Controls.Add( txt1 ) ;
		frmMain.Controls.Add( txt2 ) ;
		frmMain.Controls.Add( btn1 ) ;
		frmMain.Controls.Add( sysMsg ) ;
		frmMain.Controls.Add( usrMsg ) ;
		frmMain.Controls.Add( pwdMsg ) ;
		
		frmMain.Show() ;
		
		Application.Run() ;
		
	}
	
	private static void frmMain_Closed( object sender, System.EventArgs e)
	{
		Application.Exit() ;
	}
	
	private static void btn1_Click( object s, System.EventArgs e)
	{
		sysMsg.Text = ( txt1.Text.Equals( String.Empty ) ) ? "Incorrect Username or Password" : "Logging in..." ;
	}
}

Cheers
Jamie

C# is a compiled language so it's normally not called a script, instead it is referred to as source code.

Also, it's a Microsoft invention, so you might want to check the URL of the forum you are posting on.

That said, there may well be people here who can help.

According to several (old) posts by Neo, the UNIX in URL stands for "Universal Internet eXchange" of information so you can ask C# questions here. It is true, however, that you may not get too many people with C# knowledge on this site.

After approximately 30 seconds of searching on google I found the answer to all 3 of your questions.

1 & 2) Add image to Button : Button : GUI Windows Form : C# / C Sharp examples (example source code) Organized by topic

3) Adding tray icons and context menus - The Code Project - C# Programming

the link for 1 & 2 will point you in the right direction. To be honest I do more middle-tier work in C# and test builds with NUnit so I don't know too much about these nice pretty picture thingys that Front End developers deal with :slight_smile: I've done more GUI related work in Java with Swing/AWT and looking over C# there are quite a number of similarities. With C# it looks a whole lot easier to develop GUIs but then again, try deploying your C# app to a Unix box of some description :cool: well without Wine anyway.

Sounds like a fudge to me. :slight_smile:

However I don't think SCO will bother to sue.

The legal right to this domain has already been established, so there is no scope for SCO or anyone else to sue.

This discussion is not relevent to the original question asked, this topic and since the original question also answered, this thread, are closed.