网上也看过很多做.NET 窗体的例子,我只是把网上的这些东西综合了一下,主要有下面这些特点: 1、边框是半透明的,透明度可根据需要自己更改; 2、可以改变窗体的大小,改变后样式不变; 3、窗体的边框是不规则的; 4、重点解决了窗体会出现闪烁的问题,在窗体移动的时候也不会闪烁; 5、使用方便,只要将 AlphaFormPanel 拖动到一般的窗体上就可以实现换肤; 设计思路说明: 一、.NET 下处理一个窗体部分透明我所知道的有两种方法: 1、用一张支持 Alhpa 通道的图片来处理半透明,这种方式处理出来的效果会很好,甚至可以用一张动态的图片来做背景。相信有人看过那个游动的鱼的程序,鱼的边缘是半透明的,就是用这种方式做的。这种方式整个窗体都是通过UpdateLayeredWindow 画出来的,如果要在上面加控件的话,所有的控件都要自己来绘制,显然在具体的项目中用这种方式的话会大大增加开发的难度。有兴趣的人可以看看这个程序: /Files/liutao409/游动的鱼.rar 关键的代码就是根据这种支持 Alhpa 通道的图片来绘制窗体 [DllImport("user32.dll", ExactSpelling = true, SetLastError = true)] public static extern int UpdateLayeredWindow(IntPtr hwnd, IntPtr hdcDst, ref Point pptDst, ref Size psize,IntPtr hdcSrc, ref Point pptSrc, Int32 crKey, ref BLENDFUNCTION pblend, Int32 dwFlags); public void SetBits(Bitmap bitmap) { if (!haveHandle) return; if(!Bitmap.IsCanonicalPixelFormat(bitmap.PixelFormat)| !Bitmap.IsAlphaPixelFormat(bitmap.PixelFormat)) throw new ApplicationException("图片必须是32 位带Alhpa 通道的图片。"); IntPtr oldBits = IntPtr.Zero; IntPtr screenDC = Win32.GetDC(IntPtr.Zero); IntPtr hBitmap = IntPtr.Zero; IntPtr memDc = Win32.CreateCompatibleDC(screenDC); try { Win32.Point topLoc = new Win32.Point(Left, Top); Win32.Size bitMapSize = new Win32.Size(bitmap.Width, bitmap.Height); Win32.BLENDFUNCTION blendFunc = new Win32.BLENDFUNCTION(); Win32.Point srcLoc = new Win32.Point(0, 0); hBitmap = bitmap.GetHbitmap(Color.FromArgb(0)); oldBits = Win32.SelectObject(memDc, hBitmap); blendFunc.BlendOp = Win32.AC_SRC_OVER; blendFunc.S...