RadForm TitleBar Buttons

11 posts, 1 answers
  1. Michael
    Michael avatar
    4 posts
    Member since:
    Dec 2012

    Posted 23 Oct 2012 Link to this post

    There are two issues. The first is that if I set HelpButton to true, a help button doesn't show. Here are the relevant settings on my RadForm:

    this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
    this.HelpButton = true;
    this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
    this.MaximizeBox = false;
    this.MinimizeBox = false;

    Additionally, I'm trying to add another button that behaves like the minimize/maximize/close button to the title bar. Basically, I want an image button that doesn't show it's fill or it's border until it's hovered/clicked, and is the same size as the minimize/maximize/close buttons. I need to be able  to choose what happens when this button is clicked and what image is displayed.

    Is there a simple way to accomplish this?
  2. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 26 Oct 2012 Link to this post

    Hello Liru,

    Thank you for writing.

    We are aware of the case where the help button is not shown. This case is already logged in our  Public Issue Tracking System and we will address it in a future release. Feel free to add your vote for it here: 

    As to adding a new button, here is how you can do that:
    RadButtonElement b = new RadButtonElement();
    b.ShowBorder = false;
    b.Image = Resources.NormalState;
    this.FormElement.TitleBar.SystemButtons.Children.Insert(0,b);

    If you want to have the hovered, pressed and normal states of the button, you need to create three images and to apply them on the mouse events i.e. apply the hovered image on MouseEnter, the normal image on MouseLeave and the pressed image on MouseDown.

    I hope this helps.


    All the best,
    Stefan
    the Telerik team
    Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Answer
    Darko
    Darko avatar
    14 posts
    Member since:
    Sep 2008

    Posted 29 Apr 2013 Link to this post

    This works very good, however I added the EventHandler for the help display:

    RadButtonElement _btnHelp = new RadButtonElement();
    _btnHelp.ShowBorder = false;
    _btnHelp.Image = global::labs.STAR.App.Properties.Resources.helpicon;
    _btnHelp.Click += _btnHelp_Click;
    this.FormElement.TitleBar.SystemButtons.Children.Insert(0, _btnHelp);
     
    public void _btnHelp_Click(object sender, EventArgs e)
    {
        ShowHelp();
    }
  5. Hugo Furth
    Hugo Furth avatar
    31 posts
    Member since:
    Dec 2008

    Posted 21 Jul 2014 in reply to Stefan Link to this post

    I'm having the same problem as above (help button not available on form) but the links to the workaround in the Public Issue Tracker
    (http://www.telerik.com/support/pits.aspx#/details/Issue=1253)
    (http://www.telerik.com/support/pits.aspx#/details/Issue=12835)
     are both dead.

    Form is set as 'sizeable'.
    My settings:
                this.MaximizeBox = false;
                this.MinimizeBox = false;
                this.HelpButton = true;






  6. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 22 Jul 2014 Link to this post

    Hello Hugo,

    Back in January this year we migrated the PITS system to a feedback portal. Here are the migrated items:
    http://feedback.telerik.com/Project/154/Feedback/Details/109772-add-helpbutton-at-the-titlebar-of-radform
    http://feedback.telerik.com/Project/154/Feedback/Details/110592-fix-radribbonform-cannot-hide-the-minimize-and-maximize-buttons-of-the-form-in

    The help button functionality is still not available in the suite. Feel free to add your vote for this request to increase its priority. 

    For the time being, you can use the approaches from the previous posts to add a button in the desired area.

    I hope that you find this information useful.

    Regards,
    Stefan
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  7. Hugo Furth
    Hugo Furth avatar
    31 posts
    Member since:
    Dec 2008

    Posted 22 Jul 2014 in reply to Stefan Link to this post

    Stefan -

    I tried the code from these posts but it leaves something to be desired. Perhaps you or some one else might know a more elegant way to get this to work because currently I don't see how I can use it.

    I placed the help button as follows:
                RadButtonElement _btnHelp = new RadButtonElement();
                _btnHelp.AutoSize = true;
                _btnHelp.ShowBorder = false; 
                _btnHelp.Image = Properties.Resources.help_16T;
                this.FormElement.TitleBar.SystemButtons.Children.Insert(0,_btnHelp);


    You can see the result in the attached 1.png. Button is there but even though it is a properly formed png with transparency, not getting the transparent behavior. I could match the color to the theme but wonder if there is a better way.

    My REAL problem is shown in 2.png. Here I have hidden the max/min buttons on the form but the help button still positions itself as if they were there creating a very strange looking form.

    Notice in non-RadForm 3.png, a standard windows form, pushes the help button up against the close button.

    Sure would appreciate any ideas on how to get this to function properly.
    Thanks,
    Hugo




  8. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 23 Jul 2014 Link to this post

    Hello Hugo,

    If you set the minimize and maximize button's Visibility to Collapsedthey will no longer reserve their place, and the image button will be next to the close button as expected. A suitable place to change the Visibility of these button is the Form.Load event:
    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
     
        RadButtonElement _btnHelp = new RadButtonElement();
        _btnHelp.AutoSize = true;
        _btnHelp.ShowBorder = false;
        _btnHelp.Image = Properties.Resources.aaa;
     
        this.FormElement.TitleBar.SystemButtons.Children.Insert(0, _btnHelp);
     
        this.FormElement.TitleBar.MinimizeButton.Visibility = ElementVisibility.Collapsed;
        this.FormElement.TitleBar.MaximizeButton.Visibility = ElementVisibility.Collapsed;
     
    }

    I hope this helps.

    Regards,
    Stefan
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  9. Hugo Furth
    Hugo Furth avatar
    31 posts
    Member since:
    Dec 2008

    Posted 23 Jul 2014 in reply to Stefan Link to this post

    This was a huge, huge help and greatly appreciated.

    Just to follow up on my minor issue - is there any way to allow title bar icons to be transparent? 

    As I said earlier, not a big deal.

    Thanks again very much for help on the icon placement.

    Regards,
    Hugo
  10. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 24 Jul 2014 Link to this post

    Hello,

    Please excuse me for omitting this question.

    You can either hide the FillPrimitive of the button:
    _btnHelp.ButtonFillElement.Visibility = ElementVisibility.Collapsed;

    or you can set its colors to Transparent:
    _btnHelp.ButtonFillElement.BackColor = Color.Transparent;
    _btnHelp.ButtonFillElement.BackColor2 = Color.Transparent;
    _btnHelp.ButtonFillElement.BackColor3 = Color.Transparent;
    _btnHelp.ButtonFillElement.BackColor4 = Color.Transparent;

    However, as expected you will loose the hover effects. One way to handle the hover is to have another image which will be shown when the button is hovered. You can use the MouseEnter and MouseLeave events to switch the images.

    I hope that the provided information addresses your question.

    Regards,
    Stefan
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  11. Hugo Furth
    Hugo Furth avatar
    31 posts
    Member since:
    Dec 2008

    Posted 30 Jul 2014 in reply to Stefan Link to this post

    Huge thanks - sorry for delayed reply.
  12. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 31 Jul 2014 Link to this post

    Hello,

    You are welcome. Let us know if you have any other questions.

    Regards,
    Stefan
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top
UI for WinForms is Visual Studio 2017 Ready