Based off this previous post Draw on the screen without a form, I am trying to draw a multi line string to the screen using GDI+. It is slow enough to where I can see it draw across line by line. Am I just using the wrong API? I am trying to make a simple browser layout engine in C#, if that matters.
using System;
using System.Drawing;
using System.Runtime.InteropServices;
[DllImport("User32.dll")]
static extern IntPtr GetDC(IntPtr hwnd);
[DllImport("User32.dll")]
static extern int ReleaseDC(IntPtr hwnd, IntPtr dc);
static void Main(string[] args)
{
IntPtr desktop = GetDC(IntPtr.Zero);
using (Graphics g = Graphics.FromHdc(desktop))
{
g.DrawString(multiLineText, new Font(FontFamily.GenericSansSerif, 20), Brushes.White, new RectangleF(0, 0, 1920, 1280));
}
ReleaseDC(IntPtr.Zero, desktop);
}