2

私は Gtk、Mono、および Gtk# 全般に非常に慣れていません。

多くのチュートリアル、例、およびすべてを経て、エラーのないコードを取得することができました。

DrawingArea map = new DrawingArea ();

window.Add (map);
Pixbuf mapContents = new Pixbuf (Environment.CurrentDirectory + string.Format("{0}maps{0}1.png", Path.DirectorySeparatorChar));

int wWidth = mapContents.Width, wHeight = mapContents.Height;
map.SetSizeRequest (wWidth, wHeight);
map.ExposeEvent += delegate(object o, ExposeEventArgs _args)
{
    Widget widget = (Widget) o;

    Gdk.Rectangle area = _args.Event.Area;
    widget.GdkWindow.DrawPixbuf(widget.Style.BlackGC,
                                mapContents,
                                area.X, area.Y,
                                area.Width, area.Height,
                                area.Width, area.Height,
                                RgbDither.Normal,
                                area.X, area.Y);

    _args.RetVal = true;
};

ただし、エラーはありませんが、意図した機能も欠いています。

私がやりたいのは、背景画像を DrawingArea に追加することですが、空白のままです。

私は何を間違っていますか?

4

0 に答える 0