How do I change the cursor for a control
Try button1.Cursor = new System.Windows.Forms.Cursor(@’C:\winnt\cursors\hnodrop.cur’);
How do I do XOR-type-drawing (SetROP2-Function in MFC) in GDI+
GDI+ doesn’t support ROP codes like XOR. To use XOR drawing mode, interop with GDI.
How can I draw font samples from the available fonts
James DeBroeck of Microsoft gave this response on the microsoft.public.dotnet.framework.windowsforms. Here is some C# OnPaint code that will show you how to use FontFamily to get a list of fonts: protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { int i, nCount; SolidBrush b = new SolidBrush( Color.Black ); int x = 0, y = 0; nCount = FontFamily.Families.Length; for(i=0;i 0) StylesDesc = StylesDesc.Substring(0,StylesDesc.Length-1); f = new Font( FontFamily.Families[i].Name, 12, fs); String s = FontFamily.Families[i].Name + ‘ ‘ + StylesDesc; e.Graphics.DrawString( s, f, b, x, y ); y += f.Height; } }
How can I fill a combobox with available fonts
Try comboBox1.Items.AddRange(FontFamily.Families);
Is there any way to get to the Edit control or the editHandle of a ComboBox using safe code
Bill Zhang (Microsoft) responds to this question in a posting on microsoft.public.dotnet.frameworks.windowsforms newsgroup. The Frameworks classes use P/Invoke to call the GetWindow API to get the HWND internally – there is no exposed way to do this. If you wish to get the Win32 HWND, here’s the code to do it, but there is no way to get a System.Windows.Forms.Edit control from this. [DllImport(‘user32.dll’, ExactSpelling=true, CharSet=CharSet.Auto)] public static extern IntPtr GetWindow(IntPtr hWnd, int uCmd); public const int GW_CHILD = 5; if (combo.DropDownStyle != ComboBoxStyle.DropDownList) { IntPtr hwnd = GetWindow(combo.Handle, NativeMethods.GW_CHILD); if (hwnd != IntPtr.Zero) { editHandle = hwnd; } }