如何计算看起来非常接近Winforms控件的控件的禁用文本颜色?

Joa*_*nge 2 .net c# gdi+ winforms

我正在使用从Button和Label派生的CustomButton和CustomLabel.它们具有我需要的额外功能.

视觉差异很小,但我不知道.NET如何计算Winforms禁用的颜色.

Phi*_*eck 6

您可以从System.Drawing.SystemColors中提取颜色.对于禁用控件上的标签或文本(例如),您需要等效的COLOR_GRAYTEXT(来自GetSysColor windows API),即System.Drawing.SystemColors.GrayText.

请参阅GetSysColor帮助中的系统颜色说明