Results 1 to 9 of 9

Thread: Shape and line controls, only a little more interactive?

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2007
    Posts
    36

    Shape and line controls, only a little more interactive?

    Colleagues,

    Are there controls that have the visual properties of a shape and line controls, and also have better mouse support, so that they can be made more interactive?

    I’m writing an application that has a process diagram. I’d like to add things like ToolTips and to make some elements on the diagram clickable.

    I know that I can put a label on a shape and it would provide the mouse support that I need. It would work for square-ish shapes, but it doesn’t work well for circles.

    - Nick

  2. #2
    Cumbrian Milk's Avatar
    Join Date
    Jan 2007
    Location
    0xDEADBEEF
    Posts
    2,448

    Re: Shape and line controls, only a little more interactive?

    Unless someone has made these already your best bet might be to make your own, either as usercontrols or as some sort of graphics class.

  3. #3
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: Shape and line controls, only a little more interactive?

    Quote Originally Posted by kender
    Colleagues,


    I know that I can put a label on a shape and it would provide the mouse support that I need. It would work for square-ish shapes, but it doesn’t work well for circles.

    - Nick
    Not true! If you code it correctly you can put a Label inside an Oval Shape and it looks a hell of a lot better than a circle. You can also write code that will autosize the shape as the label text increases and decreases.

    That said, there's a BalloonTip file using an API right here on the forum. Do a search for it in the Code Bank.
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  4. #4
    Cumbrian Milk's Avatar
    Join Date
    Jan 2007
    Location
    0xDEADBEEF
    Posts
    2,448

    Re: Shape and line controls, only a little more interactive?

    I think one of the problems are the mouse events. Click an image showing a circle and it's the images rectangle that responds. I think the OP wants a shape that raises an event only if the image has been clicked (not the rectangle)

  5. #5

    Thread Starter
    Member
    Join Date
    Jul 2007
    Posts
    36

    Re: Shape and line controls, only a little more interactive?

    Quote Originally Posted by Milk
    I think one of the problems are the mouse events. Click an image showing a circle and it's the images rectangle that responds. I think the OP wants a shape that raises an event only if the image has been clicked (not the rectangle)
    Exactly. Mouse events are the biggets problem. For a cicrle, the corners of the control rectangle shouldn't respond to mouse events.

  6. #6
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: Shape and line controls, only a little more interactive?

    Quote Originally Posted by Milk
    I think one of the problems are the mouse events. Click an image showing a circle and it's the images rectangle that responds. I think the OP wants a shape that raises an event only if the image has been clicked (not the rectangle)
    The attached Gif image consists of 1 Label, 1 Shape and a LineControl array. The whole thing expands and contracts with the text count in the Label.
    Attached Images Attached Images  
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  7. #7
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: Shape and line controls, only a little more interactive?

    Quote Originally Posted by Milk
    I think one of the problems are the mouse events. Click an image showing a circle and it's the images rectangle that responds. I think the OP wants a shape that raises an event only if the image has been clicked (not the rectangle)
    My apologies for misunderstanding the question. After sleeping on it (need more), I realize that it's not a tool tip that you want. Milk is correct when he suggested building your own shape control with events & properties that you want.
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

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

    Re: Shape and line controls, only a little more interactive?

    Just use a picturebox control with no border and flat apearance. Then use the MouseDown event to get the x, y location of the click and GetPixel API to get the pixel color associated with that point. If its got color then it was clicked on the image.
    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

  9. #9
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Shape and line controls, only a little more interactive?

    It's actually pretty easy to create a user control with a custom clickable area. Just set the BackStyle of the UserControl to 0 (transparant) and assign a MaskPicture for the area that should react to the mouse events. The transparent part (which will not react to any mouse events) will then be the any part of the MaskPicture that have the same color as the MaskColor property of the UserControl. Attached is an example.
    Attached Files Attached Files

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