VB視窗中繪製圓形,透過不同的xy輸入來改變圓的位置,並透過鍵盤控制圓形運動

PHPz
發布: 2024-01-23 21:54:23
轉載
572 人瀏覽過

VB視窗中繪製圓形,透過不同的xy輸入來改變圓的位置,並透過鍵盤控制圓形運動

VB在視窗畫個圓輸入不同的xy能改變圓的座標並且讓圓受鍵

Private Sub Picture1_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = vbKeyRight Then

Picture1.Left = Picture1.Left 100

End If

If KeyCode = vbKeyLeft Then

Picture1.Left = Picture1.Left - 100

End If

End Sub

Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

Picture1.Circle (X, Y), 300

End Sub

你要控制你的圓在一個容器裡面移動吧

編寫程式點選窗體時輸入3個數x y z依從小到大的順序依序顯示在窗體

Private Sub Command1_Click()

Dim a As Integer, b As Integer, c As Integer

Dim max As Integer, min As Integer

a = Val(InputBox("輸入第1個整數", "Input"))

b = Val(InputBox("輸入第2個整數", "Input"))

c = Val(InputBox("輸入第3個整數", "Input"))

max = a

If b >max Then max = b

If c >max Then max = c

min = a

If b If c

Print max, a b c - max - min, min

End Sub

設計一個window窗體應用程式要從文字方塊隨機輸入一系列的正

弄個richtextbox,輸入的整數用逗號“,”隔開,例如123,45,67,89這樣,然後

排序按鈕程式碼

private void button1_Click(object sender, EventArgs e)

{

string str = richTextBox1.Text.Replace(" ","").TrimEnd(new char[]{','});

if (!string.IsNullOrEmpty(str.Trim(("1234567890,").ToCharArray())))

{

MessageBox.Show("輸入資料不正確!");

return;

}

string[] strs = str.Split(new char[] { ',' });

int[] lint = new int[strs.Length];

for (int i = 0; i

lint[i] = int.Parse(strs[i]);

Array.Sort(lint);

richTextBox1.AppendText("\r\n從小到大排序為:\r\n");

foreach (int i in lint) richTextBox1.AppendText(i ",");

}

Visual Basic程式設計 1程式執行後自動最大化視窗 2窗體標題xxxxxx

Private Sub Command1_Click()

End

End Sub

Private Sub Form_Click()

n = CInt(InputBox("請輸入一個奇數","資料輸入"))

Print

For i = 1 To n

Print Tab(51 - i);

For j = 1 To 2 * i - 1

Print Trim(Str(n Mod 10));

Next j

Print

Next i

For i = n - 1 To 1 Step -1

Print Tab(51 - i);

For j = 1 To 2 * i - 1

Print Trim(Str(n Mod 10));

Next j

Print

Next i

End Sub

Private Sub Form_Load()

Me.FontSize = 19

Label1.FontSize = 19

Me.WindowState = 2

Me.Caption = "xxxxxx"

Label1.Caption = "xxxx"

#End Sub

以上是VB視窗中繪製圓形,透過不同的xy輸入來改變圓的位置,並透過鍵盤控制圓形運動的詳細內容。更多資訊請關注PHP中文網其他相關文章!

來源:docexcel.net
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!