• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Add draw objects icon to a button

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Add draw objects icon to a button

    I have attached an image of a toolbars in the left side of the chart.

    I used this code:

    btnRuler = new System.Windows.Controls.Button();
    btnRuler.ToolTip = "Ruler";
    btnRuler.Background = Brushes.Transparent;
    btnRuler.Width = 205;
    btnRuler.Height = 30;
    btnRuler.Content = NinjaTrader.Gui.Tools.Icons.DrawRuler; //"Ruler";
    btnRuler.Click += btnRuler_Click;
    System.Windows.Controls.Grid.SetRow(btnRuler, 1);
    VerticalStackPanel.Children.Add(btnRuler);

    Now as you can see in the image the first button which is the ruler button it only draws a little box image. Now my problem is how can I add the draw objects icon successfully? I want those buttons in the image to have an draw objects icon only not a text. I will appreciate someone that could help. Thanks.
    Attached Files

    #2
    Hello,

    Thank you for the post.

    I wanted to check, are you able to import the attached sample and see the correct icon is displayed in the Toolbar? I noted you are using a StackPanel, this could potentially be the cause. If the Toolbar icon works where your current implementation does not, could you provide an export of your script as you have it now?

    I look forward to being of further assistance.
    Attached Files
    JesseNinjaTrader Customer Service

    Comment


      #3
      I would love to send you the cs file just let me know where can I email it.

      Comment


        #4
        Hello,

        Thank you for the reply.

        After further review, a sample may not be needed. Can you try just changing the FontFamily the button is using? It is likely the base Button style does not have a specific Font set where the Toolbar button does.

        Code:
        btnRuler.FontFamily = Application.Current.TryFindResource("IconsFamily") as FontFamily
        I see this allows me to use the NT icons which are a Font, the string used from Tools.Icons then seem to work in a standard button for me.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          It works :-)

          Comment


            #6
            RemoveAllDrawingObjects Icon/Button doesn't delete the drawn objects even though I have put this code:

            private void btnmnuRemoveAllDrawingObjects_Click(object sender, EventArgs e)
            {
            SendKeys.SendWait("^{Delete}");
            }

            but if it's in the main menu on the top of the chart it will work, something wrong when it's in the stack panel in the left grid. Can you help me out on this please.

            Comment


              #7
              Hello luxurious_04,

              As long as you are hitting that line of code to simulate a press of the Ctrl + Delete keys, and you have the hot key configured to Remove All Drawing Objects, you should be able to use the button press to trigger the Remove All Draw Objects prompt.

              I have attached an example of ours that will trigger this from buttons on a Stack Panel. The Remove Draw Objects hotkey will need to be assigned to Ctrl + Delete.

              If there is anything else we can do to assist, please let us know.
              Attached Files
              JimNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Duval, Today, 08:38 AM
              0 responses
              10 views
              0 likes
              Last Post Duval
              by Duval
               
              Started by i2w8am9ii2, 02-13-2019, 04:28 PM
              7 responses
              62 views
              0 likes
              Last Post sledge
              by sledge
               
              Started by woodyfox, Yesterday, 08:33 PM
              0 responses
              8 views
              0 likes
              Last Post woodyfox  
              Started by rblunsom, Yesterday, 11:19 AM
              2 responses
              31 views
              0 likes
              Last Post guidoisot  
              Started by drewski1980, Yesterday, 02:38 PM
              1 response
              24 views
              0 likes
              Last Post NinjaTrader_ChrisL  
              Working...
              X