OCX + WM_SIZE magic |
Post Reply |
Author | |
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
Posted: 17 January 2010 at 8:08pm |
Often when I put an OCX control inside a dialog, the border of the control is not painted correctly. I've seen this quite often, so I thought it's time to find the root cause!
The solution has always been to explicitly send a WM_SIZE message (no other trick seems to work):
CRect rect;
m_htmlCtrl.GetClientRect(rect);
m_htmlCtrl.SendMessage(WM_SIZE, SIZE_RESTORED, MAKELPARAM(rect.Width(), rect.Height()));
I tried to find the underlying problem and found out that the desired rectangle was always decreased by 4 pixels (width and height). Strange.
Any ideas? I really dislike the hack above :(
|
|
PokerMemento - http://www.pokermemento.com/
|
|
rdhd
Senior Member Joined: 13 August 2007 Location: United States Status: Offline Points: 886 |
Post Options
Thanks(0)
|
Do you add the control via the resource editor (drag and drop) or are you doing it via code? If not using the editor, try that in a sample app and then see if there are any messages such as your size message sent to the control. |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |