void UpdateIndexLabel(IndexData data) { string text = string.Format("{0} {1:F} {2:+0.00;-#.00} {3:+0.00;-#.00}% {4:F}亿", data.Name, data.Price, data.PriceOffset, data.PriceOffsetInPercent, data.Volumn / 100000000); if (data.PriceOffset > 0) { this.mIndexLabel.ForeColor = Color.FromKnownColor(KnownColor.Red); } else if (data.PriceOffset < 0) { this.mIndexLabel.ForeColor = Color.FromKnownColor(KnownColor.Green); } else { this.mIndexLabel.ForeColor = Color.White; } this.mIndexLabel.Text = text; }
public IndexData ToIndexData() { var retData = new IndexData(); retData.Code = this.StockCode; retData.Name = this.Name; retData.Price = this.Current; retData.PriceOffset = (this.Current - this.YesterdayClose); retData.PriceOffsetInPercent = (this.Current - this.YesterdayClose)*100 / this.YesterdayClose; retData.Volumn = this.MoneyVolumn; return retData; }