Mono에서 약간의 작업을하고 있습니다. 창 크기가 바뀔 때마다 이미지가 다시 그려지기를 원합니다. 그러나 ExposeEvent 또는 ConfigureEvent 응용 프로그램에 대한 메서드를 추가하면 응용 프로그램이 떨어집니다. 그것은 무엇일까요? 다음은 일을 충돌 어쩌면, 내 코드EventHandler를 추가 한 후 GTK # 응용 프로그램이 작동을 멈 춥니 다.
using System;
using System.IO;
using Gtk;
public partial class AuthWind: Gtk.Window
{
FileStream bgstream;
public AuthWind() : base (Gtk.WindowType.Toplevel)
{
bgstream = File.Open ("noise-texture.png", System.IO.FileMode.Open);
Build();
HBox mainCont = new HBox (false, 0);
ConfigureEvent += DrawBG;
Gdk.Pixbuf bgbuf = new Gdk.Pixbuf(bgstream, this.Allocation.Width, this.Allocation.Height);
Gdk.Pixmap bgmap = null;
Gdk.Pixmap useless = null;
bgbuf.RenderPixmapAndMask (out bgmap, out useless, 0);
Style st = new Style();
st.SetBgPixmap (StateType.Normal, bgmap);
this.Style = st;
}
void DrawBG(object obj, EventArgs e)
{
Gdk.Pixbuf bgbuf = new Gdk.Pixbuf(bgstream, this.Allocation.Width, this.Allocation.Height);
Gdk.Pixmap bgmap = null;
Gdk.Pixmap useless = null;
bgbuf.RenderPixmapAndMask (out bgmap, out useless, 0);
Style st = new Style();
st.SetBgPixmap (StateType.Normal, bgmap);
this.Style = st;
}
protected void OnDeleteEvent (object sender, DeleteEventArgs a)
{
Application.Quit();
a.RetVal = true;
}
}
이상하게 들릴지 모르지만 응용 프로그램이 컴파일되고 정상적으로 실행되지만 ConfigureEvent는 단지 DrawBG 메서드를 시작하지 않습니다. –