真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

vb.net編程例子 vb教程編程實(shí)例詳解pdf

用VB.NET編寫(xiě)以下程序。

using?System;

成都創(chuàng)新互聯(lián)主營(yíng)南康網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營(yíng)網(wǎng)站建設(shè)方案,App定制開(kāi)發(fā),南康h5微信小程序開(kāi)發(fā)搭建,南康網(wǎng)站營(yíng)銷(xiāo)推廣歡迎南康等地區(qū)企業(yè)咨詢(xún)

using?System.Windows.Forms;

namespace?WindowsFormsApplication1

{

public?partial?class?Form1?:?Form

{

Timer?tm?=?new?Timer();//實(shí)例化?timeer?

static?int?timeS?=?0;?//設(shè)置靜態(tài)變量記錄秒數(shù)

TimeSpan?ts?=?new?TimeSpan();?//實(shí)例化?TimeSpan?

public?Form1()

{

InitializeComponent();

}

private?void?button1_Click(object?sender,?EventArgs?e)

{

tm.Interval?=?1000;?//設(shè)置?timeer?1000毫秒執(zhí)行一次

tm.Tick?+=?new?EventHandler(timeer_Tick);?//設(shè)置?timeer?運(yùn)行事件

tm.Start();?//?啟用?timeer

}

private?void?timeer_Tick(object?sender,?EventArgs?e)

{

timeS?+=?1;?//秒數(shù)?+1?

ts?=?new?TimeSpan(0,?0,?timeS);?

label1.Text?=?ts.Hours?+?":"?+?ts.Minutes?+?":"?+?ts.Seconds;

}

private?void?button2_Click(object?sender,?EventArgs?e)

{

tm.Stop();

timeS?=?0;

}

}

}

VB.net實(shí)例

1 生成txt文件。

DimSaveFileDialog1AsNewSaveFileDialog()?'創(chuàng)建一個(gè)保存對(duì)話(huà)框

SaveFileDialog1.Filter?="txt?files?(*.txt)|*.txt"?'設(shè)置擴(kuò)展名

IfSaveFileDialog1.ShowDialog()?=?System.Windows.Forms.DialogResult.OKThen?'如果確定保存

My.Computer.FileSystem.WriteAllText(SaveFileDialog1.Filename,?Textbox1.Text,False)?'保存文本,False表示不追加文本,直接覆蓋其內(nèi)容

EndIf

原文鏈接:

vb.net編程一個(gè)用鍵盤(pán)控制的東西

最簡(jiǎn)單的加速運(yùn)動(dòng)示例,直接拷貝代碼,即可用方向鍵控制控件移動(dòng)

Public?Class?最簡(jiǎn)單的加速運(yùn)動(dòng)

Dim?左右,?上下?As?Integer

Dim?X,?Y,?VX,?VY,?VA?As?Double

Dim?WithEvents?時(shí)鐘?As?New?Timer

Dim?WithEvents?移動(dòng)控件?As?New?Label

Private?Sub?Form1_Load(sender?As?Object,?e?As?EventArgs)?Handles?MyBase.Load

Me.KeyPreview?=?True

VA?=?0.5

X?=?300.0

Y?=?300.0

移動(dòng)控件.BackColor?=?Color.MediumPurple

移動(dòng)控件.Size?=?New?Size(60,?60)

Controls.Add(移動(dòng)控件)

時(shí)鐘.Interval?=?25

時(shí)鐘.Enabled?=?True

End?Sub

Private?Sub?Form1_KeyDown(sender?As?Object,?e?As?KeyEventArgs)?Handles?MyBase.KeyDown

If?e.KeyCode?=?Keys.Up?Then?上下?=?-1

If?e.KeyCode?=?Keys.Down?Then?上下?=?1

If?e.KeyCode?=?Keys.Left?Then?左右?=?-1

If?e.KeyCode?=?Keys.Right?Then?左右?=?1

End?Sub

Private?Sub?Form1_KeyUp(sender?As?Object,?e?As?KeyEventArgs)?Handles?MyBase.KeyUp

If?e.KeyCode?=?Keys.Up?Then?上下?=?0

If?e.KeyCode?=?Keys.Down?Then?上下?=?0

If?e.KeyCode?=?Keys.Left?Then?左右?=?0

If?e.KeyCode?=?Keys.Right?Then?左右?=?0

End?Sub

Private?Sub?時(shí)鐘_Tick(sender?As?Object,?e?As?EventArgs)?Handles?時(shí)鐘.Tick

VX?=?Math.Min(VX?+?左右?*?VA,?10)

VY?=?Math.Min(VY?+?上下?*?VA,?10)

X?+=?VX

Y?+=?VY

If?X??0?Then?X?=?2?:?VX?=?-VX

If?Y??0?Then?Y?=?2?:?VY?=?-VY

If?X??Width?-?移動(dòng)控件.Width?Then?X?=?Width?-?移動(dòng)控件.Width?-?2?:?VX?=?-VX

If?Y??Height?-?移動(dòng)控件.Height?Then?Y?=?Height?-?移動(dòng)控件.Height?-?2?:?VY?=?-VY

移動(dòng)控件.Location?=?New?Point(X,?Y)

End?Sub

End?Class


當(dāng)前名稱(chēng):vb.net編程例子 vb教程編程實(shí)例詳解pdf
網(wǎng)頁(yè)路徑:http://weahome.cn/article/hhcehh.html

其他資訊

在線咨詢(xún)

微信咨詢(xún)

電話(huà)咨詢(xún)

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部