比如运行中的一个程序a.exe
显示窗口FormA如何写一个程序来设置FormA的透明效果前提
在不修改a.exe的情况下
写一个b.exe来做这个效果

解决方案 »

  1.   

    a.exe是已经运行的一个程序
    显示了一个不透明的FormAb.exe是我需要写的程序
    功能就是让FormA变成透明最好能支持透明度百分比
      

  2.   

    FormA不能改是把。
    那你让b.exe保存一个FormA的引用。
    然后在b.exe中更改FormA 的opacity属性。
      

  3.   

    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;namespace WindowsFormsApplication1
    {
        public partial class Form1 : Form
        {       
            public Form1()
            {
                InitializeComponent();
            }        private void button1_Click(object sender, EventArgs e)
            {
                Form2 frm = new Form2();
                frm.Show();
                this.Opacity = frm.caps;
            }     
           
        }
    }
    /////////////////////
    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;namespace WindowsFormsApplication1
    {
        public partial class Form2 : Form
        {
            public double caps = 0.5;
            public Form2()
            {
                InitializeComponent();
            }
           
        }
    }
    这是Winform 之间的变化 你看有用么?
      

  4.   

    大概就是用  Opacity 的属性来变化的。。
      

  5.   

    http://developer.51cto.com/art/200909/149833.htm
      

  6.   

    用timer 控件每秒Opacity去加上透明度!例如:this.Opacity +=0.5; !
      

  7.   

    是2个独立的exe
    不是一个exe中
      

  8.   

    是什么个意思? 一个EXE改变另一个EXE??
      

  9.   

    如果A.exe的透明度是通过读取配置文件或者其他方式(非硬编码)来获取的,这个是可能实现的。只需要B.exe去修改那个配置项即可。
      

  10.   

    我想到一个方法,就是你可以将FormA中设定一个Button,取名为“透明”,在Button_Click事件中,写上是窗体透明的方法,比如:this.Opacity =0.5;
    在B.exe中通过窗口句柄,获取到Button的句柄,然后通过SendMessage发送点击事件,实现窗口透明。
      

  11.   

    18楼的用api。23楼的方法,a.exe还需要另外的接受和处理message。
    推荐18的方法。
      

  12.   

    18楼正解
    只有APIFindWindow
    GetWindowLong
    SetWindowLong
    SetLayeredWindowAttributes2个独立的exe
    原本不支持透明
    我强行改而已