![]() |
2008-03-25
, 17:36
|
|
Posts: 693 |
Thanked: 502 times |
Joined on Jul 2007
|
#32
|
![]() |
2008-03-25
, 21:12
|
|
Posts: 549 |
Thanked: 502 times |
Joined on Feb 2008
@ Bowling Green Ohio (united states)
|
#33
|
![]() |
2008-03-25
, 23:26
|
|
Posts: 693 |
Thanked: 502 times |
Joined on Jul 2007
|
#34
|
![]() |
2008-03-26
, 02:53
|
|
Posts: 549 |
Thanked: 502 times |
Joined on Feb 2008
@ Bowling Green Ohio (united states)
|
#35
|
![]() |
2008-03-26
, 03:27
|
|
Posts: 693 |
Thanked: 502 times |
Joined on Jul 2007
|
#36
|
![]() |
2008-04-20
, 21:09
|
|
Posts: 693 |
Thanked: 502 times |
Joined on Jul 2007
|
#37
|
![]() |
2008-04-21
, 13:32
|
Posts: 53 |
Thanked: 44 times |
Joined on Feb 2008
|
#39
|
![]() |
2008-04-21
, 14:55
|
|
Posts: 693 |
Thanked: 502 times |
Joined on Jul 2007
|
#40
|
Looks excellent Pipeline. Are the 2.0 Winform libraries working properly with the previous version?
error CS2001: Source file `roundedrects.cs' could not be found
Compilation failed: 1 error(s), 0 warnings
/home/user/mcs #
But even when i verry carefully type the compile in frome the web page and frome what you provided i still get the same eror. is this case-sensitive eror a bug in the compiler or frome a nother cause?
here's my program:
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using Cairo;
using Gtk;
public class GtkCairo
{
static void Main ()
{
Application.Init ();
Gtk.Window w = new Gtk.Window ("Mono-Cairo Rounded Rectangles");
DrawingArea a = new CairoGraphic ();
Box box = new HBox (true, 0);
box.Add (a);
w.Add (box);
w.Resize (500, 500);
w.DeleteEvent += close_window;
w.ShowAll ();
Application.Run ();
}
static void close_window (object obj, DeleteEventArgs args)
{
Application.Quit ();
}
}
public class CairoGraphic : DrawingArea
{
static double min (params double[] arr)
{
int minp = 0;
for (int i = 1; i < arr.Length; i++)
if (arr[i] < arr[minp])
minp = i;
return arr[minp];
}
static void DrawRoundedRectangle (Cairo.Context gr, double x, double y, double width, double height, double radius)
{
gr.Save ();
if ((radius > height / 2) || (radius > width / 2))
radius = min (height / 2, width / 2);
gr.MoveTo (x, y + radius);
gr.Arc (x + radius, y + radius, radius, Math.PI, -Math.PI / 2);
gr.LineTo (x + width - radius, y);
gr.Arc (x + width - radius, y + radius, radius, -Math.PI / 2, 0);
gr.LineTo (x + width, y + height - radius);
gr.Arc (x + width - radius, y + height - radius, radius, 0, Math.PI / 2);
gr.LineTo (x + radius, y + height);
gr.Arc (x + radius, y + height - radius, radius, Math.PI / 2, Math.PI);
gr.ClosePath ();
gr.Restore ();
}
static void DrawCurvedRectangle (Cairo.Context gr, double x, double y, double width, double height)
{
gr.Save ();
gr.MoveTo (x, y + height / 2);
gr.CurveTo (x, y, x, y, x + width / 2, y);
gr.CurveTo (x + width, y, x + width, y, x + width, y + height / 2);
gr.CurveTo (x + width, y + height, x + width, y + height, x + width / 2, y + height);
gr.CurveTo (x, y + height, x, y + height, x, y + height / 2);
gr.Restore ();
}
protected override bool OnExposeEvent (Gdk.EventExpose args)
{
using (Context g = Gdk.CairoHelper.Create (args.Window)){
DrawCurvedRectangle (g, 30, 30, 300, 200);
DrawRoundedRectangle (g, 70, 250, 300, 200, 40);
g.Color = new Color (0.1, 0.6, 1, 1);
g.FillPreserve ();
g.Color = new Color (0.2, 0.8, 1, 1);
g.LineWidth = 5;
g.Stroke ();
}
return true;
}
}
p.s. That advice you provided finaly made my hello.cs program compile and run successfuly!