Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old August 3rd, 2003, 11:34 AM
toughcoder toughcoder is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 49 toughcoder User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 33 sec
Reputation Power: 6
Send a message via Yahoo to toughcoder
Unhappy how to resize a borderless form like a sizable form?

i have a borderless form. I want to resize it using the mouse just like a form with a border. The thing is, the resizing should just look like the resizing of a sizable form. I mean, when u drag a sizable form, a rectangle indicates the virtual size of the form, after u let go the mouse button, the form rersizes to that position. I want to know how to get that rectangle to define the size the form is gonna assume. I hope i have made myself clear. The problem is a little tricky one. Plz help me.

Reply With Quote
  #2  
Old August 4th, 2003, 12:57 AM
Pi Man Pi Man is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 27 Pi Man User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 37 m 10 sec
Reputation Power: 0
I don't know how to make it so that you drag a rectangle indicating the region that the window will take up, but I can make it resize while you are dragging it.

This will take some work, but bare with me.

I will tell you to add chunks of code to certain parts of your code, and subs. If the subs don't exist, create them (by selecting them from the dropdown box on the right as you look as the code window.)

Add the following code to the general section of the form's module (before all of the subs and functions)

Code:
Const borderwidth = 10
Private xlresize As Boolean
Private xrresize As Boolean
Private ytresize As Boolean
Private ybresize As Boolean

note: borderwidth can be changed to anything you want. It defines how many pixels the border is (how wide the region is that you must click on to drag the size of the window)

Add the following code to the Form_MouseDown() sub

Code:
xrresize = False
xlresize = False
ytresize = False
ybresize = False
If X > Width - Screen.TwipsPerPixelX * borderwidth Then
 xrresize = True
End If
If X < Screen.TwipsPerPixelX * borderwidth Then
 xlresize = True
End If
If Y > Height - Screen.TwipsPerPixelY * borderwidth Then
 ybresize = True
End If
If Y < Screen.TwipsPerPixelY * borderwidth Then
 ytresize = True
End If


add the following code to the Form_MouseMove() sub:

Code:
If Button = vbLeftButton Then
 If xrresize And X > Screen.TwipsPerPixelX * borderwidth * 2 Then
  Width = X
 End If

 If xlresize And Width - X > Screen.TwipsPerPixelX * borderwidth * 2 Then
  Width = Form1.Width - X
  Left = Form1.Left + X
 End If

 If ybresize And Y > Screen.TwipsPerPixelY * borderwidth Then
  Height = Y
 End If

 If ytresize And Height - Y > Screen.TwipsPerPixelY * borderwidth * 2 Then
  Height = Height - Y
  Top = Top + Y
 End If
End If
 MousePointer = 0
 If X > Width - Screen.TwipsPerPixelX * borderwidth Or X < Screen.TwipsPerPixelX * borderwidth Then
  MousePointer = 9
 End If
 If Y > Height - Screen.TwipsPerPixelY * borderwidth Or Y < Screen.TwipsPerPixelY * borderwidth Then
  MousePointer = 7
 End If
 If (X > Width - Screen.TwipsPerPixelX * borderwidth And Y > Height - Screen.TwipsPerPixelY * borderwidth) Or (X < Screen.TwipsPerPixelX * borderwidth And Y < Screen.TwipsPerPixelY * borderwidth) Then
  MousePointer = 8
 End If
 If (X > Width - Screen.TwipsPerPixelX * borderwidth And Y < Screen.TwipsPerPixelY * borderwidth) Or (X < Screen.TwipsPerPixelX * borderwidth And Y > Height - Screen.TwipsPerPixelY * borderwidth) Then
  MousePointer = 6
 End If


I haven't taken the time to test it thoroughly, but it should work. Be sure to let me know how it worked for you.

Last edited by Pi Man : August 4th, 2003 at 12:59 AM.

Reply With Quote
  #3  
Old August 5th, 2003, 01:20 PM
Pi Man Pi Man is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 27 Pi Man User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 37 m 10 sec
Reputation Power: 0
Did it work for you?

Reply With Quote
  #4  
Old August 7th, 2003, 12:20 PM
toughcoder toughcoder is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 49 toughcoder User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 33 sec
Reputation Power: 6
Send a message via Yahoo to toughcoder
Hello PiMan, thanx for the effort & help, but actually i need the resize rectangle. Without, my whole aim is lost. But thanx once again for the help. Ur a real sport...

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > how to resize a borderless form like a sizable form?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway