so i have a several arrayed image boxes and i want the user during run time to be able to resize it.. would anyone know how?
THANK YOU!!!
7 1326
so i have a several arrayed image boxes and i want the user during run time to be able to resize it.. would anyone know how?
I guess you need to decide what sort of interface you have in mind to allow the user to resize an image.
If I remember correctly, you're using VB6?
Under the assumption that you are using VB6, here's a little sample I just banged together. I'm a bit surprised it worked as well as it did. Just create a new project with a form, add a picture box, and paste this into the code window for the form (replacing whatever is already there). - Option Explicit
-
DefLng A-Z
-
-
Private MouseDown_X As Single, MouseDown_Y As Single
-
Private MouseDown_Width As Single, MouseDown_Height As Single
-
-
-
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
-
MouseDown_X = X
-
MouseDown_Y = Y
-
MouseDown_Width = Picture1.Width
-
MouseDown_Height = Picture1.Height
-
End Sub
-
-
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
-
Static Busy As Boolean
-
If Not Busy Then
-
Busy = True
-
If Button And vbLeftButton Then
-
ResizePicture X, Y
-
End If
-
Busy = False
-
End If
-
End Sub
-
-
Private Sub ResizePicture(X As Single, Y As Single)
-
Dim NewWidth As Single, NewHeight As Single
-
NewWidth = MouseDown_Width + (X - MouseDown_X)
-
NewHeight = MouseDown_Height + (Y - MouseDown_Y)
-
Picture1.Width = NewWidth
-
Picture1.Height = NewHeight
-
DoEvents
-
End Sub
Thank You I Will Try This Code =]
IT does works but, if there are several images boxes and instead of a form you have a picture box as your work area? how can i resize it?
IT does works but, if there are several images boxes and instead of a form you have a picture box as your work area? how can i resize it?
The fact that they reside within a picturebox shouldn't really make any difference.
If there are a bunch of images, a couple of ideas come to mind for tracking them... - You could encode the "mousedown details" into the Tag property for each image, so that you don't have to store them somewhere else.
- Perhaps the simplest thing is to make the images a control array, and create a form-level variable array to keep the info relating to them. For example...
- Private Type ImageStuff
-
X As Single
-
Y As Single
-
Width As Single
-
Height As Single
-
End Type
-
Private ImageDetails() As ImageStuff
-
' You will need to decide how many elements you want in the above array,
-
' based on the size of your control array.
-
'
-
' ...
-
'
-
Private Sub Image1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
-
With ImageDetails(Index)
-
.X = X
-
.Y = Y
-
.Width = Picture1.Width
-
.Height = Picture1.Height
-
End With
-
End Sub
-
-
Private Sub Image1_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
-
Static Busy As Boolean
-
If Not Busy Then
-
Busy = True
-
If Button And vbLeftButton Then
-
ResizePicture Index, X, Y
-
End If
-
Busy = False
-
End If
-
End Sub
-
'
-
' ...
-
'
-
Private Sub ResizeImage(Index As Integer, X As Single, Y As Single)
-
With ImageDetails(Index)
-
Image1(Index).Move .Width + (X - .X), .Height + (Y - .Y)
-
End With
-
DoEvents
-
End Sub
Keep in mind, I just wrote this code right here, so it may need a little debugging.
THANK YOU, I'll try this one out
THANK YOU, I'll try this one out
Good luck. Let us know how it works out.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: lawrence |
last post by:
Can someone please tell me where I can get some open source code for
resizing images? I know such code has been written a million times and
I don't feel like doing it again from scratch.
|
by: Matthias Czapla |
last post by:
Hi!
I want to resize uploaded GIF images. Currently I do it like this:
<?php
// ...
$img = imagecreatefromgif($path);
$img_scaled = imagecreate($new_width, $new_height);...
|
by: Alex Hopson |
last post by:
I'm using the code below to loop through some images and resize each image
twice, once to create a thumbnail and once to create a small image.
The page stops loading around the 38th image out of...
|
by: riki |
last post by:
Hi,
i have a big problem...i'm using one jscript for resizing of all of my pics
in popUp...in main html i'm having many little pics and clicking on them
they open in popUp and resize to larger...
|
by: Bryan R. Meyer |
last post by:
Hello Everyone,
The problem of browser resizing has become an issue for me. While
redesigning my webpage, I set the left and right margins to be auto so
that my content would be centered. ...
| |
by: Jon Yeager |
last post by:
I need to display a bunch of pictures that are all of various dimensions
into a fixed dimension space, like MSN Messenger does with its user photos
in the chat windows.
Forcing image dimensions...
|
by: Jim |
last post by:
I've heard that resizing images through PHP (either GD2 or ImageMagick)
is a processor intensive exercise. I'm setting up a site where users
will be uploading up to 10 images along with the details...
|
by: Ron Vecchi |
last post by:
I am using asp.net to upload an image and then perform resizing on it and
saving the different sizes to file.
The resized images were coming up and being displayed in the bowser fine but
the image...
|
by: tomasio |
last post by:
Dear NG,
years have passed and I am still more designer than programmer. I
build a new version of my website which has a few nasty bugs,
especially on my startpage: Resizing text brakes the...
|
by: mishrarajesh44 |
last post by:
hii all,
I am facing a problem currently..
i have a script for image uploading and resizing..
the image uploading takes place properly for every size images..
but, the resizing works for...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |