用 this.Opacity = 0.4; 让form 半透明
可是上面的控件 button picturebox 也都半透明了
如何让这些控件不透明?

解决方案 »

  1.   

    to 用 this.Opacity = 0.4; 让form 半透明替换这个半透明方法。
      

  2.   

    this.Opacity是通过Windows的Layed Window的风格实现半透明的,恐怕没办法让这个容器中的某个控件不透明。
    非要实现这样的效果的话,只有写一个Form模拟Button的操作了。
      

  3.   

    写个CSS,在控件上调用这个CSS
      

  4.   

    这种效果如何:using System;
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;
    using System.Data;namespace WindowsApplication10
    {
    /// <summary>
    /// Form1 的摘要说明。
    /// </summary>
    public class Form1 : System.Windows.Forms.Form
    {
    private System.Windows.Forms.Button button1;
    private System.Windows.Forms.Panel panel1;
    /// <summary>
    /// 必需的设计器变量。
    /// </summary>
    private System.ComponentModel.Container components = null; public Form1()
    {
    //
    // Windows 窗体设计器支持所必需的
    //
    InitializeComponent(); //
    // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
    //
    } /// <summary>
    /// 清理所有正在使用的资源。
    /// </summary>
    protected override void Dispose( bool disposing )
    {
    if( disposing )
    {
    if (components != null) 
    {
    components.Dispose();
    }
    }
    base.Dispose( disposing );
    } #region Windows 窗体设计器生成的代码
    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {
    this.button1 = new System.Windows.Forms.Button();
    this.panel1 = new System.Windows.Forms.Panel();
    this.panel1.SuspendLayout();
    this.SuspendLayout();
    // 
    // button1
    // 
    this.button1.BackColor = System.Drawing.SystemColors.Control;
    this.button1.Location = new System.Drawing.Point(72, 80);
    this.button1.Name = "button1";
    this.button1.TabIndex = 0;
    this.button1.Text = "button1";
    // 
    // panel1
    // 
    this.panel1.BackColor = System.Drawing.Color.White;
    this.panel1.Controls.Add(this.button1);
    this.panel1.Location = new System.Drawing.Point(32, 48);
    this.panel1.Name = "panel1";
    this.panel1.Size = new System.Drawing.Size(232, 176);
    this.panel1.TabIndex = 1;
    // 
    // Form1
    // 
    this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
    this.BackColor = System.Drawing.SystemColors.Control;
    this.ClientSize = new System.Drawing.Size(292, 273);
    this.Controls.Add(this.panel1);
    this.Name = "Form1";
    this.Text = "Form1";
    this.TransparencyKey = System.Drawing.Color.White;
    this.panel1.ResumeLayout(false);
    this.ResumeLayout(false); }
    #endregion /// <summary>
    /// 应用程序的主入口点。
    /// </summary>
    [STAThread]
    static void Main() 
    {
    Application.Run(new Form1());
    }
    }
    }
      

  5.   

    To  oolongTea(乌龙茶) 
    你给的是镂空效果,我的意思是要求在一个“半透明”的容器中,显示button控件(不透明),该如何办呢?