private void OK(object sender, KeyEventArgs e) { if (13 != e.KeyValue) //Enter return; kData = new KData(strDataFilePath, strStockNumber); UpdatePaint(); this.Refresh(); }
private void button2_Click(object sender, EventArgs e) { OpenFileDialog fileDialog = new OpenFileDialog(); fileDialog.InitialDirectory = Properties.Settings.Default.BlockFilePath; fileDialog.Title = "选择文件"; fileDialog.Filter = "blk files (*.blk)|*.blk"; fileDialog.FilterIndex = 1; fileDialog.RestoreDirectory = true; if (fileDialog.ShowDialog() != DialogResult.OK) return; Properties.Settings.Default.BlockFilePath = fileDialog.FileName; Properties.Settings.Default.Save(); String fileName = fileDialog.SafeFileName; button2.Text = "板块 " + fileName; // 使用文件名 FileStream fs = new FileStream(fileDialog.FileName, FileMode.Open); StreamReader sr = new StreamReader(fs); char[] separator = new char[2]; separator[0] = '\r'; separator[1] = '\n'; string strTemp = sr.ReadToEnd(); this.BlockStockNumbersArray = strTemp.Split(separator, StringSplitOptions.RemoveEmptyEntries); this.strStockNumber = this.BlockStockNumbersArray[0].Substring(1); kData = new KData(strDataFilePath, strStockNumber); UpdatePaint(); this.Refresh(); fs.Close(); sr.Close(); }
private void ChangeStock(object sender, KeyEventArgs e) { if (Keys.PageDown != e.KeyData && Keys.PageUp != e.KeyData) return; Int32 iCount = 0; if (null == BlockStockNumbersArray) return; if (Keys.PageDown == e.KeyData) { for (iCount = 0; iCount < BlockStockNumbersArray.Length; iCount++) { if (0 != this.BlockStockNumbersArray[iCount].Substring(1).CompareTo(strStockNumber)) continue; if (iCount != BlockStockNumbersArray.Length - 1) { this.strStockNumber = this.BlockStockNumbersArray[iCount + 1].Substring(1); break; } this.strStockNumber = this.BlockStockNumbersArray[0].Substring(1); break; } } if (Keys.PageUp == e.KeyData) { for (iCount = 0; iCount < BlockStockNumbersArray.Length; iCount++) { if (0 != this.BlockStockNumbersArray[iCount].Substring(1).CompareTo(strStockNumber)) continue; if (iCount != 0) { this.strStockNumber = this.BlockStockNumbersArray[iCount - 1].Substring(1); break; } this.strStockNumber = this.BlockStockNumbersArray[BlockStockNumbersArray.Length-1].Substring(1); break; } } kData = new KData(strDataFilePath, strStockNumber); UpdatePaint(); this.Refresh(); }
private void button1_Click(object sender, EventArgs e) { kData = new KData(strDataFilePath, strStockNumber); UpdatePaint(); this.Refresh(); }