Solved

Graphics Selection

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB 6.0 printer how to align 6 67
JSON Response and request in VB6 application 11 596
MsgBox 2 59
Error with a code discussed on this page 5 34
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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…

821 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