从零开始的SharpDX(一)——创建SharpDX窗口
            Copyright Notice: This article is an original work licensed under the CC 4.0 BY-NC-ND license.
            If you wish to repost this article, please include the original source link and this copyright notice.
            
            Source link: https://v2know.com/article/347
开发环境:Visual Studio 2019
新建项目:.NET Framework 的控制台
需要nuget的包有:
- SharpDX
- SharpDX.D3DCompiler
- SharpDX.Desktop
- SharpDX.Direct2D1
- SharpDX.Direct3D11
- SharpDX.DXGI

完整代码:
using SharpDX.Windows;
using System;
using System.Drawing;
namespace CreateWindow
{
    class Program
    {
        static void Main(string[] args)
        {
            using (var temp = new CreateSharpDXWindow())
            {
                temp.Run();
            }
        }
    }
    class CreateSharpDXWindow : IDisposable
    {
        private RenderForm _renderForm;
        private const int Width = 1280;
        private const int Height = 720;
        public CreateSharpDXWindow()
        {
            _renderForm = new RenderForm();
            _renderForm.ClientSize = new Size(Width, Height);
        }
        public void Run()
        {
            RenderLoop.Run(_renderForm, RenderCallback);
        }
        private void RenderCallback()
        {
        }
        public void Dispose()
        {
            _renderForm?.Dispose();
        }
    }
}
下一篇:从零开始的SharpDX(二)——初始化DirectX并修改颜色
This article was last edited at