|
Text 3D
Implementation
Zur Ausgabe von Text sind nur folgende Schritte nötig
- Definition des Fontnames: z.B.: Device.Fontname = "New Roman";
- Setzen der Größe in logischen Einhaiten: z.B.: Device.FontSize = 2.5;
Standard ist Fontsize = 1
- Darstellen: z.B.: Device.DrawText(new xyz(2,2,0),"Drawing 3D");
Die Device bietet noch folgende Methoden an:
- GetTextExtent: Liefert ein umschießendes Rechteck
- Italic : Setzen von Fontstyle auf Italic
- Drahtgitter : Setzen der Eigenschaft PolygonMode = PolygonMode.Line
Beispiel
FormLoad
private void Form1_Load(object sender, EventArgs e)
{ Device.WinControl = this;
Device.OnPaint += new EventHandler(Device_OnPaint);
Device.Navigate = NavigateKind.ZoomRotateTrans;
Device.BackColor = Color.White;
// Setzen des Blickwinkels
Device.FieldOfView = 45;
// Setzen der Camera
Device.Camera.Position = new xyz(0,0,5);
// Focus wird verwendet für die Navigation, in diesem Fall um den Ursprung(0,0,0)
Device.Camera.Focus = 5;
// Fontname
Device.FontName = "Times new roman";
}
DevicePaint
void Device_OnPaint(object sender, EventArgs e)
{
// Größe der Schrift
Device.FontSize = 2;
// Material
Device.Material = Drawing3d.Materials.Materials.Gold;
Device.FontStyle = FontStyle.Italic;
RectangleF R= Device.GetTextExtent("Drawing3d");
// Zentrieren
Device.drawText(new xyz(-R.Width/2, 0, 0), "Drawing3d", 0.5);
}
Und so siehts aus:
|
|