人人做人人澡人人爽欧美,国产主播一区二区,久久久精品五月天,羞羞视频在线观看免费

當前位置:蘿卜系統下載站 > 技術開發教程 > 詳細頁面

與我一起基礎Direct3D的VB.net編程

與我一起基礎Direct3D的VB.net編程

更新時間:2022-08-30 文章作者:未知 信息來源:網絡 閱讀次數:

  我是個VB程序員,一直在做數據庫應用程序的開發,做的時間長了就感覺很煩悶,很想換換口味,但苦于沒有學習時間和資料,恰巧看到CSDN上他人寫的學習經驗,我也就很快的入了門。好東西不敢獨享,隨著我學習的同時,把原來的C#程序改成了vb.net的代碼,但思路還是一樣的,僅供大家參考。

Imports Microsoft.DirectX
Imports Microsoft.DirectX.Direct3D

Public Class Form1
Inherits System.Windows.Forms.Form

#Region " Windows 窗體設計器生成的代碼 "

Public Sub New()
MyBase.New()

'該調用是 Windows 窗體設計器所必需的。
InitializeComponent()

'在 InitializeComponent() 調用之后添加任何初始化
Me.SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.Opaque, True)
End Sub

'窗體重寫 dispose 以清理組件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Windows 窗體設計器所必需的
Private components As System.ComponentModel.IContainer

'注意: 以下過程是 Windows 窗體設計器所必需的
'可以使用 Windows 窗體設計器修改此過程。
'不要使用代碼編輯器修改它。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Name = "Form1"
Me.Text = "Form1"

End Sub

#End Region


阿游 發表于 2005-03-22 2:49 PM   
Private device As Device

Public Sub InitializeGraphics()
'設置參數
Dim presentParams As PresentParameters = New PresentParameters

presentParams.Windowed = True '窗口模式
presentParams.SwapEffect = SwapEffect.Discard '交換

'創建設備
device = New Device(0, DeviceType.Hardware, Me, CreateFlags.SoftwareVertexProcessing, presentParams)
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
InitializeGraphics()
End Sub

Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
device.Clear(ClearFlags.Target, System.Drawing.Color.CadetBlue, 1.0F, 0)

Dim verts(2) As CustomVertex.TransformedColored
verts(0).Position = New Vector4(Me.Width / 2.0F, 50.0F, 0.5F, 1.0F)
verts(0).Color = System.Drawing.Color.Aqua.ToArgb()
verts(1).Position = New Vector4(Me.Width - Me.Width / 5.0F, Me.Height - Me.Height / 5.0F, 0.5F, 1.0F)
verts(1).Color = System.Drawing.Color.Black.ToArgb()
verts(2).Position = New Vector4(Me.Width / 5.0F, Me.Height - Me.Height / 5.0F, 0.5F, 1.0F)
verts(2).Color = System.Drawing.Color.Purple.ToArgb()
device.BeginScene()
device.VertexFormat = CustomVertex.TransformedColored.Format
device.DrawUserPrimitives(PrimitiveType.TriangleList, 1, verts)
device.EndScene()
device.Present()

Me.Invalidate()
End Sub
End Class


溫馨提示:喜歡本站的話,請收藏一下本站!

本類教程下載

系統下載排行

網站地圖xml | 網站地圖html
主站蜘蛛池模板: 天气| 迁西县| 静乐县| 江北区| 宜都市| 江山市| 小金县| 易门县| 航空| 沈丘县| 策勒县| 衢州市| 平武县| 阳城县| 铜梁县| 东源县| 图木舒克市| 寻乌县| 镇巴县| 深水埗区| 丹棱县| 马公市| 东乌珠穆沁旗| 都昌县| 海南省| 久治县| 高平市| 鲜城| 高邑县| 称多县| 大兴区| 论坛| 名山县| 吉首市| 昌邑市| 上虞市| 台东县| 武陟县| 调兵山市| 兰坪| 自贡市|