Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3702 from RussKie/Add_WindowsForms_TaskDialog_demo
Add Windows Forms TaskDialog API sample
- Loading branch information
Showing
9 changed files
with
1,164 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System; | ||
using System.Windows.Forms; | ||
|
||
namespace TaskDialogDemo | ||
{ | ||
static class Program | ||
{ | ||
/// <summary> | ||
/// The main entry point for the application. | ||
/// </summary> | ||
[STAThread] | ||
static void Main() | ||
{ | ||
Application.SetHighDpiMode(HighDpiMode.SystemAware); | ||
// Note: Calling Application.EnableVisualStyles() is required for the task | ||
// dialog to work. | ||
Application.EnableVisualStyles(); | ||
Application.SetCompatibleTextRenderingDefault(false); | ||
Application.Run(new Form1()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
languages: | ||
- csharp | ||
products: | ||
- dotnet | ||
- windows | ||
page_type: sample | ||
name: "Windows Forms Sample: Task Dialog (C#)" | ||
urlFragment: "winforms-taskdialog-cs" | ||
description: ".NET 5.0 Windows Forms application that demonstrates how to use Task Dialog" | ||
--- | ||
|
||
# Task Dialog Demo | ||
|
||
This sample is a .NET 5.0 Windows Forms application that demonstrates how to use [`Task Dialog`](https://docs.microsoft.com/en-us/windows/win32/controls/task-dialogs-overview). | ||
|
||
![Screenshot](../images/screenshot.jpg) | ||
|
||
Credits: this sample was authored by @kpreisser, the author of [`Task Dialog` for Windows Forms](https://github.com/dotnet/winforms/pull/1133). | ||
|
||
## Sample prerequisites | ||
|
||
This sample is written in C# and targets .NET 5.0 running on Windows. It requires the [.NET 5.0 SDK](https://dotnet.microsoft.com/download/dotnet/5.0). | ||
|
||
## Building the sample | ||
|
||
To download and run the sample, follow these steps: | ||
|
||
01. Download and unzip the sample. | ||
|
||
01. In Visual Studio 2019 or later: | ||
|
||
01. On the menu bar, choose **File** > **Open** > **Project/Solution**. | ||
|
||
01. Navigate to the folder that holds the unzipped sample code, and open the project (*.csproj*) file. | ||
|
||
01. Choose the F5 key, or Ctrl+F5 keys, to run the project. | ||
|
||
01. From the command line: | ||
|
||
01. Navigate to the folder that holds the unzipped sample code. | ||
|
||
01. At the command line, type `dotnet run`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net5.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<UseWindowsForms>true</UseWindowsForms> | ||
</PropertyGroup> | ||
|
||
</Project> |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.