using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms;namespace winform { public partial class Form1 : Form { public Form1() { this.Location = new Point(100, 100); this.Cursor = System.Windows.Forms.Cursors.Hand;// 定义在窗体上,光标显示为手形 this.Text = "透明窗体"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;// 定义窗体的开始显示位置是屏幕的中间 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; this.ForeColor = System.Drawing.SystemColors.Desktop; this.Font = new System.Drawing.Font("宋体", 9); this.BackColor = System.Drawing.Color.Blue; this.ClientSize = new Size(440, 170); this.Opacity = 0.1; } public static void Main() { Application.Run(new Form1()); } } }
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace winform
{
public partial class Form1 : Form
{
public Form1()
{ this.Location = new Point(100, 100);
this.Cursor = System.Windows.Forms.Cursors.Hand;// 定义在窗体上,光标显示为手形
this.Text = "透明窗体";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;// 定义窗体的开始显示位置是屏幕的中间
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
this.ForeColor = System.Drawing.SystemColors.Desktop;
this.Font = new System.Drawing.Font("宋体", 9);
this.BackColor = System.Drawing.Color.Blue;
this.ClientSize = new Size(440, 170); this.Opacity = 0.1;
} public static void Main()
{
Application.Run(new Form1());
}
}
}
我只想让 窗体透明, 控件不透明,行吗?比如说图片,picBox ,label 上的文字
this.TransparencyKey = this.BackColor;
控件的话 需要 你 设置前景色