Imports Microsoft.DirectX
Imports Microsoft.DirectX.Direct3D
Public Class frmTest
Inherits System.Windows.Forms.Form
'DirectX objects
Private f As Direct3D.Font
Private device As device = Nothing
Sub New()
'Setup form
Me.Text = "DirectX Test"
'Presentation parameters
Dim presentParams As New PresentParameters()
presentParams.Windowed = True
presentParams.SwapEffect = SwapEffect.Discard
'Setup device
device = New Device(0, DeviceType.Hardware, Me, CreateFlags.SoftwareVertexProcessing, presentParams)
'Create font
f = New Direct3D.Font(device, New System.Drawing.Font(FontFamily.GenericSansSerif, 8))
'Show the form
Show()
'Render loop
While Created
'Clear the backbuffer to a blue color
device.Clear(ClearFlags.Target, System.Drawing.Color.Blue, 1.0F, 0)
'Begin the scene
device.BeginScene()
'Draw some text
With f
.Begin()
.DrawText("Hello, World!", New Rectangle(0, 0, 1000, 1000), DrawTextFormat.Top Or DrawTextFormat.Left, Color.White)
.End()
End With
'End the scene
device.EndScene()
device.Present()
'DoEvents
Application.DoEvents()
End While
'End the program
End
End Sub
End Class
Windows 98 and ME Problems
When I run my program using DirectX 9 and VB.NET on Windows 98 and Me, everything that is drawn with D3DFont.DrawText shows a box after the text. Can someone point out a problem with this code (only 57 lines).
Download to run it (1.74 KB)
Does it not do it with Windows 2000 or XP? Also, what do you mean by draws a box. That could be anything. Is it an outline, 1 pixel width, filled in, etc.
Chris
Chris
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement