0% found this document useful (0 votes)
41 views

C#notes From Bookmarks

This document provides an analysis of the code lines in a C# program. It explains that line 1 contains the namespace, line 2 contains the class declaration, line 3 contains the main method required for all C# applications, and line 4 prints text to the console using the Console class's writeLine method. It then discusses how to work with images in C# by creating a Bitmap object and using the DrawImage method.

Uploaded by

api-3805274
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

C#notes From Bookmarks

This document provides an analysis of the code lines in a C# program. It explains that line 1 contains the namespace, line 2 contains the class declaration, line 3 contains the main method required for all C# applications, and line 4 prints text to the console using the Console class's writeLine method. It then discusses how to work with images in C# by creating a Bitmap object and using the DrawImage method.

Uploaded by

api-3805274
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

Console.

writeLine ("Hello C#");


}
}
//end of the main

Line Number wise Analysis

Line - 1: - It is called as the namespace. Simply speaking, a namespace is a collection of


.NET Classes similar to packages in Java.

Line - 2: - It is the class declaration similar to Java & C++

Line - 3: - This is the main method which is required in all C# applications.

Line - 4: - This code will print Hello C# onto the Console. Here Console is the class
belonging to System namespace and writeLine is the static method belonging to Console
Class.

Line - 5:- The Opening and Closing curly races are similar to that of C++/Java.
this.Paint+=new PaintEventHandler(Text_bru);
}
public void Text_bru(object sender,PaintEventArgs e)
{
Graphics g = e.Graphics;
g.FillEllipse(bgbrush,50,50,500,300);
}
public static void Main()
{
Application.Run(new Texturedbru());
}
// End of class
}

Working with Images

You can easily insert images by following the procedure given below

1) Create an object of Bitmap class as shown below:

Image img = new Bitmap("image1.bmp");

2) Apply the above object in DrawImage() method

g.DrawImage(img,20,20,100,90);

Conclusion

In this article, I've examined two core namespaces System.Drawing and


System.Drawing.Drawing2D by showing the usage of various methods and properties with the
help of numerous listings.

You might also like