制作透明按钮

时间:2013-02-22 23:34:57

标签: c# winforms c#-4.0

我正在使用Winforms应用程序并导入Microsoft .NET Framework的Windows API代码包。以下是我的代码:

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 Microsoft.WindowsAPICodePack.Taskbar;
using Microsoft.WindowsAPICodePack.Shell;    

namespace Glass_Test2
{
...
}

但当我尝试在其上添加一个按钮时,结果如下:

enter image description here

任何人都能告诉我如何让按钮透明吗?

1 个答案:

答案 0 :(得分:0)

如果你不能切换到WPF,我会选择GDI +并绘制矩形 - 这可以响应鼠标事件。现在你可以控制透明度了。

Public Class GDIButton
  Public Property Bounds As Rectangle
  Public Property Text As String
  Public Property BorderColor As Color
  Public Property FillColor As Color
End Class
相关问题