Fixed Vertex point, but draggable user control.

skea

Newcomer
Joined
Nov 25, 2009
Messages
22
(C#) Fixed Vertex point, but draggable user control.

I need help...
I would like to have a user control with a vertex like "those balloon tooltips".
I would like to call this control at any point on the screen and it pops up with a vertex at the mouse point.
Then i would like to drag this control...BUT: Keep the vertex point fixed, the size of the long arm should be the one to move.The panel size can also be fixed(assuming we are going to use a panel like UC).

So far:
I got some where and now i need [one] fix to get this resolved.
Attached herewith is a mockup of what i want.
I put it together using the code Click Here
and Click there.

Issue: I can create the Panel and the Triangular region, but i am failing to drag the panel together with the triangular region. The issue as i indicated in the code is in the event handler, the drag cant seem to be called. I tried to step through and all tricks but am failing. Any help will be appreciated.

regards.
 

Attachments

Last edited:
Re: (C#) Fixed Vertex point, but draggable user control.

I think the problem is down to the fact the panel is handling the dragging and as such the event is never getting raised. It might be easier to associate the triangle with the panel directly and manage it's position as part of the panel movement.

I might have a bit of free time later and will have a look if it turns out I do.
 
Re: (C#) Fixed Vertex point, but draggable user control.

A bit of a rough example (doesn't invalidate the previous triangle yet for starters) should get you started though. I will try to tidy it up a bit more when I get chance though.
 

Attachments

Man,thanks for the effort mate. I see it coming.
i also notice that almost the samething happens when i want to remove a panel.
I can remove the one i have just inserted but not the previous.

Anyway, let me wait with what you will come up with.
 
Re: Fixed Vertex point, but draggable user control.(Balloon Identifier)

let me give this a name. From now on, it will be called a "Balloon Identifier"
I got it working. I just added a refresh method for the parent after moving/resizing the panel and it did the trick.

In the ResizablePanel on MouseDown Event, Below the switch statement. I added this.
Code:
      case MousePos.Move:
                    {
                        NativeCalls.ReleaseCapture(hwnd);
                        NativeCalls.SendMessage(hwnd, NativeCalls.WM_SYSCOMMAND, NativeCalls.SC_DRAGMOVE, ref nul);
                        
                    } break;
                default:
                    break;
            }
            this.Parent.Refresh();------->Added

But now....the Removal of the Panels when there is more than one "Balloon Identifier" on the form.
ToDO:Turn the Panel into an Ellipse of some sort.

Thanks mate.
 
Last edited:
Today is a good day for me! I got the removal of the "Balloon Identifier" to work too.
Todo:
1)Making it in form of an ellipse(rectangle with curves at the corners) is remaining.
2)If some one clicks in the middle of the screen area, the triangle draws with its intersection in the "middle left" of the panel(Balloon).
And if the user clicks in an area almost next to the bottom of the screen, the intersection is "bottom left" of the balloon.
3)Triangle should be drawn with variable points at the center of the balloon implying a "longer length" for its arm.(this is to make it look ok if the use drags it from one direction to another.)
 
Last edited:
Complete! Any thing added by anyone will be appreciated.
Thanks PlausiblyDamp for all the time and effort. You have given me reason to stay on this forum.

regards.
 

Attachments

Ha ha ha...how does this look?
The only issue is to "BringToFront" the triangle of the focused panel when it overlays on top of another panel.
 

Attachments

Last edited:
Thanks so much.
As you can see, i have added a close button, instead of using a context menu.

My issue now is bringing the triangle to the front when a corresponding panel is passed over another panel.
 
The triangle fixed point moves away from the orignal location when i click and drag the balloon. How can i overcome this?

regards.
 

Attachments

Last edited:
The problem seems to be down to the pen width, if you reduce the width from 3 down to one then the problem is minimized, you might need to reduce the triangle size slightly based on the pen size and see if that helps.
 
Hi. It isn't the problem of the pen and the size of the triangle. If you place a small picture of a point on the form and you try it, you will notice what i am talking about. And when the form is zoomed in, the distance of tolerance is too big.
 
Odd, when I was playing around with it on my PC I had it draw the pixel for the fixed point in black and it kept a constant position on the form despite the triangle's end point moving around. When I reduced the pen width the end of the triangle seemed to be closer to this point and the movement reduced.
 
Hi, you are right. i was debugging and starting another .exe. Sorry for that. It does the trick.i changed the pen to width 0, except that i seem to loose my borderline(which i wanted so much). Now i will try to make it zoomable.thanks.
 
Last edited:
I managed to get back the borderline by using another pen to draw other two lines from the fixed point to the variable points.
 
What is still puzzling me is how i can bring the triangle to front when i drag a panel to sit over another. Please be of help.
 
Back
Top