Solved

Graphics Selection

Posted on 1998-09-23
3
136 Views
Last Modified: 2010-04-30
I want to be able to select a certain part of a picture or graphic to move, copy, or cut. How Can I do this?
0
Comment
Question by:Brdsblsky
3 Comments
 

Author Comment

by:Brdsblsky
ID: 1436361
Adjusted points to 50
0
 
LVL 12

Expert Comment

by:fulscher
ID: 1436362
Brdsblsky,

You'll have to do this manually. I don't have a code example ready, but basically:

a) on the mouse_down event, save the current position in rStart
b) on the following mouse_up event, save the now current position in rEnd. This gives you the target rectangular.
c) use BitBlt or similar procedures to copy the selection from your form into a picture.
0
 
LVL 3

Accepted Solution

by:
TheAnswerMan earned 50 total points
ID: 1436363
Make two Form Level Variables..
Option Explicit
Dim fi_x As Integer
Dim fi_y As Integer

'------------------
Flop Two PictureBoxes on a Form...
Put a picture into the First PictureBox.
'------------------
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
fi_x = X
fi_y = Y
End Sub

Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture2.PaintPicture Picture1, 0, 0, , , IIf(X < fi_x, X, fi_x), IIf(Y < fi_y, Y, fi_y), Abs(fi_x - X), Abs(fi_y - Y)
End Sub

'The inline iif is so in case they start from the lower right and drag to the upper left..





0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

777 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