Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 142
  • Last Modified:

Graphics Selection

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
Brdsblsky
Asked:
Brdsblsky
1 Solution
 
BrdsblskyAuthor Commented:
Adjusted points to 50
0
 
fulscherCommented:
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
 
TheAnswerManCommented:
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now