tags:

views:

115

answers:

3

How do i set Border properties on a TextBox Control in Winforms so that It displays sunken borders? Any ideas?

Thanks

+1  A: 

Just add the Microsoft Forms textbox Control to your toolbox.

alt text

Luiscencio
A: 

You need to remove the Application.EnableVisualStyles() call from your Program.cs file.

Jacob G
doesn't seem to work... do I need to do something extra?`EDIT`: got it working now.... the change is visible until you run your app.
Luiscencio
+1  A: 

Unusual request. But you can do it by selectively disable the theming for the control. Add a new class to your project and paste the code shown below. Compile. Drop the new control from the top of the toolbox onto your form.

using System;
using System.Windows.Forms;

class SunkenTextBox : TextBox {
  protected override void CreateHandle() {
    base.CreateHandle();
    SetWindowTheme(this.Handle, "", "");
  }
  [System.Runtime.InteropServices.DllImport("uxtheme.dll")]
  private static extern void SetWindowTheme(IntPtr hWnd, string appname, string idlist);
}
Hans Passant