• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 533
  • Last Modified:

Sizing an MFC Control

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
sdjefferies
Asked:
sdjefferies
1 Solution
 
sdjefferiesAuthor Commented:
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
 
mupchu777Commented:
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now