Extend size of non client area

Joined
Oct 1, 2016
Messages
1
Reaction score
0
I need to extend the size of the top edge of the client area to enter non GUI components that location. I am using the code below to this, however, by turning the extended area code is blank, you do not get the transparency of Windows 7 Professional, which is the OS I'm using. I am new to programming and C # Windows API. I thank the attention.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using System.Windows.Forms;

namespace InstrumentalCsharp
{
public partial class WExplorerPadrao : Form
{

[StructLayout(LayoutKind.Sequential)]
public struct MARGINS
{
public int cxLeftWidth; // width of left border that retains its size
public int cxRightWidth; // width of right border that retains its size
public int cyTopHeight; // height of top border that retains its size
public int cyBottomHeight; // height of bottom border that retains its size
};

[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern void DwmExtendFrameIntoClientArea(IntPtr hwnd, ref MARGINS margins);

[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern bool DwmIsCompositionEnabled();


public WExplorerPadrao()
{
InitializeComponent();
}

protected void WExplorerPadrao_Load(object sender, System.EventArgs e)
{
WExplorerPadrao.MARGINS margins = new WExplorerPadrao.MARGINS();
margins.cxLeftWidth = 0;
margins.cxRightWidth = 0;
margins.cyTopHeight = 20;
margins.cyBottomHeight = 0;
IntPtr hwnd = this.Handle;
WExplorerPadrao.DwmExtendFrameIntoClientArea(hwnd, ref margins);
}
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top