I use C# in my work and I still encounter questions that should be answered. Sometimes I am able to find an answer by myself, sometimes I search the WWW Pages or ask on many newsgroups. Below you'll find a list of questions I was looking for and was able to find an answer.
Here you'll find only answer to questions I was not able to easily find elsewhere. I will NOT duplicate other FAQs here! For other info search other FAQ pages.
Q1. How to get the path to the .NET Framework?
Q2. How to check whether a program is running from within VS.NET or as a standalone application?
Q3. How to create custom-shaped forms and controls?
Q4. How to create a custom mouse cursor?
Q1. How to get the path to the .NET Framework?
A1. Use following trick:
string msNETPath;
// this will return "file:///c:/winnt/microsoft.net/framework/v1.0.3705/mscorlib.dll"
msNETPath = typeof(object).Assembly.CodeBase;
// some additional work
msNETPath = msNETPath.Remove(0, 8);
msNETPath = Directory.GetParent(msNETPath).ToString();
Q2. How to check whether a program is running from within VS.NET or as a standalone application?
A2. Look at Debugger.IsAttached variable state
Q3. How to create custom-shaped forms and controls?
A3. Use the .Region property. For example
GraphicsPath gP = new GraphicsPath();
gP.AddEllipse ( 0, 0, this.Width, this.Height );
this.Region = new Region ( gP );
Q4. How to create a custom mouse cursor?
A4. Surprisingly, this is really easy.
// create any bitmap
Bitmap b = new Bitmap( 55, 25 );
Graphics g = Graphics.FromImage ( b );
// do whatever you wish
g.DrawString ( "myText", this.Font, Brushes.Blue, 0, 0 );
// this is the trick!
IntPtr ptr = b.GetHicon();
Cursor c = new Cursor( ptr );
// attach cursor to the form
this.Cursor = c;