public static Histogram_InfoPanel GetResult(Color ForeColor) { Histogram_InfoPanel result = new Histogram_InfoPanel() { pipe_0 = Get_pipe("0"), pipe_64 = Get_pipe("64"), pipe_128 = Get_pipe("128"), pipe_192 = Get_pipe("192"), pipe_255 = Get_pipe("255"), MostValue = Get_Label("Most Value: "), MostValue_Index = Get_Label(""), MostValue_Quantity = Get_Label(""), LeastValue = Get_Label("Least Value: "), LeastValue_Index = Get_Label(""), LeastValue_Quantity = Get_Label(""), MaxValue = Get_Label("Max Value: "), MinValue = Get_Label("Min Value: ") }; result.Histogram = Histogram_Builder.GetResult(ForeColor); //result.Histogram = new Histogram(ForeColor); result.MostValue_Color = Get_ColorPanel(); result.LeastValue_Color = Get_ColorPanel(); result.Height = result.Histogram.Height + 20; result.Dock = DockStyle.Fill; result.Controls.AddRange(new Control[] { result.Histogram, result.MostValue, result.MostValue_Index, result.MostValue_Quantity, result.MostValue_Color, result.LeastValue, result.LeastValue_Index, result.LeastValue_Quantity, result.LeastValue_Color, result.MaxValue, result.MinValue }); result.Controls.AddRange(new Control[] { result.pipe_0, result.pipe_64, result.pipe_128, result.pipe_192, result.pipe_255 }); Configure_PipePosition(ref result); return(result); }
private static void Configure_PipePosition(ref Histogram_InfoPanel result) { int topVal = result.Histogram.Height; result.pipe_0.Left = 0; result.pipe_64.Left = result.Histogram.Width / 4 - (result.pipe_64.Width / 2) - 6; result.pipe_128.Left = result.Histogram.Width / 2 - (result.pipe_128.Width / 2) - 6; result.pipe_192.Left = result.Histogram.Width / 2 + result.Histogram.Width / 4 - (result.pipe_192.Width / 2) - 6; result.pipe_255.Left = result.Histogram.Width - (result.pipe_255.Width / 2) - 6; result.pipe_0.Top = topVal; result.pipe_64.Top = topVal; result.pipe_128.Top = topVal; result.pipe_192.Top = topVal; result.pipe_255.Top = topVal; int Lh = result.MostValue.Height + 5; // Label Height result.MostValue.Top = topVal + 30; result.MostValue_Color.Top = topVal + 30; result.MostValue_Color.Left = result.MostValue.Width; result.MostValue_Index.Top = result.MostValue.Top + Lh; result.MostValue_Quantity.Top = result.MostValue_Index.Top + Lh; // ---------------------------------------------------------------------- result.LeastValue.Top = result.MostValue_Quantity.Top + Lh * 2; result.LeastValue_Color.Top = result.MostValue_Quantity.Top + Lh * 2; result.LeastValue_Color.Left = result.LeastValue.Width; result.LeastValue_Index.Top = result.LeastValue.Top + Lh; result.LeastValue_Quantity.Top = result.LeastValue_Index.Top + Lh; // ---------------------------------------------------------------------- result.MaxValue.Top = topVal + 30; result.MaxValue.Left = result.Histogram.Width / 2 - (result.pipe_128.Width / 2) - 6; result.MinValue.Top = result.MostValue.Top + Lh; result.MinValue.Left = result.Histogram.Width / 2 - (result.pipe_128.Width / 2) - 6; }