Solved

Sizing an MFC Control

Posted on 2001-08-13
2
521 Views
Last Modified: 2013-11-20
Designing an MFC control, and in the OnSize event attempting to limit the height of the control. But when i run the control in VB the sizing boxes dont snap back to restrict the size.

- Tried subclassing (overriding IsSubclassedControl), didnt make any difference.
- Tried SetWindowPos and SetControlSize. Worked in ActiveX test container but not in VB.

Thanks
Simon
0
Comment
Question by:sdjefferies
2 Comments
 

Author Comment

by:sdjefferies
ID: 6379884
Found a solution by using the OnDraw event. Not sure if this is the correct method, but it works.

How do i remove the width and height properties? so its a fixed size control?
0
 
LVL 1

Accepted Solution

by:
mupchu777 earned 15 total points
ID: 6434527
You can't remove the width and height properties as they are part of all controls (all controls are windows and all windows have a height and a width property).  The solution in OnDraw is probably what I would recommend and is probably correct.  Im not sure if the control is a owner draw control.  If it is use the OnMeasureItem event.  This event is called initially by the parent window to size controls.  I hope this helps.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Host to IP 7 82
Change owner from userA to server Local Administrators 7 71
notReplace  challenge 53 151
lucky13 challenge 11 157
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

680 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question