如何在C#里实现图形渐变透明的效果?

解决方案 »

  1.   

    楼主你说的是图形?还是窗口像vista那样的渐变?图形用gdi,窗口用api,你要哪个?
      

  2.   

    System.Drawing.Graphics g=e.Graphics;
    System.Drawing.Brush line=new System.Drawing.Drawing2D.LinearGradientBrush(new Rectangle(10,60,180,20),Color.Blue,Color.White,90);
    g.FillRectangle(line,new Rectangle(10,60,180,20));
    line.Dispose();要这样的?
      

  3.   

    使用timer控件。实现一个窗体,在弹出时要慢慢从透明到不透明的特效
            private double opacityIncrement = 0.1;
    private const int changeInterval = 25;
    private Timer timer1; //表单载入
    private void Form1_Load(object sender, System.EventArgs e)
    { timer1=new Timer();
    timer1.Interval=changeInterval;
    timer1.Tick+=new System.EventHandler(this.timer1_Tick);
    this.Opacity=0;
    timer1.Start();
    } //渐显事件
    private void timer1_Tick(object sender, System.EventArgs e)
    {
              this.timer1.Stop();
    if(this.Opacity<1)
    {
    this.Opacity=this.Opacity+this.changeInterval;
    }
    else
    {
    this.timer1.Enabled=false;
    }
            this.timer1.Start();
            }
      

  4.   

    显然用GDI+啊,调节Alpha通道的透明度就可以了。
    参考System.Drawing.Graphics类
      

  5.   

    to zoujiaming(笨笨的!):
    是图片
    通过
    Bitmap bitmap = new Bitmap(图片目录);
    让图片bitmap 渐变透明to :Artex_xh(一团矛盾)
    能不能具体点啊...我找了很久,没也找出相应的方法来..