|
|
Регистрация Восстановить пароль |
Повторная активизация e-mail |
Регистрация | Задать вопрос |
Заплачу за решение |
Новые сообщения |
Сообщения за день |
Расширенный поиск |
Правила |
Всё прочитано |
|
Опции темы | Поиск в этой теме |
18.10.2010, 11:17 | #1 |
Регистрация: 14.06.2010
Сообщений: 6
|
время отправления назналось от часа до2
как поменять что бы в коде время отправления назналось от часа до2
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsApplication1 { public partial class Form1 : Form { int N; bool check; public Form1() { InitializeComponent(); check = false; } public void TimeOutForm(int m, int h, int type, int i) { string strMin, strHour; if (m < 10) { strMin = 0 + Convert.ToString(m); } else { strMin = Convert.ToString(m); } if (h < 10) { strHour = 0 + Convert.ToString(h); } else { strHour = Convert.ToString(h); } if (type == 0) { listBox2.Items.Add("отправление : " + strHour + ":" + strMin); } if (type == 1) { listBox2.Items.Add("ст." + (i + 1) + ": " + strHour + ":" + strMin); } if (type == 2) { listBox2.Items.Add("прибытие : " + strHour + ":" + strMin); } } private void button1_Click_1(object sender, EventArgs e) { N = Convert.ToInt16(numericUpDown1.Valu e); listBox1.Items.Clear(); Random rnd = new Random(); for (int i = 0; i <= N - 1; i++) { int k = rnd.Next() + 1; listBox1.Items.Add(k); } check = true; } private void button2_Click_1(object sender, EventArgs e) { if (check) { listBox2.Items.Clear(); N = Convert.ToInt16(listBox1.Items.Coun t); int i; int h = dateTimePicker1.Value.Hour; int m = dateTimePicker1.Value.Minute; if (m >= 60) { h++; m -= 60; } if (h == 24) h = 0; TimeOutForm(m, h, 0, 0); for ( i = 0; i <= listBox1.Items.Count-2; i++) { m += (int)listBox1.Items[i]; if (m >= 60) { h++; m -= 60; } if (h == 24) h = 0; TimeOutForm(m, h, 1, i); } m += (int)listBox1.Items[i]; if (m >= 60) { h++; m -= 60; } if (h == 24) h = 0; TimeOutForm(m, h, 2, 0); } } private void listBox1_DoubleClick(object sender, EventArgs e) { int ind; if (listBox1.Items.Count > 1) { ind = listBox1.SelectedIndex; if (ind == -1) ind = 0; listBox1.Items.RemoveAt(ind); if (ind == 0) ind = 1; listBox1.SetSelected(ind - 1, true); } else { listBox1.Items.RemoveAt(0); check = false; } N--; } private void numericUpDown1_ValueChanged(object sender, EventArgs e) { } } } |
18.10.2010, 12:30 | #2 |
Участник клуба
Регистрация: 06.04.2009
Сообщений: 1,524
|
Вроде так:
Код:
Последний раз редактировалось Stilet; 18.10.2010 в 12:48. |
Похожие темы | ||||
Тема | Автор | Раздел | Ответов | Последнее сообщение |
Вывести часа в caption | soonner | Общие вопросы Delphi | 10 | 01.04.2009 11:03 |
перехват отправления чужими программами отправки на печать документов | Nat | Win Api | 7 | 20.04.2007 16:07 |