Wrox Programmer Forums
|
.NET 4 and Visual Studio 2010 General Discussions For discussing anything about .NET 4, WPF, WCF, the rest of the .NET 4 Framework, and Visual Studio 2010 that isn't about a specific Wrox book. Please post code questions about a specific language (C#, VB, ASP.NET, etc) in the correct language forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET 4 and Visual Studio 2010 General Discussions section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 13th, 2011, 03:40 AM
Registered User
 
Join Date: Oct 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dynamically adding pictureboxes as required

I created a Picturebox array for adding pictures at run time.I also added a mousemove event for it.but now the problem is when i move a picbox1 after creating picbox2 ,picbox2 simply dissappears.Same goes on while adding picboxes,the just previous ones get dissappeared.This is event handler code i wrote


Code:
 Private Sub PictureBox1_MouseMove1(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
        Dim sX As Integer = RectangleToClient(New Rectangle(Windows.Forms.Cursor.Position.X, Windows.Forms.Cursor.Position.Y, 1, 1)).Left - oControlOffsetPoint.X
        Dim sY As Integer = RectangleToClient(New Rectangle(Windows.Forms.Cursor.Position.X, Windows.Forms.Cursor.Position.Y, 1, 1)).Top - oControlOffsetPoint.Y
        For i As Integer = 0 To x
            If e.Button = Windows.Forms.MouseButtons.Left Then
                sender.Location = New Point(sX, sY)
                PicBoxArray(x).Left = sX
                PicBoxArray(x).Top = sY
            End If
        Next
    End Sub

Last edited by sneha; October 13th, 2011 at 03:45 AM..





Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamically Adding webpart kamal BOOK: Professional Web Parts and Custom Controls ASP.NET ISBN: 0-7645-7860-X 0 April 27th, 2009 03:00 AM
Events - Adding Dynamically dash dev C# 2005 2 December 5th, 2007 02:05 PM
Adding Controls Dynamically andyj00 C# 0 March 19th, 2007 08:54 AM
dynamically adding objects shawnvb VB How-To 3 February 14th, 2007 03:12 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.