Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

基于windows gdi+的常用自绘控件 #1

Closed
Humorly opened this issue Feb 21, 2019 · 14 comments
Closed

基于windows gdi+的常用自绘控件 #1

Humorly opened this issue Feb 21, 2019 · 14 comments

Comments

@Humorly
Copy link
Owner

Humorly commented Feb 21, 2019

1:通过对UI(CDialog(CWnd) -> CButton(CImageButton) -> CRaidoButton -> CCheckButton -> CSpinButton -> CComboBox -> CStatic)等的重绘,实现MFC常用控件的自定义。

@Humorly
Copy link
Owner Author

Humorly commented Feb 21, 2019

123 2

@Qianzujin
Copy link

跑不动呀,大佬 救救我吧 我继承了一个你自绘的button类 然后再precreate那里调用了你写的set图片的路径方法,但是还是运行不了呀
image到这里就卡住了

@Qianzujin
Copy link

我是个菜鸡 救救我吧

@Humorly
Copy link
Owner Author

Humorly commented Jun 11, 2019

我是个菜鸡 救救我吧

继承自 ImageButton?可否贴出precreate里set的调用代码?

@Qianzujin
Copy link

image

@Humorly
Copy link
Owner Author

Humorly commented Jun 11, 2019

@Qianzujin SetButtonImage有没有触发断言?

@Humorly
Copy link
Owner Author

Humorly commented Jun 11, 2019

@Qianzujin 使用gdi+库需要注意先初始化gdi+对象
1.包含GdiPlusMakeUi.h -> #include "GdiPlusMakeUi.h"
image
我这里在测试窗体中包含此gdi头文件;

2.在合适的位置初始化gdi+ -> CGdiPlusMakeUi::CGdiPlusMakeUiInit();
image
在窗体的初始化中调用该初始过程;

@Humorly
Copy link
Owner Author

Humorly commented Jun 11, 2019

@Qianzujin 之后方可使用对应的自绘控件,另外button需要被自绘制的话,要设置button本身的属性为Owner Draw为true,
image

@Humorly
Copy link
Owner Author

Humorly commented Jun 11, 2019

@Qianzujin 本UI库中的所有自绘控件绘制方式,均使用Windows中的gdi+库自带的相关对象,例如gdi::image,可以看看gdi+对应的使用方式。

@Humorly Humorly changed the title windows常用自绘控件 基于windows gdi+的常用自绘控件 Jun 11, 2019
@Qianzujin
Copy link

image
搞腚了 谢谢大佬

@Qianzujin
Copy link

就是oninit哪里没有写

@Humorly
Copy link
Owner Author

Humorly commented Jun 11, 2019

image
搞腚了 谢谢大佬

image
搞腚了 谢谢大佬

(^o^)/~

@Qianzujin
Copy link

请问大佬还有没有别的自绘控件呀。。。。 你的控件我都用上了 都挺好用

@Humorly
Copy link
Owner Author

Humorly commented Jun 12, 2019

请问大佬还有没有别的自绘控件呀。。。。 你的控件我都用上了 都挺好用

木有了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants