
(Danke)
Würde heute in etwa so aus sehen:
---------------------------------------------
using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Runtime.InteropServices;
public class Form1
{
[DllImport("user32", EntryPoint = "GetDC", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
// Für DC
private static extern IntPtr GetDC(IntPtr hWnd);
[DllImport("user32", EntryPoint = "ReleaseDC", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
private static extern int ReleaseDC(IntPtr hWnd, IntPtr hdc);
[DllImport("gdi32", EntryPoint = "SetTextColor", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
// Für Text
private static extern int SetTextColor(IntPtr hdc, int crColor);
[DllImport("gdi32", EntryPoint = "TextOutA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
private static extern int TextOut(IntPtr hdc, int x, int y, string lpString, int nCount);
[DllImport("gdi32", EntryPoint = "SetBkColor", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
private static extern int SetBkColor(IntPtr hdc, int crColor);
private void MYBUTTON_Click(System.Object sender, System.EventArgs e)
{
//// Variabeln
IntPtr hDC = default(IntPtr);
//// Wichtig! Device Context hohlen
hDC = GetDC(this.Handle);
//// Farbe festlegen
SetTextColor(hDC, Information.RGB(255, 0, 0));
SetBkColor(hDC, Information.RGB(0, 0, 0));
//// Einfacher Text ausgeben
TextOut(hDC, 20, 20, "Hallo", Strings.Len("Hallo"));
//// Wichtig! Device Context wieder freigeben
ReleaseDC(this.Handle, hDC);
}
}
//// Int32 I = this.Handle.ToInt32; ' Würde scheins auch gehen, nicht ... ToInt64
Ich habe dann damals was in Visual Basic .Net gefunden, und habe nun einen Converter von heute, jetzt dazu benutzt. Mittlerweile, kahm dann damals auch auch ein Buch in Visual Basic .Net für DirecktX 9 raus. Noch ne Alternatieve das heutige XNA-Game Studio ... ( Wenn man gerne Shader schreibt )