3 Answers, 1 is accepted
0
Hello Ryan,
Thank you for writing. Here are the answers to your questions:
1. Close event
There are two options:
You have to add elements in the non-client area which will be possible in the upcoming release. The API is extended and the elements will have SetNCElement method. See below how to insert a button before the minimize button:
In order to add button after the close button use Children.Add() instead of Children.Insert().
Greetings,
Angel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Thank you for writing. Here are the answers to your questions:
1. Close event
There are two options:
- Use the form's FormClosing or FormClosed events. The FormClosing event allows you to cancel the closing and the form will remain open. These events are fired for all ways used for closing the form (from the context menu, double click on the image, Alt+F4 keyboard combination, etc.).
- Use the close button click event - this will be called ONLY when the close button is clicked. Just handle the FormElement.TitleBar.CloseButton.Click event.
You have to add elements in the non-client area which will be possible in the upcoming release. The API is extended and the elements will have SetNCElement method. See below how to insert a button before the minimize button:
RadImageButtonElement button = new RadImageButtonElement(); |
button.SetNCElement(true); |
button.Image = ...; |
RadElement buttonStack = this.FormElement.TitleBar.Children[2].Children[0]; |
buttonStack.Children.Insert(0, button); |
In order to add button after the close button use Children.Add() instead of Children.Insert().
Greetings,
Angel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Ryan
Top achievements
Rank 1
answered on 30 Oct 2008, 07:56 PM
I'm trying to handle the FormElement.TitleBar.CloseButton.Click event.
Can you post the VB.Net code for accessing this event?
Public Sub CloseClicked() Handles ??????
End Sub
I haven't been able to access that event.
0
Hello Ryan,
The VB code for handling the click event of the close button is given below:
It seems that the click event was not fired for non-client elements such as the buttons in the TitleBar.
This issue is addressed now and the update will be available in the upcoming release later this week.
If you do not wish to switch to the latest version, you will have to use the form events Closing and Close.
Greetings,
Angel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
The VB code for handling the click event of the close button is given below:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load |
AddHandler Me.FormElement.TitleBar.CloseButton.Click, AddressOf Me.TitleCloseButton_Click |
End Sub |
Private Sub TitleCloseButton_Click(ByVal sender As Object, ByVal e As EventArgs) |
MessageBox.Show("Message") |
End Sub |
It seems that the click event was not fired for non-client elements such as the buttons in the TitleBar.
This issue is addressed now and the update will be available in the upcoming release later this week.
If you do not wish to switch to the latest version, you will have to use the form events Closing and Close.
Greetings,
Angel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.