Okay, so I have followed the docs right down to the smallest detail, and it keeps giving me the following error when I try to debug and run (F5):
PInvokeStackImbalance was detected Message: A call to PInvoke function 'VistaControls!VistaControls.Dwm.NativeMethods::DwmExtendFrameIntoClientArea' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.
I have no idea what this means, or how to fix it! Can somebody please help? Any suggestions?
I have used this before but it's not working this time. I am using VS2010 Express C# WinForms, .NET 4 (As I was before when I first used it ages ago.)
Thank you
And yep, I have noticed the correction a person made down the bottom of that page, and I fixed that up, but it still doesn't work!
The Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using VistaControls.Dwm;
namespace One_Stop_Management
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
e.Graphics.FillRectangles(Brushes.Black, new Rectangle[] {
new Rectangle(0, 0, this.ClientSize.Width, 30),
new Rectangle(this.ClientSize.Width - 30, 0, 30, this.ClientSize.Height),
new Rectangle(0, this.ClientSize.Height - 30, this.ClientSize.Width, 30),
new Rectangle(0, 0, 30, this.ClientSize.Height)
});
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
VistaControls.Dwm.DwmManager.EnableGlassSheet(this);
}
}
}
Never mind. I got it. It's such a shame this doesn't work with .NET 4!
You need to go to Project Properties, and change it from .NET Framework 4 to 3.5 or lower*.