/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used such as when the application is launched to open a specific file. /// </summary> /// <param name="args">Details about the launch request and process.</param> protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args) { m_window = new MainWindow(); IWindowNative windowWrapper = m_window.As <IWindowNative>(); WindowHandle = windowWrapper.WindowHandle; m_window.Activate(); }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used such as when the application is launched to open a specific file. /// </summary> /// <param name="args">Details about the launch request and process.</param> protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args) { m_window = new MainWindow(); //Get the Window's HWND IWindowNative windowNative = m_window.As <IWindowNative>(); m_windowHandle = windowNative.WindowHandle; m_window.Title = "Seleção de cores"; m_window.Activate(); // The Window object doesn't have Width and Height properties in WInUI 3 Desktop yet. // To set the Width and Height, you can use the Win32 API SetWindowPos. // Note, you should apply the DPI scale factor if you are thinking of dpi instead of pixels. SetWindowSize(m_windowHandle, 800, 800); }
/// <summary> /// Set's the icon of a <see cref="IWindowNative"/> Window /// </summary> /// <param name="window">Reference to a <see cref="IWindowNative"/> Window</param> /// <param name="resourceName">Full qualified name of the embedded resource icon file</param> public static void SetIcon(this IWindowNative window, string resourceName) => SetIcon(window.WindowHandle, resourceName);