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();
}
}
精彩评论