This is a migrated thread and some comments may be shown as answers.

RadForm TitleBar Buttons

10 Answers 314 Views
TitleBar
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 23 Oct 2012, 10:30 PM
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?

10 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 26 Oct 2012, 03:27 PM
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.
0
Accepted
Darko
Top achievements
Rank 1
answered on 29 Apr 2013, 03:51 PM
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();
}
0
Hugo Furth
Top achievements
Rank 1
answered on 21 Jul 2014, 07:09 PM
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;






0
Stefan
Telerik team
answered on 22 Jul 2014, 06:22 AM
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.
 
0
Hugo Furth
Top achievements
Rank 1
answered on 22 Jul 2014, 10:36 PM
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




0
Stefan
Telerik team
answered on 23 Jul 2014, 08:41 AM
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.
 
0
Hugo Furth
Top achievements
Rank 1
answered on 23 Jul 2014, 04:47 PM
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
0
Stefan
Telerik team
answered on 24 Jul 2014, 06:44 AM
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.
 
0
Hugo Furth
Top achievements
Rank 1
answered on 31 Jul 2014, 12:01 AM
Huge thanks - sorry for delayed reply.
0
Stefan
Telerik team
answered on 31 Jul 2014, 05:58 AM
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.
 
Tags
TitleBar
Asked by
Michael
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Darko
Top achievements
Rank 1
Hugo Furth
Top achievements
Rank 1
Share this question
or