Solved

Sizing an MFC Control

Posted on 2001-08-13
2
522 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Login Script to Copy Folders 12 50
Expand macro to ask for filename column 8 40
SQUD PROXY SERVER, UNIX, SLL/HTTPS 5 134
Authenticate using sesu from script 7 159
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

732 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