Hello, I just ditched WinXP a few weeks ago and switched to Ubuntu 8.04, and I'm trying to port my C# Windows.Forms applications over to Gtk#. I have a newly-created sample Gtk# project that simply isn't working, and I'm not sure what it is that I'm doing wrong. I am using Gtk# with the Gtk-dotnet library so that my library files' graphics handling functions don't have to be rewritten. I noticed that many of my images, rectangles, and ellipses are being drawn at the wrong positions on the DrawingArea. Below is my code and a screenshot of the strange behavior I'm seeing.
I'm running monodevelop 1.0 and mono 1.9.1 (from the badgerports Ubuntu repository). I was originally using the official Ubuntu mono 1.2.6 release, but I decided to upgrade mono before coming here for help. It didn't fix anything. I finally figured out what the problem is. For some reason, after drawing an image on the Graphics object, the next thing drawn, NO MATTER WHAT IT IS OR WHERE IT IS PLACED, is offset vertically by about the height of the image drawn. The next thing drawn after that is drawn in its proper position. Have I found a bug in the Gtk.DotNet class library, or I am just not understanding something? I know that certain graphics libraries have a "pen cursor" which moves from place to place, so you can draw a square by saying 'place pen at 50:50, draw 100 right, draw 100 up, draw 100 left, draw 100 down," but that doesn't seem to be the case here because this strange behavior only takes effect after drawing an image. If I draw ellipse->rectangle->image, everything is in the right place. If I draw ellipse->image->rectangle, the rectangle will be shifted down by about the height of the image. Notice that I say "about the height," because as you can see in the attached screenshot, my attempted 4x4 square of images is NOT aligned along 32x32 boundaries. The top-left image is in the proper location, but the other three are shifted down 29 pixels (they shouldn't be shifted down at all), which makes no sense. protected virtual void OnDrawingarea1ExposeEvent (object o, Gtk.ExposeEventArgs args) { System.Drawing.Image pic = new Bitmap("./bots/grad.png"); using( Graphics g = Gtk.DotNet.Graphics.FromDrawable(args.Event.Window) ) { g.Clear(Color.Aqua); g.DrawImage(pic, 50.0F, 50.0F, 32, 32); g.DrawImage(pic, 50.0F, 82.0F, 32, 32); g.DrawImage(pic, 82.0F, 50.0F, 32, 32); g.DrawImage(pic, 82.0F, 82.0F, 32, 32); } } http://www.nabble.com/file/p18116118/monodeveloptest1.png -- View this message in context: http://www.nabble.com/Gtk.DotNet----System.Drawing----Images%2C-strange-behavior-tp18116118p18116118.html Sent from the Mono - Gtk# mailing list archive at Nabble.com. _______________________________________________ Gtk-sharp-list maillist - Gtk-sharp-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/gtk-sharp-list