vb.net心形图案,vbs心形代码
如何在vb中用星号打出心形
Private Sub Command1_Click()
公司主营业务:网站设计、成都网站设计、移动网站开发等业务。帮助企业客户真正实现互联网宣传,提高企业的竞争能力。创新互联公司是一支青春激扬、勤奋敬业、活力青春激扬、勤奋敬业、活力澎湃、和谐高效的团队。公司秉承以“开放、自由、严谨、自律”为核心的企业文化,感谢他们对我们的高要求,感谢他们从不同领域给我们带来的挑战,让我们激情的团队有机会用头脑与智慧不断的给客户带来惊喜。创新互联公司推出怀仁免费做网站回馈大家。
Print " ** **"
Print "**** ****"
Print "************"
Print " **********"
Print " ********"
Print " ******"
Print " ****"
Print " **"
End Sub
'请参考采纳!谢谢!
如何用VB.NET画同心圆
窗体上添加一个按钮,在该按钮的单击事件里编写代码如下:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'声明窗体的Me.CreateGraphics对象
Dim MyGraphics As Graphics = Me.CreateGraphics
Dim Cx As Integer = 150 '圆心的X坐标
Dim Cy As Integer = 150 '圆心的Y坐标
Dim R As Integer '圆的半径
'绘制半径为R的圆
For R = 5 To 100 Step 5
MyGraphics.DrawEllipse(Pens.Black, New Rectangle(Cx - R, Cy - R, 2 * R, 2 * R))
Next
End Sub
‘用黑色画笔绘制一组同心圆,半径从5开始,增量为5。
说明:
DrawEllipse是VB.Net的Graphics类的绘制椭圆的方法;他有几种格式,上面使用的是一种;
DrawEllipse(画笔的颜色,绘制椭圆所需要的矩形区域)
其中:绘制椭圆所需要的矩形区域,如果被定义为正方形,就演变成绘制圆,定义该区域由死个数值确定,第1个数值,确定该区域左上角的X坐标,第2个数值,确定该区域左上角的Y坐标,第3个数值,确定该区域的宽度,第4个数值,确定该区域的高度。
例如1:
DrawEllipse(Pens.Black, New Rectangle(150, 150, 50, 50))
就是以圆心坐标为(100,100),绘制半径为50 的圆。其实在VB.NET中,是告诉系统在以左上角坐标(150,150),边长为50的正方形里绘制内切圆。理解了是在正方形里绘制内切圆,就可以通过数学计算,知道如何绘制了。
同理例如2:
DrawEllipse(Pens.Black, New Rectangle(150, 150, 100, 50))
就是以圆心坐标为(100,100),绘制半径为50 的圆。其实在VB.NET中,是告诉系统在以左上角坐标(150,150),长轴为100,短轴为50的内切椭圆。
VB绘心形图源代码
放入一个按钮复制下面代码即可
Private Sub Command1_Click()
Print "/\/\"
Print "\ /"
Print " \/"
End Sub
怎么用VB变心形窗体
Option Explicit
'类型声明
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
'API声明
Private Declare Function BeginPath Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal lpString As String, ByVal nCount As Long) As Long
Private Declare Function EndPath Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function PathToRegion Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function GetRgnBox Lib "gdi32" (ByVal hRgn As Long, lpRect As RECT) As Long
Private Declare Function CreateRectRgnIndirect Lib "gdi32" (lpRect As RECT) As Long
Private Declare Function CombineRgn Lib "gdi32" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long
Private Const RGN_AND = 1
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hwnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Sub Form_Load()
Dim hRgn1, hRgn2 As Long
Dim rct As RECT
Dim rtn As Long
With Me
.BorderStyle = 0
.Caption = ""
.Font.Name = "Webdings" '设置字体
.Font.Size = 100
.Font.Bold = True
.BackColor = vbRed
.FontTransparent = True
End With
BeginPath hdc
'为窗体形状产生路径
TextOut hdc, 0, 0, "Y", 1 '字符Y的Webdings字体下是心形,1表示一个字节
EndPath hdc
hRgn1 = PathToRegion(hdc)
'将指定路径转换为区域
GetRgnBox hRgn1, rct
'获取完全包含指定区域的最小矩形
hRgn2 = CreateRectRgnIndirect(rct)
'创建rct确定的矩形区域
CombineRgn hRgn2, hRgn2, hRgn1, RGN_AND
DeleteObject hRgn1
'删除GDI对象,释放占用的系统资源
SetWindowRgn hwnd, hRgn2, 1
End Sub
Private Sub Form_DblClick()
Unload Me
End Sub
如何用vb 打印出心形图案 用“*”打印 在线等 急!
Private Sub Form_Load()
Me.AutoRedraw = True
Me.Width = 5000
Me.Height = 5500
Me.ForeColor = vbRed
Me.FontSize = 12
Me.Scale (-10, 10)-(10, -10)
For i = 0 To 3.1415926 Step 0.2
CurrentX = -Cos(i) * 4 - 4
CurrentY = Sin(i) * 4 + 3
Print "*"
CurrentX = Cos(i) * 4 + 4
CurrentY = Sin(i) * 4 + 3
Print "*"
Next i
For i = 0 To 8 Step 0.5
CurrentX = 8 - i
CurrentY = -i + 2
Print "*"
CurrentX = i - 8
CurrentY = -i + 2
Print "*"
Next i
End Sub
可以让玫瑰花一朵朵出现围成一个桃心的VB程序
首先你要准备一个玫瑰花图片文件,要小一点。
然后在窗体上放12个Image控件,组成一个控件数组,摆成心形,Picture属性设置为你的玫瑰花。Visibel属性全部设置为False。
在窗体上放一个Timer控件。Interval属性设置为1000,每秒显示一朵玫瑰花。
OK!你的心愿完成了!
Private Sub Form_Load()
For i = 0 To 11
Image1(i).Picture = LoadPicture(App.Path + "\西安绿博园七彩玫瑰.jpg")
Next
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Static i As Integer
Image1(i).Visible = True
i = i + 1
If i = Image1.Count Then
Label1.Visible = True
Timer1.Enabled = False
End If
End Sub
本文标题:vb.net心形图案,vbs心形代码
标题URL:http://azwzsj.com/article/hojcdj.html