Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 158
  • Last Modified:

Resize window but Ristrict to a spesific size

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
Jawaid
Asked:
Jawaid
1 Solution
 
Éric MoreauSenior .Net ConsultantCommented:
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
 
hazgodCommented:
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
 
supunrCommented:
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
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!

 
supunrCommented:
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
 
JawaidAuthor Commented:
This not THE best way, "Supunr" and "emoreau" in your coding do resize from top right corner then see whats happen?
0
 
ChimoCommented:
0
 
CleanupPingCommented:
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
 
GPrentice00Commented:
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
 
PashaModCommented:
Question closed and points not refunded

PashaMod
CS Moderator
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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