Index: controls/Image.rb
===================================================================
--- controls/Image.rb	(revision 23)
+++ controls/Image.rb	(working copy)
@@ -7,7 +7,8 @@
 class Image < Panel
   attr_accessor :image
   
-  @@types = {
+  # constant hash with image types
+  Types = {
     "bmp"  => Wx::BITMAP_TYPE_BMP,
     "gif"  => Wx::BITMAP_TYPE_GIF,
     "jpg"  => Wx::BITMAP_TYPE_JPEG,
@@ -17,20 +18,30 @@
     "pnm"  => Wx::BITMAP_TYPE_PNM,
     "tif"  => Wx::BITMAP_TYPE_TIF,
     "tiff" => Wx::BITMAP_TYPE_TIF,
-    "xpm"  => Wx::BITMAP_TYPE_XPM
+    "xpm"  => Wx::BITMAP_TYPE_XPM,
+    ""  => Wx::BITMAP_TYPE_ANY
     }
-  
+   
   # Initialise the control
   def initialize(template, parent)
     super(template, parent)
+    wxControl.evt_paint() { on_paint }
     self
   end
-  
+   
   # create the physical control and load the image
   def create_control(parent)
     ctrl = super(parent)
-    if !template.source.nil?
-      self.image = Wx::Bitmap.new(template.source, Wx::BITMAP_TYPE_ANY)
+    unless template.source.nil?
+      # check the file extention and figure out the image type
+      filename = template.source
+      file_extension = filename[(filename.rindex(".").to_i+1)..-1]
+      # if unknown extention, set it to "" 
+      # so Wx::BITMAP_TYPE_ANY will be chosen
+      if Types[file_extension] == nil
+        file_extension = ""
+      end   
+      self.image = Wx::Bitmap.new(filename, Types[file_extension])
     end
     return ctrl
   end
