private void Form1_Paint(object sender, PaintEventArgs e) { ++frames; var fx = e.Graphics; using ( var buffer = new Bitmap( ClientSize.Width, ClientSize.Height ) ) { using ( var clr = Graphics.FromImage(buffer) ) clr.Clear( Color.Transparent ); var target = buffer.LockBits( ClientRectangle, System.Drawing.Imaging.ImageLockMode.ReadWrite, System.Drawing.Imaging.PixelFormat.Format32bppArgb ); int y = 0; while ( y < ClientSize.Height ) { #if false string text = "Hello, World!"; Font.RenderLineTo( target, text, new Rectangle(0,y,ClientSize.Width,ClientSize.Height-y), Industry.FX.HorizontalAlignment.Center, VerticalAlignment.Top ); y += Font.MeasureLine(text).Advance.Y; #else Paragraph text = new Paragraph(); text.Add( new TextRun() { Font = RedFont , Text = "He" } ); text.Add( new TextRun() { Font = BlueFont, Text = "llo, W" } ); text.Add( new TextRun() { Font = RedFont , Text = "orld!" } ); var lines = text.ToLines(ClientSize.Width); FX.Font.RenderLinesTo( target, lines, new Rectangle(0,y,ClientSize.Width,int.MaxValue), FX.HorizontalAlignment.Center, VerticalAlignment.Top ); y += FX.Font.MeasureLines(lines).Advance.Y; #endif } DateTime now = DateTime.Now; var span = now-prev; if ( span.TotalSeconds >= 1.0 ) { prev = now; framedisplay = frames; frames = 0; } RedFont.RenderLineTo( target, "FPS: "+framedisplay, ClientRectangle, Industry.FX.HorizontalAlignment.Right, VerticalAlignment.Top ); buffer.UnlockBits(target); fx.DrawImage(buffer,0,0); } Invalidate(); }