开发者

textbox in winforms with sunken border

开发者 https://www.devze.com 2022-12-23 12:54 出处:网络
How do i set Border properties on a TextBox Control in Winforms so that It displays sunken borders? Any ideas?

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

Tha开发者_开发技巧nks


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);
}


Just add the Microsoft Forms textbox Control to your toolbox.

alt text http://img262.imageshack.us/img262/2989/28550946.png


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

0

精彩评论

暂无评论...
验证码 换一张
取 消