[Mono-list] Help using Gdk#

ndo at rockwellcollins.com ndo at rockwellcollins.com
Wed Jul 6 14:54:05 EDT 2005


I'm trying to use gtk#,gdk# to load a bitmap, and to use bitmap as a 
drawable area to put texts, and other images on it.

Here is the code. When I run it, I got exception where most methods from 
Gtk.Image don't quite work as expected. Please help


Main source file:

using System;
using GLib;
using Gdk;
using Gtk;

namespace gtksharpTest
{
        public class Program
        {
                static void Main(string[] args)
                {
                        try
                        {
                                Application.Init();
                                Gtk.Image gtkim = new 
Gtk.Image(@"/home/dev/World.bmp");
 
                                Gdk.Pixmap gdkpixmap;
                                Gdk.Pixmap gdkmaskpixmap;

                                gtkim.GetPixmap(out gdkpixmap, out 
gdkmaskpixmap);
 Console.WriteLine("gdkpixmap={0},gdkmaskpixmap",gdkpixmap,gdkmaskpixmap);
 
                        }
                        catch(Exception e)
                        {
                                Console.WriteLine("Exception={0}", 
e.Message);
                        }
                }
        }
}

this is the result when run 

FcInit Enter
FcConfigCreate: config=8369858
FcConfigCreate: config->configDirs=836b6e8,num=0.size=0
FcConfigCreate: config->configFiles=82c5dc0,num=0.size=0
FcConfigCreate: config->fontDirs=8369770,num=0.size=0
FcConfigCreate: config->acceptGlobs=8364490,num=0.size=0
FcConfigCreate: config->rejectGlobs=836a2e8,num=0.size=0
FcConfigCreate: config=8369858,config->cache=/root/.fonts.cache-1

(<unknown>:24941):Gtk-CRITICAL **: file gtkimage.c: line 963 
(gtk_image_get_pixmap): assertion `imag->storage_type == GTK_IMAGE_PIXMAP 
|| image->storage_type == GTK_IMAGE_EMPTY ` failed.

gtksharpTest:Exception=Object reference not set to an instance of an 
object

thanks


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://galactus.ximian.com/pipermail/mono-list/attachments/20050706/b48450c6/attachment-0001.html


More information about the Mono-list mailing list