prasannavl / WinApi

A simple, direct, ultra-thin CLR library for high-performance Win32 Native Interop
Apache License 2.0
823 stars 101 forks source link

Add Menus and Buttons to window? #40

Open Shadowblitz16 opened 3 years ago

Shadowblitz16 commented 3 years ago

Is there a way to add menus and buttons to the window?

using System;
using WinApi.Gdi32;
using WinApi.User32;
using WinApi.Windows;
using WinApi.Windows.Controls;
namespace Win32.net
{
    class Program
    {
        static int Main(string[] args)
        {
            using (var win = Window.Create(text: "Hello"))
            {
                win.Show();
                //win.Factory.AppendMenu()       ??
                //win.Factory.CreateWindow<Menu> ??
                win.Factory.CreateWindow<Button>(win, "Test", WindowStyles.WS_VISIBLE | WindowStyles.WS_CHILD);
                return new EventLoop().Run(win);
            }
        }
    }
}