How to move the panel position in cTrader

We can’t drag & drop the panel in cTrader, but what if I want to change the panel position just like a drag & drop? ok, I will show you how to do that! 😁

Although we can’t drag & drop the panel, but we can also change the position with the keyboard help. For example, click the Ctrl + Mouse Left Button and can do something! So we can use the chart’s MouseDown even for that:

//define the mouse down event
Chart.MouseDown += Chart_MouseDown;

In mouse down event, we can check the keyboard event, when press the key “Ctrl” and then change the panel’s position:

private void Chart_MouseDown(ChartMouseEventArgs obj)
    //check if press the Ctrl key, you also can use other keys
    if (obj.CtrlKey)
        Chart.IsScrollingEnabled = false;
        //base on muse event to get the X,Y coordinate and setup the panel position by margin
        var left = Chart.Width - obj.MouseX > 160 ? obj.MouseX : obj.MouseX - 160;
        var right = Chart.Height - obj.MouseY > 100 ? obj.MouseY : obj.MouseY - 100;
        objPanel.Margin = new Thickness(left, right, 0, 0);

The result will like below, when I click the Ctrl + Mouse just can change the panel position:

And you can go to below link for download the information pad for cTrader

 2,311 total views,  1 views today

Share your vote!

You may also like...

Translate »