Solved

Graphics Selection

Posted on 1998-09-23
3
138 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
[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
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

710 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