Gnome.CanvasText Class
Text canvas item

See Also: CanvasText Members

Syntax

public class CanvasText : CanvasItem

Remarks

A canvas item for displaying text. See Gnome.CanvasRichText for a more advanced text display and editing canvas item.

Example

Example

using System;
using Gtk;
using GtkSharp;
using Gnome;

class CanvasTest
{

	public CanvasTest()
	{
		Application.Init();

 		Window window1 = new Window("Hello Canvas!");
		window1.DeleteEvent += new DeleteEventHandler (delete_event);

		Canvas canvas1 = Canvas.NewAa();

		int Width = 100;
		int Height = 100;

		canvas1.SetScrollRegion(0, 0, Width, Height);
		canvas1.WidthRequest = Width;
		canvas1.HeightRequest = Height;
		CanvasGroup root = canvas1.Root();

		// Draw Background

		CanvasRect background = new CanvasRect(root);
		background.X1 = 0;
		background.X2 = Width;
		background.Y1 = 0;
		background.Y2 = Height;
		background.FillColor = "#ffffff";
		background.Show();

        // Here we go

		CanvasText hello = new CanvasText(root);
		hello.X = 40;
		hello.Y = 10;
		hello.FillColor = "#000000";
		hello.Text = "Hello, Canvas!";
		hello.Show();

		canvas1.Show();

		window1.Add(canvas1);
		window1.ShowAll();
		Application.Run();
	}

	public static void Main()
	{
		new CanvasTest();
	}

	void delete_event (object obj, DeleteEventArgs args)
	{
		Application.Quit ();
	}
}
      

Requirements

Namespace: Gnome
Assembly: gnome-sharp (in gnome-sharp.dll)
Assembly Versions: 2.20.0.0