将位图图像设置为静态控件 c++ Win32
我在将图像设置为静态窗口时遇到问题。
这是我的代码的一部分:
HBITMAP bitmap = (HBITMAP)LoadImage(NULL, "Tetris/Tetrominoes/T One.bmp", IMAGE_BITMAP, 20, 20, LR_LOADFROMFILE);
one = CreateWindow("Static", NULL, WS_CHILD | WS_VISIBLE | SS_BITMAP, (x-10), ((y-y)+50), 20, 20, hMain, NULL,NULL,NULL);
SendMessage(one, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)bitmap);
BringWindowToTop(one);
我不明白的是为什么它没有加载,因为我之前出于不同的目的使用过这种类型的代码。根据所有来源,这部分代码应该可以正常工作,但我的图像没有显示。如果我删除 SendMessage()
函数,我的窗口是可见的,但没有图像,当我放置 SendMessage()
时,窗口就会消失。我尝试更改图像大小窗口大小,但仍然没有任何结果。
提前致谢!
I have a problem setting an image to static window.
Here is a part of my code:
HBITMAP bitmap = (HBITMAP)LoadImage(NULL, "Tetris/Tetrominoes/T One.bmp", IMAGE_BITMAP, 20, 20, LR_LOADFROMFILE);
one = CreateWindow("Static", NULL, WS_CHILD | WS_VISIBLE | SS_BITMAP, (x-10), ((y-y)+50), 20, 20, hMain, NULL,NULL,NULL);
SendMessage(one, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)bitmap);
BringWindowToTop(one);
The thing I don't understand is why it isn't loading since I used this type of code before for different purpose. According to all sources this part of code should work fine but my image is not showing. if I remove the SendMessage()
function my window is visible but without image and when I put SendMessage()
the window just disappears. I tried chaging the image size window size and still nothing.
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论