本文介绍了单选按钮Ownerdraw的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从CButton派生的类创建了一组四个单选按钮.创建时,我将样式设置为"WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_OWNERDRAW | BS_AUTORADIOBUTTON | WS_GROUP",其余的我将样式设置为"WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_OWNERDRAW | BS_AUbrADIOB我在按钮类中重写了DrawItem函数,但是在执行程序时绘制了按钮,但是我无法选择任何按钮,因此根本无法选择它们.
这是我正在使用的代码行

DrawFrameControl(&rect,DFC_BUTTON,DFCS_BUTTONRADIO |(((lpDrawItemStruct-> itemState&ODS_SELECTED)?DFCS_CHECKED:0));

请告诉我是否缺少任何内容.

I have created a group of four radio buttons from a class derived from CButton. While creating, I am setting the styles as "WS_CHILD | WS_VISIBLE | WS_TABSTOP |BS_OWNERDRAW | BS_AUTORADIOBUTTON | WS_GROUP" for first radio and for rest i am setting "WS_CHILD | WS_VISIBLE | WS_TABSTOP |BS_OWNERDRAW | BS_AUTORADIOBUTTON"
I have overridden the DrawItem function in the button class, but when the program is executed the buttons are drawn, but i can not select any button, they are not getting selected at all.
this is the codeline i am using

DrawFrameControl(&rect, DFC_BUTTON,DFCS_BUTTONRADIO | ((lpDrawItemStruct->itemState & ODS_SELECTED)?DFCS_CHECKED : 0));

Please tell me if i am missing anything.

推荐答案


这篇关于单选按钮Ownerdraw的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 21:37