Sign in to follow this  
andy1

Windows 98 and ME Problems

Recommended Posts

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)
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


Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this