Programming I am a VB programmer, has been doing the development of database applications, do a long time to feel very boring, very want to change the taste, but suffer from no learning time and information, happened to see CSDN on other people write learning experience, I also quickly into the door. Good things dare not to enjoy, as I study at the same time, the original C # program changed to vb.net code, but the idea is the same, only for your reference.
(Thanks to the original author.) Original: Http://blog.csdn.net/ygrx/archive/2005/03/02/307781.aspx?Pending=true)
Public Class Form1
Inherits System.Windows.Forms.Form
#Region "code generated by the Windows forms Designer"
Public Sub New ()
MyBase.New ()
' This call is required by the Windows Forms Designer.
InitializeComponent ()
' Add any initialization after the InitializeComponent () call
Me.setstyle (Controlstyles.allpaintinginwmpaint Or controlstyles.opaque, True)
End Sub
' Form overrides dispose to clean up the list of components.
Protected Overloads Overrides Sub Dispose (ByVal disposing as Boolean)
If disposing Then
If not (components are nothing) Then
Components. Dispose ()
End If
End If
Mybase.dispose (disposing)
End Sub
' Required by the Windows Forms Designer
Private Components as System.ComponentModel.IContainer
' NOTE: The following procedure is required by the Windows Forms Designer
' You can use the Windows Forms Designer to modify this procedure.
' Do not modify it using the Code Editor.
<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
Arran published in 2005-03-22 2:49 PM
Private Device as device
Public Sub Initializegraphics ()
' Set parameters
Dim presentparams as PresentParameters = New presentparameters
' Create a Device
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 ()
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.