public void RemoveSubChart() { if (this.Controls.Count != 1) { ChartBox thisBox = (ChartBox)this.Controls[this.Controls.Count - 1]; thisBox.DisposePrice(); this.Controls.Remove(thisBox); if (this.Controls.Count == 1) { chartBox.Height = this.Height - 19; } else if (this.Controls.Count == 2) { decimal dHeight = this.Height - 19; dHeight = dHeight / 100 * 65; dHeight = Decimal.Round(dHeight, 0); chartBox.Height = Convert.ToInt32(dHeight); this.ResizeSubCharts(false); } else { this.ResizeSubCharts(false); } } }
public ChartBox AddChart() { ChartBox newBox = new ChartBox(); //newBox.UID = Guid.NewGuid(); newBox.HorizontalValues = config.IsHorizontalValues; newBox.VerticalValues = config.IsVerticalValues; newBox.HorizontalGrid = config.IsHorizontalGrid; newBox.VerticalGrid = config.IsVerticalGrid; newBox.HGridLines = config.HGridLines; newBox.VGridLines = config.VGridLines; newBox.GridColor = config.GridColor; newBox.TickColor = config.TickColor; newBox.TextColor = config.TextColor; newBox.GridTextColor = config.GridTextColor; newBox.FrameColor = config.FrameColor; newBox.BackColor = config.BackColor; //newBox.SetHPeriod(chartBox.HBasePeriod); newBox.Size = new Size(chartBox.Width, iSubHeight); newBox.Location = new Point(chartBox.Location.X, chartBox.Height + (iSubHeight * (this.Controls.Count - 1))); //newBox.BorderStyle = BorderStyle.FixedSingle; // TO REMOVE this.Controls.Add(newBox); return(newBox); }
// // Public members // public ChartBox AddSubChart() { this.ResizeMainChart(true); this.ResizeSubCharts(true); ChartBox newBox = this.AddChart(); return(newBox); }
public void ResizeSubCharts(bool isNew) { iSubHeight = this.Height - 19 - chartBox.Height; if (this.Controls.Count != 1) { if (isNew) { iSubHeight = Convert.ToInt32(Decimal.Round(iSubHeight / (this.Controls.Count), 0)); } else { iSubHeight = Convert.ToInt32(Decimal.Round(iSubHeight / (this.Controls.Count - 1), 0)); } for (int i = 1; i < this.Controls.Count; i++) { PictureBox box = (PictureBox)this.Controls[i]; box.Height = iSubHeight; box.Location = new Point(chartBox.Location.X, chartBox.Height + (iSubHeight * (i - 1))); } for (int i = 1; i < this.Controls.Count; i++) { ChartBox box = (ChartBox)this.Controls[i]; box.CalculateAll(); box.DrawAll(); box.DisposePrice(); box.DrawPrice(); box.Image = box.PureImage; } } }