[Mono-dev] mono X11 rendering

Alexander Olk xenomorph2 at onlinehome.de
Sat Oct 15 03:21:37 EDT 2005


Am Freitag, den 14.10.2005, 01:03 -0700 schrieb Harry:
> I am developing a simple applications using Thread
> class to change the color of the square (Lab
> assignment). Everything is working properly, except I
> have to drag or cls /opn the windows in linux to fix
> theThread and the only solutions to produce the color
> change.  
> 
> I think it has something todo with the X11 rendering
> in Linux. Are there any solutions to this problems? 

How about that version:

using System;
using System.Windows.Forms;
using System.Drawing;
 
public class ColoredBoxes : Form
{
System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
private Color c;
 
public ColoredBoxes()
 
{
timer.Tick += new EventHandler( OnTimerTick );
timer.Interval = 200;
timer.Start();
}
 
protected override void OnPaint(PaintEventArgs e)
{
Graphics g = e.Graphics;
using( Pen blue = new Pen(c, 3) )
  g.DrawRectangle(blue, 100,100,30,30);
base.OnPaint(e);
}
 
void OnTimerTick( object sender, EventArgs e )
{
Random r = new Random();
 
c = Color.FromArgb(r.Next(256), r.Next(256), r.Next(256));
 
Invalidate();
}
}
 
public class Test{
 
public static void Main()
{
 Application.Run(new ColoredBoxes());
}
}  

Cheers
  Alexander Olk





More information about the Mono-devel-list mailing list