mail-archives/gtk-sharp-list/2009-February/009404.html

91 строка
3.2 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Gtk-sharp-list] Namespace problem using Gtk.DotNet
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5BGtk-sharp-list%5D%20Namespace%20problem%20using%20Gtk.DotNet&In-Reply-To=498B3269.2090401%40controlspecials.demon.co.uk">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="009403.html">
<LINK REL="Next" HREF="009405.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Gtk-sharp-list] Namespace problem using Gtk.DotNet</H1>
<B>Peter Johanson</B>
<A HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5BGtk-sharp-list%5D%20Namespace%20problem%20using%20Gtk.DotNet&In-Reply-To=498B3269.2090401%40controlspecials.demon.co.uk"
TITLE="[Gtk-sharp-list] Namespace problem using Gtk.DotNet">peter at peterjohanson.com
</A><BR>
<I>Thu Feb 5 13:49:36 EST 2009</I>
<P><UL>
<LI>Previous message: <A HREF="009403.html">[Gtk-sharp-list] Namespace problem using Gtk.DotNet
</A></li>
<LI>Next message: <A HREF="009405.html">[Gtk-sharp-list] Namespace problem using Gtk.DotNet
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#9404">[ date ]</a>
<a href="thread.html#9404">[ thread ]</a>
<a href="subject.html#9404">[ subject ]</a>
<a href="author.html#9404">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>
On Thu, Feb 05, 2009 at 06:39:37PM +0000, Hywel Thomas wrote:
&gt;<i> I'm updating the NPlot Gtk code to use the Gtk.DotNet library, and
</I>&gt;<i> finding that the compiler won't recognise Gtk.DotNet with the current
</I>&gt;<i> NPlot.Gtk namespace. The code below shows the essence of the problem
</I>&gt;<i>
</I>&gt;<i> using System;
</I>&gt;<i> using System.Drawing;
</I>&gt;<i> using Gtk;
</I>
Add the following:
using DNGraphics = Gtk.DotNet.Graphics;
&gt;<i> Gdk.Rectangle area = args.Event.Area;
</I>&gt;<i> using (Graphics g =
</I>&gt;<i> Gtk.DotNet.Graphics.FromDrawable(args.Event.Window)){
</I>
Then this becomes:
using (Graphics g = DNGraphics.FromDrawable(args.Event.Window)){
This uses a little/less known feature of C# know as &quot;type aliases&quot;:
<A HREF="http://msdn.microsoft.com/en-us/library/aa664765(VS.71">http://msdn.microsoft.com/en-us/library/aa664765(VS.71</A>).aspx
in case you're not familiar with it.
-pete
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="009403.html">[Gtk-sharp-list] Namespace problem using Gtk.DotNet
</A></li>
<LI>Next message: <A HREF="009405.html">[Gtk-sharp-list] Namespace problem using Gtk.DotNet
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#9404">[ date ]</a>
<a href="thread.html#9404">[ thread ]</a>
<a href="subject.html#9404">[ subject ]</a>
<a href="author.html#9404">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">More information about the Gtk-sharp-list
mailing list</a><br>
</body></html>