Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
534 changes: 534 additions & 0 deletions windowsforms/TaskDialogDemo/cs/Form1.cs

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions windowsforms/TaskDialogDemo/cs/Program.cs
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());
}
}
}
43 changes: 43 additions & 0 deletions windowsforms/TaskDialogDemo/cs/README.md
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`.
10 changes: 10 additions & 0 deletions windowsforms/TaskDialogDemo/cs/TaskDialogDemo.csproj
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>
Binary file added windowsforms/TaskDialogDemo/images/screenshot.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading