[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


Marquee to select multiple control at Run Time

Posted on 2002-07-09
Medium Priority
Last Modified: 2010-05-02
 I am writing an application that allow user to place vb control into form at Run Time. I am able to draw a marquee by using a shape.

  My problem is :
1. how to select the objects within the marquee that I have drawn

This is just like what we always did at design time when we select multiple control and move it but I want it to be done during the Run Time.

Please guide me.

Question by:sweetpillow
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 43

Expert Comment

ID: 7142947
Here is an example (not very clever) that checks whether the controls on the form are within the bounding rectangle of the shape control.

Private shpMarquee As Shape

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If (shpMarquee Is Nothing) Then
        Set shpMarquee = Me.Controls.Add("VB.Shape", "shpMarquee")
        With shpMarquee
            .Visible = True
            .Top = X
            .Left = X
        End With
    End If
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If shpMarquee Is Nothing Then Exit Sub
    On Error Resume Next
    If Button > 1 Then
        Dim ctrlToCheck As Control
        For Each ctrlToCheck In Me.Controls
            If ctrlToCheck.Left > shpMarquee.Left And ctrlToCheck.Width + ctrlToCheck.Left < shpMarquee.Left + shpMarquee.Width And ctrlToCheck.Top > shpMarquee.Top And ctrlToCheck.Top + ctrlToCheck.Height < shpMarquee.Top + shpMarquee.Height Then
                List1.AddItem ctrlToCheck.Name
            End If
    ElseIf Button = 1 Then
        With shpMarquee
            .Width = X - .Left
            .Height = Y - .Top
        End With
    End If
End Sub

Author Comment

ID: 7144975
Hi TimCottee,

  How to do like vb design time when we draw a marquee the objects within marquee will be selected and the marquee will be hidden but all the selected objects will have 8 handles ?
  Then when we click on any of the selected objects, we can move all objects at one time. I wonder if there is any windows function doing this job...

LVL 49

Expert Comment

ID: 8002254
Hi sweetpillow,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept TimCottee's comment(s) as an answer.

sweetpillow, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
DanRollins -- EE database cleanup volunteer
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Author Comment

ID: 8005385
Hi Dan,

       The comment from Tim really do not exactly stimulate what I want to do. Thats why I do not accept his comment as answer. My last comment is not answered anyway. But nevermind, I have found a solution by myself by using another picture mouse down, mouse move and mouse up to stimulate the real box when user is dragging the mouse. Thanks.

Note: By the way, I would like to know how to delete a question when I no longer wanted it ?

LVL 49

Expert Comment

ID: 8005451
In the future, you can post a 0-pt question to the Community Support Topia Area.  Be sure to identify the question by its Q# or the full URL.

For this question, you do not need to do anything because it is already in the cleanup queue.  I think that Tim Cottee's comments are worth preserving so...
Moderator,  I am changing my recommendation to:

   Refund and save as 0-pt PAQ
DanRollins -- EE database cleanup volunteer

Accepted Solution

SpideyMod earned 0 total points
ID: 8095154
per recommendation

Community Support Moderator @Experts Exchange

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

656 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