C# 自定义一个可用(enable)不可用(disable)的button

C# 自定义一个可用(enable)不可用(disable)的button,第1张

<input type="button" id="Enable"value ="按钮" disabled="disabled"/>

加上disabled="disabled" 就变成不可用了 不加就是可用的

void CButtonST::DrawItem(LPDRAWITEMSTRUCT lpDIS)

下面用到三个函数都需要你改写,注意最后一个参数就是disable状态

DrawTheIcon

DrawTheBitmap

DrawTheText

你可能要做三件事情

1.添加或者修改buttonst接口 增加disable状态的icon/bitmap设置

2.m_csBitmaps结构里保存对应的icon/bitmap

3.模拟其他两种状态的绘制 依葫芦画瓢把你的disable状态下的位图贴上去

CButton m_buttonStop//.h文件

DDX_Control(pDX, IDC_STOP, m_buttonStop)//.cpp文件DoDataExchange中

m_buttonStop.EnableWindow(FALSE)//其它方法中设置不可用


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/bake/11526509.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-16
下一篇 2023-05-16

发表评论

登录后才能评论

评论列表(0条)

保存