Close Application at Press of Escape Button

There are various ways to close an application by pressing the Escape button, using C#. Here are a few: Way 1: Simply add the below given code in your Windows program: Way 2: Write the below code in the ‘KeyPress’ event of a form: Way 3: Select properties of Form and select ‘KeyPreview’  and change it from ‘false’ to ‘true’‘. [By default, its value is ‘false’] Then write the below code in the ‘KeyUp’ event of the Form: so after taking these all steps, you will able to close application at press of escape button. Article Posted in CP I’ve also posted this Read More …

Share Knowledge

Convert Text to Image Using C#

We can easily convert text to image in C# using System.Drawing Namespace. Here this article will guide you how to create a bitmap image from text. it’s using Graphics property of System.Drawing namespace to convert Text to Image. The Graphics class provides methods for drawing to display device. In this article, you will see a method Named ConvertTextToImage(string txt, string fontname, int fontsize, Color bgcolor, Color fcolor, int width, int height)  is responsible to return bitmap image on the basis of Text, fontname and fontsize, backcolor and forecolor with apporpriate width and height. Take a look how to create this Read More …

Share Knowledge

Run Only One Copy Of Application

This Article allow you to run only one Instance of application at a time. Many time we have requirement that we need to run only one instance of application at a time. If you have same requirement then in that case this article might be useful for you. Here you will learn how to handle only one instance of application by using Mutex Reference Link:- ClickHere to Reference Link Click here to Download SampleCode. After Downloading SampleCode, go to the bin directory and then click on OnlyOneInstance.Exe file twice. you will see a message box is prompted with a message Read More …

Share Knowledge

Change Opacity of Image in C#

This is a Simple Tips/Tricks which enable you to change Opacity of Image using C# by using  System.Drawing  and  System.Drawing.Imaging  NameSpaces. Take a look how ChangeOpacity(Image img, float opacityvalue) Method will enable you to change opacity of Image. In this given code System.Drawing Namespace is used to access Bitmap and Graphics classes whereas System.Drawing.Imaging Namespaces is used to access ColorMatrix and ImageAttributes. ChangeOpacity Method having two parameter including img for Image on which opaicty will be apply  and  opacityvalue for set opacity level of form. When you will use this Method in your program to change opacity of an image Read More …

Share Knowledge

Multiple Main Method in C#

In this article we will know how to handle a program with more than one entry point. All of us know the basic programming concept that is one program allow only and only one entry point i.e A Main Method. This is what normally expected. However, C# also allows you to create a program with one Entrance point its means one Main method. but it will be very sound interesting to have more than one entry point in program. yeah! we can with illegal way and Infect with weird way. have a read below article to explore more.. 🙂 What is Method :- Method Read More …

Share Knowledge