Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

picture sizes

Posted on 1999-07-16
10
Medium Priority
?
151 Views
Last Modified: 2012-05-05
how can i enable a user to change the size of an image box at run time by clicking on it and dragging a side or corner out
0
Comment
Question by:beebop
[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
10 Comments
 
LVL 2

Accepted Solution

by:
s_lavie earned 200 total points
ID: 1525389
set stretch = true.
on Click event change the width & height values.
same on DragDrop event.
0
 
LVL 2

Expert Comment

by:BeedleGuis
ID: 1525390
just and idea ..  use another form, make the image box the same size, then in the form_resize event resize the image box to be the same size
0
 
LVL 2

Expert Comment

by:BeedleGuis
ID: 1525391
your question got me curious, so I created my idea as stated before:  Copy the following text to notepad, then save as form1.frm:
VERSION 5.00
Begin VB.Form Form1
   Caption         =   "Form1"
   ClientHeight    =   4035
   ClientLeft      =   60
   ClientTop       =   360
   ClientWidth     =   6420
   LinkTopic       =   "Form1"
   ScaleHeight     =   4035
   ScaleWidth      =   6420
   StartUpPosition =   3  'Windows Default
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const HWND_NOTOPMOST = -2
Private Const HWND_TOPMOST = -1
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1

Private Sub Form_GotFocus()
Form2.Top = Me.Top + Me.Height / 2
Form2.Left = Me.Left + Me.Width / 2
SetWindowPos Form2.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE
End Sub

Private Sub Form_Load()
Form2.Show
Form2.Top = Me.Top + Me.Height / 2
Form2.Left = Me.Left + Me.Width / 2
SetWindowPos Form2.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE
End Sub

Private Sub Form_LostFocus()
Form2.Top = Me.Top + Me.Height / 2
Form2.Left = Me.Left + Me.Width / 2
SetWindowPos Form2.hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE
End Sub

Private Sub Form_Resize()
Form2.Top = Me.Top + Me.Height / 2
Form2.Left = Me.Left + Me.Width / 2
End Sub


then copy the next text and save as form2.frm:

VERSION 5.00
Begin VB.Form Form2
   ClientHeight    =   3180
   ClientLeft      =   60
   ClientTop       =   60
   ClientWidth     =   4680
   ClipControls    =   0   'False
   ControlBox      =   0   'False
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   Moveable        =   0   'False
   ScaleHeight     =   3180
   ScaleWidth      =   4680
   StartUpPosition =   1  'CenterOwner
   Begin VB.Image Image1
      Height          =   3180
      Left            =   0
      Picture         =   "Form2.frx":0000
      Stretch         =   -1  'True
      Top             =   15
      Width           =   4695
   End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Form_Load()

End Sub

Private Sub Form_Resize()
Image1.Width = Me.Width
Image1.Height = Me.Height
Image1.Top = 0
Image1.Left = 0
End Sub


add both to a project and set form1 as startup

You may want to add more checking, to make sure form2 does not get sized beyond form1 and so forth . .. but it's a start.
0
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.

 

Author Comment

by:beebop
ID: 1525392
the answer didn't really show an understanding of what I was after, maybe I didnt make myself clear. I've increased the points as the comments from Beedleguis were excellent. It worked and he knew exactly what I wanted.
0
 
LVL 2

Expert Comment

by:BeedleGuis
ID: 1525393
hmmm . . then why did you accept s_lavie's answer?
0
 

Author Comment

by:beebop
ID: 1525394
Sorry, its the first time i've used this, I wasn't sure what to do. I didnt realise the points went to the person. Can you explain how it works and I won't make the mistake again, if theres anyway of changing or reversing it then let me know and i'll gladly do that. It seems ridiculous that s_lavie should get the points for his answer. I could have given his answer, it was obvious.
0
 
LVL 2

Expert Comment

by:BeedleGuis
ID: 1525395
It's alright ..  next time just reject the worng answer.. then ask the expert with the right answer to lock your question.   It would be nice if you'd post a free question in the customer service area describing the situation,  that way points will be awarded where the are earned.  By the way,  did you get your sizable image working correctly?  I can provide more help if needed.  Make sure to include the q#Q.10183728 if you post a request in customer service.
0
 

Author Comment

by:beebop
ID: 1525396
OK beedleGuis next time Ill try and get it right. Yes your answer worked well, initially there was a problem with loading the image box on form2, so I deleted it and added another and it worked fine. Ive posted a question on customer service.
thanks for your help.
0
 
LVL 2

Expert Comment

by:BeedleGuis
ID: 1525397
0
 
LVL 3

Expert Comment

by:darinw
ID: 1525398
BeedleGuis: Please post an answer to http://www.experts-exchange.com/bin/EQ.10184674

darinw
darin@experts-exchange

[My email notification is currently not working]
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

715 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