How do I start Visual Studio.NET from the command line

Simply type devenv.exe from the command line. If you get a message like this, then you do not have devenv.exe in your path. >>> ’devenv.exe’ is not recognized as an internal or external command, operable program or batch file. >>> To fix this simply run the batch file, vsvars32.bat that comes with Visual Studio.NET from the command line in the working folder. After you run this batch file devenv.exe will be available from the command line in that folder.

What is fuslogvw.exe

When the system fails to locate an assembly, it generates a log file. Fuslogvw.exe is the viewer program that gives you access to this log. You can run this tool from a command line. This log information helps you diagnose why the .NET Framework cannot locate an assembly at run time.

How do I print a form

I am afraid there is not a very easy way to print a form. You may implement this function with the steps below: 1. Add a print function to your application. To do this, you should add a PrintDocument component to your application. Please drag a PrintDocument from the tool box to your form. After that, you should create a PrintDialog and add the code to print the document. private void buttonPrint_Click(object sender, System.EventArgs e) { PrintDialog printDialog1 = new PrintDialog(); printDialog1.Document = printDocument1; DialogResult result = printDialog1.ShowDialog(); if (result == DialogResult.OK) { printDocument1.Print(); } } For detailed information about print framework, please see ‘Windows Forms Print Support’ in the MSDN (October 2001). 2. Draw the form when printing. This step is a little complex. You should handle the PrintPage of the printDocument1 and draw the form to the printer device. In the event you may copy the form to an image and then draw it to the printer device. private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { Graphics graphic = this.CreateGraphics(); Size s = this.Size; Image memImage = new Bitmap(s.Width, s.Height, graphic); Graphics memGraphic = Graphics.FromImage(memImage); IntPtr dc1 = graphic.GetHdc(); IntPtr dc2 = memGraphic.GetHdc(); BitBlt(dc2, 0, 0, this.ClientRectangle.Width, this.ClientRectangle.Height, dc1, 0, 0, 13369376); graphic.ReleaseHdc(dc1); memGraphic.ReleaseHdc(dc2); e.Graphics.DrawImage(memImage,0,0); } The above referenced the article ‘Screen Capturing a Form in .NET – Using GDI in GDI+’ by Michael Gold. You may find it at: http://www.c-sharpcorner.com/Graphics/ScreenCaptFormMG.asp 3. Declare the API function. Please note the BitBlt function used in Step 2. It is an unmanaged function. You should use DllImportAttribute attribute to import it to your code. Although, this is the Step 3, you may perform this step any time. [System.Runtime.InteropServices.DllImportAttribute(‘gdi32.dll’)] private static extern bool BitBlt( IntPtr hdcDest, // handle to destination DC int nXDest, // x-coord of destination upper-left corner int nYDest, // y-coord of destination upper-left corner int nWidth, // width of destination rectangle int nHeight, // height of destination rectangle IntPtr hdcSrc, // handle to source DC int nXSrc, // x-coordinate of source upper-left corner int nYSrc, // y-coordinate of source upper-left corner System.Int32 dwRop // raster operation code ); For more information about DllImportAttribute attribute please see: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/ frlrfSystemRuntimeInteropServicesDllImportAttributeClassTopic.asp (from Lion Shi ([email protected]) on microsoft.public.dotnet.framework.windowsforms)

As a VC++ programmer, what should I look out for when using C#

1] The conditionals in if-statements must calculate to a boolean value. You cannot write something like if (nUnits) { … } where nUnits is a int. 2] All code must reside in a class. There are no global variables per se. 3] Bitwise & and | operators can be used with boolean types as logical operators. The && and || operators are also used, and do have the ‘short-cut calculation’ behavior found in C++. The & and | operators do not have this ”short-cut calculation’ behavior. 4] Pointers are not available in managed code. 5] In managed code, destructors are not hit immediately when as object goes out of scope. Ie, there is no deterministic destruction.