A Suggestion - facilitate use of DirectX in custom controls
- Dominant language
- C#
- Stars
- 4.9k
- Forks
- 1.1k
- Avg merge
- 20h 23m
- Merged PRs (30d)
- 103
Description
### Background and motivation
I suggest a custom control class that facilitates/eases use of DirectX in a custom control. I'm not sure if the API already has such a class (e.g. other than Control/UserControl/Form).
(Hi, after years of experience with WPF and hand-coding XAML, I'm excited to use Windows Forms for a project, and to see that Windows Forms is actively developed and advanced. I like that the performance of .NET (as opposed to Net Framework) also facilitates respect for the role of Windows Forms as a simpler, yet customizable, and perhaps performant and lightweight option for Windows applications. So, bravo and thank you!)
### API Proposal
```csharp
namespace System.Collections.Generic;
// public class DirectXForm : Form or
public class DirectXControl : Control
{
public void DirectXControl();
}
```
### API Usage
```csharp
var dx = new DirectXControl();
var canvas = dx.Create2DRenderTarget();
...
...
// Other DirectX API hooks, perhaps specific to a few
// common use cases to start with e.g. 2D Bitmap.
...
...
```
### Alternative Designs
_No response_
### Risks
_No response_
### Will this feature affect UI controls?
Might need only one or two new "hosts" e.g. new type of Form/Control in designer, whereby the HWND is for use by DirectX.
I see that this relates to
https://github.com/dotnet/winforms/issues/10740
I don't know if my comments/API here are helpful, and if not, of course delete/close this issue and simply consider it as another vote for any kind of DirectX integration or specific Controls that use DirectX.
Thank You!
Contributor guide
Assessment
This issue has not been assessed yet.