Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

creating about dialog box in C# form application

Tags:

c#

forms

I have a C# form application, in that I have a menu where one of the item is help. It has a sub-item About. As you seen in many applications when you click on help a separate dialog box opens up which displays the information.

I want something like that.

like image 858
Nikunj Aggarwal Avatar asked Oct 30 '13 07:10

Nikunj Aggarwal


People also ask

How do you create a dialog box?

To create a new dialog box In Resource View, right-click your . rc file and select Add Resource. In the Add Resource dialog box, select Dialog in the Resource Type list, then choose New. If a plus sign (+) appears next to the Dialog resource type, it means that dialog box templates are available.

What are the four 4 types of dialog boxes?

They are the grey windows that pop up on Windows systems to display messages, and allow the user to set parameters. There are 3 types of dialog boxes: modeless, modal, and system modal.

What is dialog box explain with example?

A dialog box is a temporary window an application creates to retrieve user input. An application typically uses dialog boxes to prompt the user for additional information for menu items.


4 Answers

Looks like you have not been searching for long, here it goes just add one using predefined template:

Add item window

And you could possibly find this link useful:

social.msdn.microsoft.com

Quote from there:

  1. Create a new windows form application
  2. In the "Solution explorer" ,left part of the screen , right click on the name of your windows application.
  3. Choose Add-->New item
  4. From the " Add new item window" choose "AboutBox" , name it "AboutBox1" , click on Add button. Now you have in your applicatoin two forms, "Form1" -- created by default by your project type and "AboutBox1" .
  5. Right click on the "Form1" and choose "Design View".
  6. Double click on the design sourface of form1.
  7. After that you will see this code:

    private void Form1_Load(object sender, EventArgs e)
    {
    
    }
    
  8. Add this code to your application, to look like this:

    private void Form1_Load(object sender, EventArgs e)
    {
        AboutBox1 a = new AboutBox1();
        a.Show();
    }
    
  9. Run the application.

like image 156
Tafari Avatar answered Oct 04 '22 11:10

Tafari


To add a menu to a Windows Form at design time Open the form you wish to add a menu to in the Windows Forms Designer.

  • In the Toolbox, double-click the MenuStrip component.
  • A menu is added to the form (displaying the text "Type Here"), and the MainMenu component is added to the component tray.

Then you can do that as follows using click Event of that particuler subMenu item . Hint:Just click the subMenu item and rightclick->Properties..then you can find the Click Event for subMenuItem.

 private void aboutToolStripMenuItem1_Click(object sender, EventArgs e)
 {
    AboutWindow aboutWindow = new AboutWindow();
    aboutWindow.Show();
 }
like image 40
Thilina H Avatar answered Oct 04 '22 12:10

Thilina H


There is a standard about box in the templates, try Project / Add new item and look for About Box. You can show it like a regular dialog form, e.g. using new AboutBox(this). ShowDialog(); in the menu item click handler.

like image 22
CompuChip Avatar answered Oct 04 '22 12:10

CompuChip


Before or after adding About Box to the project from the list of possible items, make sure that AssemblyInfo.cs is fulfilled with data.

AssemblyInfo.cs in Solution Explorer Window

In your project, click on Properties. Open AssemblyInfo.cs. This is the source of the info displayed in About Box.

like image 33
Bereg Isztria Avatar answered Oct 04 '22 12:10

Bereg Isztria