SND\AstrorEnales_cp 5505f7dcbf - Added PlatformSystem Plugins layer
- Started Windows, Metro and Linux Platform-Plugins
- Moved the RecordingSample to the Samples folder
- Started two samples for using the graphics device in a WinForms and Wpf Editor
- Refactorings in the AddIn-System
- Moved the Window initialization-code to the Platform modules
- Changed the License text in all code files which is now way smaller
- Started ProjectConverter tool which converts all the projects and solution to the target configuration
- Changed the SupportedPlatform names in the Resource files
- Changed the WIN8 define to WINDOWSMETRO which is actually meant
- Removed NLog and started our own Logger class
- Many more stuff...
2012-08-09 09:45:04 +00:00

70 lines
1.9 KiB
C#

using System;
using System.Runtime.InteropServices;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANX.RenderSystem.Windows.GL3.Helpers
{
internal static class WindowsInterop
{
#region RECT (Helper struct)
[StructLayout(LayoutKind.Sequential)]
private struct RECT
{
/// <summary>
/// X position of upper-left corner.
/// </summary>
public int Left;
/// <summary>
/// Y position of upper-left corner.
/// </summary>
public int Top;
/// <summary>
/// X position of lower-right corner.
/// </summary>
public int Right;
/// <summary>
/// Y position of lower-right corner.
/// </summary>
public int Bottom;
}
#endregion
#region Invokes
[DllImport("user32.dll")]
private static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter,
int x, int y, int width, int height, uint uFlags);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool GetClientRect(IntPtr hWnd, out RECT lpRect);
#endregion
#region ResizeWindow
public static void ResizeWindow(IntPtr windowHandle, int backBufferWidth,
int backBufferHeight)
{
RECT windowRect;
RECT clientRect;
if (GetWindowRect(windowHandle, out windowRect) &&
GetClientRect(windowHandle, out clientRect))
{
int width = backBufferWidth + (windowRect.Right - windowRect.Left) -
clientRect.Right;
int height = backBufferHeight + (windowRect.Bottom - windowRect.Top) -
clientRect.Bottom;
SetWindowPos(windowHandle, IntPtr.Zero, windowRect.Left, windowRect.Top,
width, height, 0);
}
}
#endregion
}
}