How to display a form with a large logo when an ADX button is clicked.

Add-in Express™ Support Service
That's what is more important than anything else

How to display a form with a large logo when an ADX button is clicked.
 
Subscribe
Leon Lai Kan




Posts: 200
Joined: 2018-12-20
Hi, Andrei

Initially, I wanted to create a splash screen when my Excel add-in loads. This will auto close after a few seconds.

But as the add-in will be used everyday by internal staff, such splash screen may become an annoyance after some time.

So, I will adopt something simpler: Create a Button on my Excel Ribbon, captioned "About"

If a user is curious, he may click the About button, and a large form will pop up showing a big logo for the add-in, together with some basic information (Its name, development date, etc).

There will be a button captioned "Close" to close the picture screen (clipart is downloaded from internet).

Could you explain to me briefly the main steps I must follow to create such picture screen?

Or point me to places in your manual where I can learn more.

Thanks
Leon
Posted 17 May, 2019 07:26:27 Top
Andrei Smolin


Add-in Express team


Posts: 16334
Joined: 2006-05-11
Hello Leon,

There's a template called About Box: right-click your add-in project, click "Add New Item...", in the left pane expand Common Items | Windows Forms. Also, you can search for a step-by-step instruction or a walk-through creating an About window; see e.g. https://www.google.com/search?client=firefox-b-d&q=how+to+create+About+window+VB.NET.

One note however. In a COM add-in, such a form should be shown modally, via Form.ShowDialog(). The reason is: non-modals usually interfere with the windowing of the host application; affected areas are tooltips, keyboard shortcuts, focus, etc.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 17 May, 2019 07:34:06 Top
Leon Lai Kan




Posts: 200
Joined: 2018-12-20
Hi, Andrei

Thanks for your valuable instructions. I have already developed my About screen and it works perfectly.

However, I am not sure that I am doing it the correct way (because I am modifying the autogenerated code in AboutBox1.vb).
So, please let me know if I am on the right track.

I created my own About Form (AboutBox1) using your template.

In AddinModule.vb, I wrote the click event for my ribbon button:

Private Sub AdxRibbonButton2_OnClick(ByVal sender As System.Object, _
        ByVal control As AddinExpress.MSO.IRibbonControl, _
        ByVal pressed As System.Boolean) Handles AdxRibbonButton2.OnClick

        Dim AboutBox1 As New AboutBox1
        AboutBox1.ShowDialog()
End Sub



Pressing the Ribbon Button pops up the About Box, but the information I typed in when designing the About Box don't appear. Only default information appears.

So, I modified the descriptions in the AboutBox1.vb Ex.

Private Sub AboutBox1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ' Set the title of the form.
        Dim ApplicationTitle As String
        If My.Application.Info.Title <> "" Then
            '// ApplicationTitle = My.Application.Info.Title
            ApplicationTitle = "My Add-in"    '// MODIFIED LINE
        Else
            ApplicationTitle = System.IO.Path.GetFileNameWithoutExtension(My.Application.Info.AssemblyName)
        End If
        Me.Text = String.Format("About {0}", ApplicationTitle)
        ' Initialize all of the text displayed on the About Box.
        ' TODO: Customize the application's assembly information in the "Application" pane of the project 
        '    properties dialog (under the "Project" menu).
        '// Me.LabelProductName.Text = My.Application.Info.ProductName
        Me.LabelProductName.Text = "My Add-in"   '// MODIFIED LINE

        '//Me.LabelVersion.Text = String.Format("Version {0}", My.Application.Info.Version.ToString)
        Me.LabelVersion.Text = "Version 1.0, Sept 2019"   '// MODIFIED LINE



As I said, it works fine. But am I entitled to modify autogenerated code like this?


Best Regards,
Leon
Posted 20 May, 2019 06:03:46 Top
Andrei Smolin


Add-in Express team


Posts: 16334
Joined: 2006-05-11
Hello Leon,

Of course, you can modify the form in the way you like better. But while modifying you should remember that the current code in the Load event modifies the controls mentioned in the code of this method. To achieve the result, you should modify that code as well. Say, you can comment it out completely.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 20 May, 2019 09:42:28 Top
Leon Lai Kan




Posts: 200
Joined: 2018-12-20
Andrei,

I am glad you vetted my way of working.

However, it seems there is another (?) way of creating an About Box.

If I open the template provided by ADX (Project > Add New Item > About Box), I read the following instruction:

At runtime, the labels'text will be replaced with the application's assembly information.
Customise the application's assembly information in the Application pane of Project Designer.



Could you please tell me how I can reach the assembly information in the Application pane of Project Designer?


Leon
Posted 21 May, 2019 01:39:46 Top
Andrei Smolin


Add-in Express team


Posts: 16334
Joined: 2006-05-11
Hello Leon,

Menu Project | {your project name} Properties...| tab Application | button Assembly Information.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 21 May, 2019 02:20:47 Top
Leon Lai Kan




Posts: 200
Joined: 2018-12-20
Andrei,

Thanks a lot for your support.


Best Regards,
Leon
Posted 21 May, 2019 04:14:40 Top
Andrei Smolin


Add-in Express team


Posts: 16334
Joined: 2006-05-11
Welcome!

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 21 May, 2019 04:18:45 Top