[Gtk-sharp-list] Gdk.Pixbuf.FromDrawable broken?
Andreas Strauss
nivels.arevelec at googlemail.com
Sun Nov 22 15:24:28 EST 2009
Thank you,
I'm working with Ubuntu Linux 9.10, with Monodevelop.
Setting the var GDK_NATIVE_WINDOWS=true don't change anything...
Where can the error come from?
I tried it in an fresh installed VBox-Installation to, the same thing :/
thank you!
2009/11/21 Stephane Delcroix <stephane at delcroix.org>
> works fine here.
> what's your version of gtk+/gdk ?
>
> try setting the env var GDK_NATIVE_WINDOWS=true
>
> regards
>
> s
>
> On Fri, 2009-11-20 at 15:26 -0800, nivels wrote:
> > Hi,
> > i have little problem with getting a pixbuf from a widget.
> >
> > So with the attached Code, i'm able to get a Gdk.Pixbuf from a widget,
> but
> > when i show it in a Gtk.Image it looks "broken".
> > I googled a lot in the last few days, but i'm not able to find a
> solution.
> >
> > I Uploaded a file that you can see what i mean.
> >
> > Thank you!
> >
> > using System;
> > using Gtk;
> >
> > namespace getfromdrawablemono
> > {
> > class MainClass
> > {
> > public static void Main (string[] args)
> > {
> > Application.Init ();
> >
> >
> > Gtk.Window win = new Gtk.Window("Test");
> > Gtk.VBox vbox = new Gtk.VBox(false,10);
> > Gtk.HBox hbox = new Gtk.HBox(true,10);
> > Gtk.Button btn_click = new
> Gtk.Button(Gtk.Stock.Add);
> > Gtk.Button btn_src = new
> Gtk.Button(Gtk.Stock.Copy);
> > Gtk.Image img_dest = new Gtk.Image();
> >
> >
> > win.Add(vbox);
> > vbox.PackStart(btn_click,false,false,2);
> > vbox.PackStart(hbox,true,true,2);
> > hbox.PackStart(btn_src,false,true,2);
> > hbox.PackStart(img_dest,true,true,2);
> > win.DefaultHeight = 200;
> > win.DefaultWidth = 200;
> >
> > win.Destroyed += delegate {
> > Application.Quit();
> > };
> > btn_click.Clicked += delegate(object sender,
> EventArgs e) {
> >
> > int x,y,width,height,dept;
> > btn_src.GdkWindow.GetGeometry(out x,out
> y,out width,out height, out
> > dept);
> > int x2,y2,width2,height2,dept2;
> > img_dest.GdkWindow.GetGeometry(out x2,out
> y2,out width2,out height2, out
> > dept2);
> >
> > Gdk.Pixbuf pb;
> > pb =
> > Gdk.Pixbuf.FromDrawable(btn_src.GdkWindow,btn_src.GdkWindow.Colormap , x
> , y
> > ,0 ,0,width,height);
> >
> > img_dest.Pixbuf = pb;
> >
> > };
> >
> > win.ShowAll();
> >
> > Application.Run ();
> >
> >
> > }
> > }
> > } http://old.nabble.com/file/p26451912/Bildschirmfoto-2.png
> > Bildschirmfoto-2.png
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20091122/fec7c730/attachment-0001.html
More information about the Gtk-sharp-list
mailing list