开发者

GTK# on Windows: how to get desktop alpha-blending working?

Subj. I found this and translated into code below. But it shows only a dark-blue rectangle with no transparency at all.

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜