❔ Form goes fully transparent please help
i was trying to make blurry panel then i searched and i found something but the problem is i see square hole in program..
4 Replies
im trying to make it like this
and code:
c#
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Drawing.Text;
namespace HUB
{
public partial class Menu : Form
{
public Menu()
{
this.EnableBlur();
BackColor = Color.Azure;
TransparencyKey = Color.Azure;
InitializeComponent();
guna2ShadowForm1.SetShadowForm(this);
}
}
public static class WindowExtension
{
[DllImport("user32.dll")]
static internal extern int SetWindowCompositionAttribute(IntPtr hwnd, ref WindowCompositionAttributeData data);
public static void EnableBlur(this Form @this)
{
var accent = new AccentPolicy();
accent.AccentState = AccentState.ACCENT_ENABLE_BLURBEHIND;
var accentStructSize = Marshal.SizeOf(accent);
var accentPtr = Marshal.AllocHGlobal(accentStructSize);
Marshal.StructureToPtr(accent, accentPtr, false);
var Data = new WindowCompositionAttributeData();
Data.Attribute = WindowCompositionAttribute.WCA_ACCENT_POLICY;
Data.SizeOfData = accentStructSize;
Data.Data = accentPtr;
SetWindowCompositionAttribute(@this.Handle, ref Data);
Marshal.FreeHGlobal(accentPtr);
}
}
enum AccentState
{
ACCENT_ENABLE_BLURBEHIND = 3
}
struct AccentPolicy
{
public AccentState AccentState;
public int AccentFlags;
public int GradientColor;
public int AnimationId;
}
struct WindowCompositionAttributeData
{
public WindowCompositionAttribute Attribute;
public IntPtr Data;
public int SizeOfData;
}
enum WindowCompositionAttribute
{
WCA_ACCENT_POLICY = 19
}
}
c#
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Drawing.Text;
namespace HUB
{
public partial class Menu : Form
{
public Menu()
{
this.EnableBlur();
BackColor = Color.Azure;
TransparencyKey = Color.Azure;
InitializeComponent();
guna2ShadowForm1.SetShadowForm(this);
}
}
public static class WindowExtension
{
[DllImport("user32.dll")]
static internal extern int SetWindowCompositionAttribute(IntPtr hwnd, ref WindowCompositionAttributeData data);
public static void EnableBlur(this Form @this)
{
var accent = new AccentPolicy();
accent.AccentState = AccentState.ACCENT_ENABLE_BLURBEHIND;
var accentStructSize = Marshal.SizeOf(accent);
var accentPtr = Marshal.AllocHGlobal(accentStructSize);
Marshal.StructureToPtr(accent, accentPtr, false);
var Data = new WindowCompositionAttributeData();
Data.Attribute = WindowCompositionAttribute.WCA_ACCENT_POLICY;
Data.SizeOfData = accentStructSize;
Data.Data = accentPtr;
SetWindowCompositionAttribute(@this.Handle, ref Data);
Marshal.FreeHGlobal(accentPtr);
}
}
enum AccentState
{
ACCENT_ENABLE_BLURBEHIND = 3
}
struct AccentPolicy
{
public AccentState AccentState;
public int AccentFlags;
public int GradientColor;
public int AnimationId;
}
struct WindowCompositionAttributeData
{
public WindowCompositionAttribute Attribute;
public IntPtr Data;
public int SizeOfData;
}
enum WindowCompositionAttribute
{
WCA_ACCENT_POLICY = 19
}
}
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
rep
.-.
still waiting