Windows上的GTK#:如何让桌面alpha混合工作?

时间:2010-05-18 12:04:25

标签: gtk transparency gtk# alphablending

SUBJ。我找到this并翻译成下面的代码。但它只显示一个没有透明度的深蓝色矩​​形。

class MainClass
{
    public static void Main (string[] args)
    {
        Application.Init();
        Gtk.Window w = new Gtk.Window(Gtk.WindowType.Toplevel);
        w.ExposeEvent += new ExposeEventHandler(w_ExposeEvent);
        w.DeleteEvent += new DeleteEventHandler(w_DeleteEvent);
        w.Decorated = false;
        w.BorderWidth = 20;
        w.AppPaintable = true;
        w.Colormap = w.Screen.RgbaColormap;
        w.Show();
        Application.Run();
    }

    static void w_ExposeEvent(object o, ExposeEventArgs args)
    {
        Context context = CairoHelper.Create(args.Event.Window);
        context.SetSourceRGBA(0.0, 0.0, 50.0, 0.2);
        context.Operator = Operator.Source;
        context.Paint();
    }

    static void w_DeleteEvent(object o, DeleteEventArgs args)
    {
        Application.Quit();
    }
}

0 个答案:

没有答案
相关问题