The following code demonstrates how to add custom caption button on a NForm instance:
C# |
Copy Code
|
---|---|
//create a frame caption button NFrameCaptionButton button = new NFrameCaptionButton(); button.Glyph = CommonGlyphs.PinDown; button.GlyphSize = new Size(8, 10); //create a new form and add our button to it NForm form = new NForm(); form.CustomButtons.Add(button); form.ShowDialog(); |
Visual Basic |
Copy Code
|
---|---|
'create a frame caption button Dim button As NFrameCaptionButton = New NFrameCaptionButton() button.Glyph = CommonGlyphs.PinDown button.GlyphSize = New Size(8, 10) 'create a new form and add our button to it Dim form As NForm = New NForm() form.CustomButtons.Add(button) form.ShowDialog() |
The result of the above code:
The following example demonstrates how to trap a click from a custom caption button:
C# |
Copy Code
|
---|---|
NForm form = new NForm(); form.CaptionButtonClicked += new NUIItemEventHandler(OnCaptionButtonClicked); ... private void OnCaptionButtonClicked(object sender, NUIItemEventArgs e) { MessageBox.Show(e.Item.ToString()); } |
Visual Basic |
Copy Code
|
---|---|
Dim form As NForm = New NForm() AddHandler CaptionButtonClicked, AddressOf OnCaptionButtonClicked ... Private Sub OnCaptionButtonClicked(ByVal sender As Object, ByVal e As NUIItemEventArgs) Handles form.CaptionButtonClicked MessageBox.Show(e.Item.ToString()) End Sub |