Quantcast
Channel: VBForums - CodeBank - Visual Basic 6 and earlier
Viewing all articles
Browse latest Browse all 1449

VB - SnipSnap: Copy/Cut & Paste Image Areas

$
0
0
Earlier versions of this were called "MaskoMania" but a lot has been cleaned up and additional functionality added.

Basically it is a UserControl to be hosted within a container control with a bitmap image. The user can "lasso" a rectangle to be cut or copied, dragged then pasted.

Code:

'Mouse Actions:
'-------------
'
'When Enabled = True the mouse performs the following actions.  When Enabled = False
'the events pass through with no processing.
'
'On the container:
'
'  Left-click to clear the selection.
'
'  Left-drag then release to establish the selection and copy or cut from the
'  container's bitmap.  See the Cutting property.  A cut operation backfills with
'  the MaskColor.  A very small drag acts like a click.
'
'  Shift-left-click makes Masking = False.
'
'  Shift-right-click to choose the color under the mouse as MaskColor and make
'  Masking = True.
'
'On the control:
'
'  Left-drag to move the control.
'
'  Shift-left-click makes Masking = False.
'
'  Right-click pastes the contents of the control into the container bitmap.
'
'  Shift-right-click to choose the color under the mouse as MaskColor and make
'  Masking = True.

Masking is used to designate a transparent color. Minimalist demo:

Name:  sshot.png
Views: 18
Size:  9.3 KB

There is also another demo in the attachment. It covers a wider set of features available, like passing a snippet from one container to another or loading an external file as a snippet.
Attached Images
 
Attached Files

Viewing all articles
Browse latest Browse all 1449

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>