How can I use the debugger paint and focus problems as the stops are always hit too early

Using dual monitors is one way to tackle this problem, but If you happen to be running on a terminal server machine there’s an even better way to do this. Create a terminal server session to your own machine and start the exe in the terminal server window. Start the debugger on the console window and attach it to the exe in the other session. This is helpful if you’re debugging paint/focus issues because then the debugger won’t steal focus from your app when a breakpoint gets hit. (from [email protected] on microsoft.public.dotnet.framework.windowsforms)

How do I add a tooltip to my Button control

From within the designer: 1) From the ToolBox, drop a ToolTip control to your form. 2) Check the properties of this toolTip1 object to make sure Active is set to true. 3) Click on your button, and in its Property page, set the ToolTip on toolTip1 entry. From code: private System.Windows.Forms.ToolTip toolTip1; …… …… this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.toolTip1.Active = true; …… …… this.toolTip1.SetToolTip(this.button1, ‘Press for information…’);

How do I create a dll/exe off a previously diassembled .il file?

You can create a dll/exe from the il file using the ilasm.exe utility. This utility is usually installed in the C:\WINNT\Microsoft.NET\Framework\v1.0.3705 (or the appropriate version no.) directory. If you want to run this utility via command line it would help if you add the above path to your Environment Path variable. Here is an example command line: // The .res resource file is optional ilasm TextProcessing.il /dll /output:TextProcessing.dll /resource:TextProcessing.res

What are the implications of using the Timer class in System.Timers as opposed to the Timer class in System.Windows.Forms

Be careful when using the Timer from System.Timers from within a Windows.Form application. Most methods in Windows Forms are not thread safe and can produce indeterminate results when called from another thread. In this case, System.Timers.Timer is much higher resolution and less affected by how busy your application is (since it doesn’t use the message pump) but it’s Tick event is fired from another thread. In order to be sure this works correctly, you’ll have to write the proper Control.Invoke code to marshal over to the thread the control was created on (the main thread) before you call methods on the control. So, in cases where you don’t need super-high-resolution and regular events to be fired, you’re much better off using System.Windows.Forms.Timer. It’s message pump is based (WM_TIMER) and will fire on the UI thread. (from [email protected] on microsoft.public.dotnet.framework.windowsforms)

How do I add support for custom scrolling to my own user control?

Windows Forms features a ScrollableControl. This will work in most cases where you know the exact dimensions of your control and scroll by pixel. See the MSDN Documentation for ScrollableControl for discussion how to use this control. Sometimes you may need more customized scrolling, for example if you implemented a text editor and you want to scroll lines and not pixels. For more customized scrolling you have to use PInvoke to access the Win32 ScrollWindow method. The following code shows how to enable access to the Win32 ScrollWindow method from your code. [StructLayout(LayoutKind.Sequential)] public struct RECT { public int left; public int top; public int right; public int bottom; public RECT(Rectangle rect) { this.bottom = rect.Bottom; this.left = rect.Left; this.right = rect.Right; this.top = rect.Top; } public RECT(int left, int top, int right, int bottom) { this.bottom = bottom; this.left = left; this.right = right; this.top = top; } } [DllImport(‘user32’)] public static extern bool ScrollWindow(IntPtr hWnd, int nXAmount, int nYAmount, ref RECT rectScrollRegion, ref RECT rectClip); void MyScrollFunc(int yAmount) { RECT r = new RECT(ClientRectangle); ScrollWindow(Handle, 0, yAmount, ref r, ref r); }