Solved

Graphics Selection

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

759 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now