子窗口不显示自己的子项。 [英] Child window doesn't display its own children.

查看:69
本文介绍了子窗口不显示自己的子项。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!



我想首先感谢所有花时间查看此主题并尝试提供帮助的人。



我有一个带有儿童静电控制的主窗口。我已将变量命名为 hsInfo



此静态控件使用样式SS_BITMAP,SS_NOTIFY和SS_REALSIZECONTROL创建,并显示位图。它也点击它时响应。



现在我需要创建另一个静态控件,其样式与上面相同,在上面提到的静态控件之上(hsInfo) )。此静态控件名为 hsHelp



当我将 hsInfo 作为CreateWindow()中的父窗口传递给 hsHelp hsHelp 根本没有出现。

如果我点击大概出现 hsHelp 的区域,父静态控件会发送其通知,而不是 hsHelp 。似乎 hsHelp 甚至不存在。



但是,如果主窗口的句柄作为父,子传递正确绘制静态控件( hsHelp ),但无法再次捕获其通知,因为单击它会再次激活另一个通知( hsInfo )。 br $>


我的问题如下:



我应该在代码中更改一个静态控件是什么另一个静态控件的孩子?



注意:

我应该能够在用户点击它时捕获来自控件的通知消息。



我在MS Visual Studio Express 2008,Windows XP,C ++,使用WIN32 API工作。



如果需要任何其他信息(源代码或类似的东西),请求它,我将非常乐意提供它。

Hello everyone!

I would like to start by saying thanks to everyone who takes some time to view this thread and try to help.

I have a main window with a child static control. I have named the variable hsInfo.

This static control is created with styles SS_BITMAP, SS_NOTIFY and SS_REALSIZECONTROL, and displays bitmap. Also it responds when clicked on it.

Now I need to create another static control with styles same as above, to be on top of the above mentioned static control ( hsInfo ). This static control is named hsHelp.

When I pass hsInfo as the parent window in CreateWindow() for hsHelp, hsHelp doesn''t appear at all.
If I click on area where hsHelp should approximately appear, parent static control sends its notification, instead of hsHelp''s. It seems as if hsHelp doesn''t even exist.

However, if main window''s handle is passed as parent, child static control ( hsHelp ) is properly drawn, but its notifications again can''t be captured,since clicking on it activates again notification of the other one ( hsInfo ).

My question is following:

What should I change in my code to have one static control to be a child of the other static control?

NOTE:
I should be able to catch notification messages from control when user clicks on it.

I work in MS Visual Studio Express 2008, on Windows XP, in C++, using WIN32 API.

If any other information is required ( source code or something similar ), please ask for it, I will more than gladly supply it.

推荐答案

我已经解决了这个问题!



我很尴尬d我必须实际发布这样的问题!



问题在于传递给孩子的CreateWindow()函数的坐标。



我已经计算了与主窗口坐标相关的子静态控件的位置,所以我已经将300和300作为x和y坐标,希望子静态控件将位于父静态控件的左上角。



但是,我所要做的就是将0和0作为x和y坐标传递,并且子静态控件放在其父静态控件的左上角位置。



就这么简单!
I have solved this!

I am so embarrassed that I had to actually post a question like this!

The problem was in coordinates passed to the child''s CreateWindow() function.

I have calculated the positioning of a child static control related to main window''s coordinates, so I have passed 300 and 300 as x and y coordinates, hoping that the child static control will be positioned at the top left of the parent static control.

However, all I had to do is pass 0 and 0 as x and y coordinates, and the child static control was placed on top left position of its parent static control.

It was that simple!


这篇关于子窗口不显示自己的子项。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆