PDA

View Full Version : آموزش: حرکت TextBox بر روی فرم



NASA's Spaceman
جمعه 16 اسفند 1392, 00:29 صبح
سلام
این تاپیک با بقیه یه فرق داره تو کد نویسی
به زبان VB6
Private Sub Timer1_Timer()'timer1.Interval=70 because it normal move
Text1.Left = Text1.Left - 100
If Text1.Left <= -1000 Then Text1.Left = Form1.Width
End Sub

و حالا اینم ترجمه کد به زبان C#
private void timer1_Tick(object sender, EventArgs e) {
//timer1.Interval=70 because it normal move
textBox1.Left = textBox1.Left - 60;
if (textBox1.Left <= -1000)
{
textBox1.Left = Form1.ActiveForm.Width;
}
}

daniyaltjm
جمعه 16 اسفند 1392, 01:45 صبح
این کد طبیعی تره امتحان کن:

private void timer1_Tick(object sender, EventArgs e) {
//timer1.Interval=50 because it normal move
textBox1.Left = textBox1.Left - 20;
if (textBox1.Left <= -100)
{
textBox1.Left = Form1.ActiveForm.Width;
}
}

NASA's Spaceman
جمعه 16 اسفند 1392, 09:22 صبح
دوست عزیز توی بازی با ارقام هر کاری که فکرشو بکنی میشه
و در کل ممنون اره اینو قبلا تست کرده بودم
پیروز و موفق باشی