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
你要控制你的圓在一個容器裡面移動吧
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
弄個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 ",");
}
Private Sub Command1_Click()
End
End Sub
Private Sub Form_Click()
n = CInt(InputBox("請輸入一個奇數","資料輸入"))
For i = 1 To n
Print Tab(51 - i);
For j = 1 To 2 * i - 1
Print Trim(Str(n Mod 10));
Next j
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
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中文網其他相關文章!