?
Solved

Resize window but Ristrict to a spesific size

Posted on 2003-03-16
9
Medium Priority
?
157 Views
Last Modified: 2010-04-07
Hi!

How to restrict a window to resize to a specific size(by using API), I mean window can resize but in a limit e.g. 400x400pix?
0
Comment
Question by:Jawaid
[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
9 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 8146613
without using APIs, you can write code into the Resize event of your form like this:

if me.width < 400 then me.width = 400
if me.heigth < 400 then me.heigth = 400
0
 
LVL 1

Expert Comment

by:hazgod
ID: 8148265
you want those to be > 400. otherwise if the window is less than 400 it will be increased to 400 but will still allow size to go greater than 400x400
0
 
LVL 11

Expert Comment

by:supunr
ID: 8148492
emoreau solution is correct.

Private Sub Form_Resize()
    if (WindowState = vbMinimized) then Exit Sub

    if width < 4000 then me.width = 4000 'twips
    if heigth < 4000 then me.heigth = 4000 ' twips

    ' rest of resize code
End Sub

Good LUck!
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 11

Expert Comment

by:supunr
ID: 8148509
if you want your width and height in terms of pixels, change the scale mode to 3 ' pixel.  This way, you can put 400 instead of 4000 or similar twip value (Note: 4000 twips is not equivalent to 400 pixels)
0
 

Author Comment

by:Jawaid
ID: 8149147
This not THE best way, "Supunr" and "emoreau" in your coding do resize from top right corner then see whats happen?
0
 

Expert Comment

by:Chimo
ID: 8185179
0
 

Expert Comment

by:CleanupPing
ID: 8532262
Hi Jawaid,
This old question (QID 20552517) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
0
 
LVL 6

Expert Comment

by:GPrentice00
ID: 8956454
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

-->PAQ - with points refunded

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

GPrentice00
EE Cleanup Volunteer
0
 

Accepted Solution

by:
PashaMod earned 0 total points
ID: 9012170
Question closed and points not refunded

PashaMod
CS Moderator
0

Featured Post

Independent Software Vendors: 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!

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month8 days, 2 hours left to enroll

765 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