标签:ble 它的 time bool plain public keyword orm disabled
[System.Runtime.InteropServices.DllImport(
"user32.dll "
)]
public
static
extern
int
SetWindowLong(IntPtr hWnd,
int
nIndex,
int
wndproc);
[System.Runtime.InteropServices.DllImport(
"user32.dll "
)]
public
static
extern
int
GetWindowLong(IntPtr hWnd,
int
nIndex);
public
const
int
GWL_STYLE = -16;
public
const
int
WS_DISABLED = 0x8000000;
public
static
void
SetControlEnabled(Control c,
bool
enabled)
{
if
(enabled)
{ SetWindowLong(c.Handle, GWL_STYLE, (~WS_DISABLED) & GetWindowLong(c.Handle, GWL_STYLE)); }
else
{ SetWindowLong(c.Handle, GWL_STYLE, WS_DISABLED + GetWindowLong(c.Handle, GWL_STYLE)); }
}
private
void
button2_Click(
object
sender, System.EventArgs e)
{
SetControlEnabled(
this
.button1,
false
);
this
.button1.ForeColor = Color.White;
}
winform控件在Enable=false的情况下改变它的字体颜色
标签:ble 它的 time bool plain public keyword orm disabled
原文地址:http://www.cnblogs.com/candyzhmm/p/6055343.html