Skip to content

Instantly share code, notes, and snippets.

@wieslawsoltes
Created July 10, 2015 06:53
Show Gist options
  • Save wieslawsoltes/558f2079ff749650f3cf to your computer and use it in GitHub Desktop.
Save wieslawsoltes/558f2079ff749650f3cf to your computer and use it in GitHub Desktop.
using System;
using System.Diagnostics;
using Eto.Drawing;
using Eto.Forms;
namespace ConsoleApplication22
{
class MyForm : Form
{
public MyForm()
{
this.ClientSize = new Eto.Drawing.Size(500, 500);
this.Title = "Hello, Eto.Forms " + Platform.ID;
var drawable = new Drawable(false) { Size = new Size(700, 600) };
int i = 0;
drawable.Paint += (sender, e) =>
{
Debug.Print(DateTime.UtcNow.ToString("yyyy-MM-dd hh:mm:ss.fff") + " Draw #" + ++i + " Rect: " + e.ClipRectangle.ToString());
var g = e.Graphics;
g.Clear(Brushes.White);
for (float y = 10f; y < 390f; y += 1f)
g.DrawLine(Colors.Red, new PointF(10f, y), new PointF(390f, y));
};
var layout = new PixelLayout();
layout.Add(drawable, 0, 0);
Content = layout;
}
}
class Program
{
[STAThread]
static void Main(string[] args)
{
new Application(Eto.Platforms.Wpf).Run(new MyForm());
}
}
}
using System;
using System.Diagnostics;
using Eto.Drawing;
using Eto.Forms;
namespace ConsoleApplication22
{
class MyForm : Form
{
public MyForm()
{
this.ClientSize = new Eto.Drawing.Size(500, 500);
this.Title = "Hello, Eto.Forms " + Platform.ID;
var drawable = new Drawable(true) { Size = new Size(700, 600) };
int i = 0;
drawable.Paint += (sender, e) =>
{
Debug.Print(DateTime.UtcNow.ToString("yyyy-MM-dd hh:mm:ss.fff") + " Draw #" + ++i + " Rect: " + e.ClipRectangle.ToString());
var g = e.Graphics;
g.Clear(Brushes.White);
for (float y = 10f; y < 390f; y += 1f)
g.DrawLine(Colors.Red, new PointF(10f, y), new PointF(390f, y));
};
var layout = new PixelLayout();
layout.Add(drawable, 0, 0);
Content = layout;
}
}
class Program
{
[STAThread]
static void Main(string[] args)
{
new Application(Eto.Platforms.Wpf).Run(new MyForm());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment