Imports System Imports System.Drawing Imports System.Windows.Forms Imports Microsoft.DirectX Imports Microsoft.DirectX.Direct3D Public Class HelloForm Inherits Form Private device_ As Device Private presentParam_ As PresentParameters Private font_ As Microsoft.DirectX.Direct3D.Font Public Sub New() MyBase.Size = New Size(640, 480) Me.Text = "Hello, World!" End Sub Public Function InitD3D() As Boolean Me.presentParam_ = New PresentParameters() Me.presentParam_.Windowed = True Me.presentParam_.SwapEffect = SwapEffect.Discard Me.device_ = New Device(0, DeviceType.Hardware, Me, CreateFlags.HardwareVertexProcessing, Me.presentParam_) Me.InitFont() Return True End Function Private Sub InitFont() Dim description As FontDescription = New FontDescription() description.Height = 16 description.FaceName = "MS ゴシック" Me.font_ = New Microsoft.DirectX.Direct3D.Font(Me.device_, description) End Sub Public Sub Render() If Not Me.device_ Is Nothing Then Me.device_.Clear(ClearFlags.Target, Color.Blue, 1.0F, 0) Me.device_.BeginScene() Me.font_.DrawText(Nothing, "Hello, DirectX(VB.NET) World!", New Point(10, 10), Color.White) Me.device_.EndScene() Me.device_.Present() End If End Sub Shared Sub Main() Using helloForm As New HelloForm() helloForm.InitD3D() helloForm.Show() While helloForm.Created helloForm.Render() Application.DoEvents() End While End Using End Sub End Class