Results 1 to 4 of 4

Thread: Is it possible to drag a line control at runtime?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2005
    Posts
    283

    Is it possible to drag a line control at runtime?

    Hi,
    Is it possible to drag a line control at runtime similar to picturebox or image? If it is possible then what can be an appropriate strategy? As far as I know, Line control does not have any intrinsic Mouse events in it (Mouse Down/Move/Up etc.) Is it possible to simulate the mouse events with user defined functions in order to implement the drag and drop a Line Control?

  2. #2
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: Is it possible to drag a line control at runtime?

    Yeah, by not using a Line Control at all. You oughta try drawing a line on the UserForm, and using the forms mouse events for that. Of course you are gonna need a Timer or a loop to clear the window, draw, and repeat.

  3. #3
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: Is it possible to drag a line control at runtime?

    How about placing a picture of the line in a Image Control, setting its BoarderStyle to none, and using the Image Controls Events.

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Is it possible to drag a line control at runtime?

    You can use a label resized to the height of the line thickness you want then size the width to the length you need. Set its backcolor your desired color. Using the Label control to replicate a line will give you the mouse events you need to move it around.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width