Solved

How can I make the image I drag on the picture semi transparent

Posted on 2009-07-03
6
332 Views
Last Modified: 2012-05-07
How do I refresh the picture to remove the semi transparent overlays
How do I move the semi transparent over lays
you gave me code on how to drag pictures on top of each other
you had suggested just dragging a rubberband around and the redrawing in the spot it is dropped
below is the code that you gave me slightly modified
Private Sub Newpicture(ByVal location As Point, ByVal img As Image)
        Dim pic As New PictureBox
               pic.Image = img 'Image.FromFile("C:\Documents and Settings\Dov\My Documents\My Pictures\brains upload.bmp")
        AddHandler pic.MouseUp, AddressOf pic_Mouseup
        AddHandler pic.MouseDown, AddressOf pic_MouseDown
        AddHandler pic.MouseMove, AddressOf pic_MouseMove
        Me.Controls.Add(pic)
        pic.Parent = PictureBox1
        pic.BringToFront()
        pic.Location = location
        pictureb.Add(pic)
 Private Sub pic_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
        If e.Button = Windows.Forms.MouseButtons.Left Then
            startPt = New Point(e.X, e.Y)
        End If
    End Sub
    Private Sub pic_mouseup(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
        If e.Button = Windows.Forms.MouseButtons.Left Then
            For Each ctl As Control In pictureb
                If (Not (ctl Is sender)) AndAlso (sender.Bounds.IntersectsWith(ctl.Bounds)) Then
                    MsgBox("l") ' ...you have a "collision"...
                End If
            Next
 
        End If
    End Sub
 
    Private Sub pic_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
        If e.Button = Windows.Forms.MouseButtons.Left Then
            Dim pic As PictureBox = CType(sender, PictureBox)
            pic.Location = New Point(pic.Location.X + (e.X - startPt.X), pic.Location.Y + (e.Y - startPt.Y))
        End If
    End Sub

Open in new window

0
Comment
Question by:Dov_B
  • 3
  • 3
6 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 24831165
Hey Dov_B,

Sorry I haven't gotten to this sooner.   =\

The overlay code in the related question is NOT compatible with the code in this question.

There are two mutually exclusive approaches:
(1) Transparency thru floating windows (each PictureBox in its own form).
(2) Transparency thru composite imaging (as demonstrated in the related question).

With #2, you only have ONE PictureBox and all the different images are drawn into a single image.  The code in this question is creating multiple PictureBoxes.

Do you want to extend the RELATED question code so that you can move around the images?
...or heavily modify this code to demonstrate #1?
0
 

Author Comment

by:Dov_B
ID: 24839911
Thank you for your help
I probably dont know enough to answer your question
what my gut instinct tells me is to go with the simplest method
let me tell you a bit more what I have in mind
I have one large image onto which I want to overlay smaller images
I could probably just group the smaller images on the edge of the form
click the one I wish to select
then click on the spot on the larger image where I want to overlay it
then just have the code which you used to mix the images into one picturebox do its thing
how would I do that?
then I guess when I wanted to remove the overlays I would simply empty the picture box and reload the original background image
0
 

Author Comment

by:Dov_B
ID: 24839956
I would like if possible to have just say some kind of square the size of the image to follow the mouse movements over the background image so that the user sees where he is going to end up putting it
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:Dov_B
ID: 24910279
I want to extend the RELATED question code so that you can move around the images
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 24910310
I'll see if I can code something up for you this week...   =)
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 24940117
Apologies Dov_B...I keep letting this one slide to the bottom of my "inbox".  =\

Just been busy this week running around w/ the kids as it's summertime.

I promise to get something on this posted soon!
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
get column names from table in vb.net 8 52
VB.NET 2008 Publish Error 2 34
Import MySQL data into MS Access using VB.Net interface 5 31
System.net.Sockets Error 5 28
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

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