[Mono-list] gtk# problem

Kent Loobey kent@darkwing.uoregon.edu
Wed, 7 Jul 2004 15:51:18 -0700


On Wednesday 07 July 2004 03:24 pm, Paul wrote:
> Hi,
>
> Below is a very simple piece of code which I'm still trying to compile -
> but all I get is an error (error CS0029: Cannot convert implicitly from
> `System.Drawing.Size' to `Gdk.Size').
>
> How do I fix this problem?
>
> TTFN
>
> Paul
>
> 8---->
>
> using Gtk;
> using GtkSharp;
> using System;
> using System.Drawing

Either comment the above out or change it to:
 using System.Drawing;

>
> public class MyButton
> {
>   public static void Main(string [] args)
>   {
>      Application.Init();
>      Window win = new Window("My first button");
>      win.DefaultSize = new Size(200, 200);

Try changing this to:
      win.DefaultSize = new Gdk.Size(200, 200);

>      Button btn = new Button("Click");
>      win.Add(btn);
>      win.ShowAll();
>      Application.Run();
>    }
> }
>
> mcs gtksharp.cs -r System.Drawing -pkg:gtk-sharp
> gtksharp.cs(11) error CS0029: Cannot convert implicitly from `System.
> Drawing.Size' to `Gdk.Size'
> Compilation failed: 1 error, 0 warnings