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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Suggested Courses

801 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