diff --git a/FrmCheckHistory.cs b/FrmCheckHistory.cs index 0f6a243..0105570 100644 --- a/FrmCheckHistory.cs +++ b/FrmCheckHistory.cs @@ -99,50 +99,40 @@ } lab_page_msg.Text = "第" + currentPage + "页,共" + lastPage + "页"; - if (combo_page.Items.Count == 0) + combo_page.Items.Clear(); + for (int i = 1; i <= lastPage; i++) { - for (int i = 1; i <= lastPage; i++) - { - combo_page.Items.Add(i); - //combo_page.Items.Add(new ComboBoxItem(i.ToString(), i.ToString())); - } + combo_page.Items.Add(new ComboBoxItem(i.ToString(), i.ToString())); } - if (combo_page.Items.Count < lastPage) - { - for (int i = combo_page.Items.Count + 1; i < lastPage; i++) - { - combo_page.Items.Add(i); - //combo_page.Items.Add(new ComboBoxItem(i.ToString(), i.ToString())); - } - } + combo_page.SelectedIndex = currentPage - 1; if (lastPage == 1) { btn_page_first.Enabled = false; btn_page_pre.Enabled = false; - btn_page_next.Enabled = false; btn_page_last.Enabled = false; + btn_page_next.Enabled = false; } else if (currentPage == 1) { btn_page_first.Enabled = false; btn_page_pre.Enabled = false; - btn_page_next.Enabled = true; btn_page_last.Enabled = true; + btn_page_next.Enabled = true; } else if (currentPage == lastPage) { btn_page_first.Enabled = true; btn_page_pre.Enabled = true; - btn_page_next.Enabled = false; btn_page_last.Enabled = false; + btn_page_next.Enabled = false; } else { btn_page_first.Enabled = true; btn_page_pre.Enabled = true; - btn_page_next.Enabled = true; btn_page_last.Enabled = true; + btn_page_next.Enabled = true; } DataTable table = OledbHelper.ExecuteDataTable(sqlData); @@ -308,6 +298,10 @@ private void combo_page_SelectedIndexChanged(object sender, EventArgs e) { + if (currentPage == int.Parse(combo_page.Text)) + { + return; + } if (!String.IsNullOrEmpty(combo_page.Text)) { currentPage = int.Parse(combo_page.Text); diff --git a/FrmCheckHistory.cs b/FrmCheckHistory.cs index 0f6a243..0105570 100644 --- a/FrmCheckHistory.cs +++ b/FrmCheckHistory.cs @@ -99,50 +99,40 @@ } lab_page_msg.Text = "第" + currentPage + "页,共" + lastPage + "页"; - if (combo_page.Items.Count == 0) + combo_page.Items.Clear(); + for (int i = 1; i <= lastPage; i++) { - for (int i = 1; i <= lastPage; i++) - { - combo_page.Items.Add(i); - //combo_page.Items.Add(new ComboBoxItem(i.ToString(), i.ToString())); - } + combo_page.Items.Add(new ComboBoxItem(i.ToString(), i.ToString())); } - if (combo_page.Items.Count < lastPage) - { - for (int i = combo_page.Items.Count + 1; i < lastPage; i++) - { - combo_page.Items.Add(i); - //combo_page.Items.Add(new ComboBoxItem(i.ToString(), i.ToString())); - } - } + combo_page.SelectedIndex = currentPage - 1; if (lastPage == 1) { btn_page_first.Enabled = false; btn_page_pre.Enabled = false; - btn_page_next.Enabled = false; btn_page_last.Enabled = false; + btn_page_next.Enabled = false; } else if (currentPage == 1) { btn_page_first.Enabled = false; btn_page_pre.Enabled = false; - btn_page_next.Enabled = true; btn_page_last.Enabled = true; + btn_page_next.Enabled = true; } else if (currentPage == lastPage) { btn_page_first.Enabled = true; btn_page_pre.Enabled = true; - btn_page_next.Enabled = false; btn_page_last.Enabled = false; + btn_page_next.Enabled = false; } else { btn_page_first.Enabled = true; btn_page_pre.Enabled = true; - btn_page_next.Enabled = true; btn_page_last.Enabled = true; + btn_page_next.Enabled = true; } DataTable table = OledbHelper.ExecuteDataTable(sqlData); @@ -308,6 +298,10 @@ private void combo_page_SelectedIndexChanged(object sender, EventArgs e) { + if (currentPage == int.Parse(combo_page.Text)) + { + return; + } if (!String.IsNullOrEmpty(combo_page.Text)) { currentPage = int.Parse(combo_page.Text); diff --git a/FrmFlyToPosition.cs b/FrmFlyToPosition.cs index e1240f5..d0b6b39 100644 --- a/FrmFlyToPosition.cs +++ b/FrmFlyToPosition.cs @@ -17,6 +17,8 @@ globeControl2 = _globeControl2; foreach (Location l in Utility.locationList) comboBox1.Items.Add(l.NAME); + + comboBox1.SelectedIndex = 0; } public FrmFlyToPosition(GSOGlobeControl _globeControl1) @@ -26,6 +28,8 @@ foreach (Location l in Utility.locationList) comboBox1.Items.Add(l.NAME); + + comboBox1.SelectedIndex = 0; } private void buttonX1_Click(object sender, EventArgs e) diff --git a/FrmCheckHistory.cs b/FrmCheckHistory.cs index 0f6a243..0105570 100644 --- a/FrmCheckHistory.cs +++ b/FrmCheckHistory.cs @@ -99,50 +99,40 @@ } lab_page_msg.Text = "第" + currentPage + "页,共" + lastPage + "页"; - if (combo_page.Items.Count == 0) + combo_page.Items.Clear(); + for (int i = 1; i <= lastPage; i++) { - for (int i = 1; i <= lastPage; i++) - { - combo_page.Items.Add(i); - //combo_page.Items.Add(new ComboBoxItem(i.ToString(), i.ToString())); - } + combo_page.Items.Add(new ComboBoxItem(i.ToString(), i.ToString())); } - if (combo_page.Items.Count < lastPage) - { - for (int i = combo_page.Items.Count + 1; i < lastPage; i++) - { - combo_page.Items.Add(i); - //combo_page.Items.Add(new ComboBoxItem(i.ToString(), i.ToString())); - } - } + combo_page.SelectedIndex = currentPage - 1; if (lastPage == 1) { btn_page_first.Enabled = false; btn_page_pre.Enabled = false; - btn_page_next.Enabled = false; btn_page_last.Enabled = false; + btn_page_next.Enabled = false; } else if (currentPage == 1) { btn_page_first.Enabled = false; btn_page_pre.Enabled = false; - btn_page_next.Enabled = true; btn_page_last.Enabled = true; + btn_page_next.Enabled = true; } else if (currentPage == lastPage) { btn_page_first.Enabled = true; btn_page_pre.Enabled = true; - btn_page_next.Enabled = false; btn_page_last.Enabled = false; + btn_page_next.Enabled = false; } else { btn_page_first.Enabled = true; btn_page_pre.Enabled = true; - btn_page_next.Enabled = true; btn_page_last.Enabled = true; + btn_page_next.Enabled = true; } DataTable table = OledbHelper.ExecuteDataTable(sqlData); @@ -308,6 +298,10 @@ private void combo_page_SelectedIndexChanged(object sender, EventArgs e) { + if (currentPage == int.Parse(combo_page.Text)) + { + return; + } if (!String.IsNullOrEmpty(combo_page.Text)) { currentPage = int.Parse(combo_page.Text); diff --git a/FrmFlyToPosition.cs b/FrmFlyToPosition.cs index e1240f5..d0b6b39 100644 --- a/FrmFlyToPosition.cs +++ b/FrmFlyToPosition.cs @@ -17,6 +17,8 @@ globeControl2 = _globeControl2; foreach (Location l in Utility.locationList) comboBox1.Items.Add(l.NAME); + + comboBox1.SelectedIndex = 0; } public FrmFlyToPosition(GSOGlobeControl _globeControl1) @@ -26,6 +28,8 @@ foreach (Location l in Utility.locationList) comboBox1.Items.Add(l.NAME); + + comboBox1.SelectedIndex = 0; } private void buttonX1_Click(object sender, EventArgs e) diff --git a/Utility.cs b/Utility.cs index 750b62e..d0df622 100644 --- a/Utility.cs +++ b/Utility.cs @@ -552,7 +552,7 @@ if (File.Exists(filenameLocation)) { locationList = new List(); - locationList.Add(new Location("", "", "", "")); + // locationList.Add(new Location("请选择定位点", "", "", "")); XmlReaderLocation = new XmlTextReader(filenameLocation); while (XmlReaderLocation.Read()) {