protected void AddSlider(Panel panel, string text, float min, float max, float value, SliderValueChangedEvent changed, ref int index, ref int verticalOffset, out Slider slider, out DynamicLabel valueLabel) { Label label = new Label(); label.TextAlign = System.Drawing.ContentAlignment.TopLeft; label.FixedSize = true; label.Size = new System.Drawing.Size(this.Size.Width - 100, 15); label.Location = new System.Drawing.Point(0, verticalOffset); label.Text = text; label.FontType = FontType.Small; label.IsVisible = true; label.Padding = new System.Windows.Forms.Padding(5); label.RelitiveZIndex = index++; panel.Controls.Add(label); valueLabel = new DynamicLabel(); valueLabel.TextAlign = System.Drawing.ContentAlignment.TopRight; valueLabel.FixedSize = true; valueLabel.Size = new System.Drawing.Size(95, 15); valueLabel.Location = new System.Drawing.Point(this.Size.Width - 100, verticalOffset); valueLabel.MaxLength = 8; valueLabel.Text = value.ToString("N2"); valueLabel.FontType = FontType.Small; valueLabel.IsVisible = true; valueLabel.Padding = new System.Windows.Forms.Padding(5); valueLabel.RelitiveZIndex = index++; panel.Controls.Add(valueLabel); verticalOffset += 20; slider = new Slider(); slider.MinValue = min; slider.MaxValue = max; slider.Size = new System.Drawing.Size(this.Size.Width - 10, 15); slider.Location = new System.Drawing.Point(5, verticalOffset); slider.IsVisible = true; slider.Value = value; slider.ValueChanged += changed; slider.RelitiveZIndex = index++; panel.Controls.Add(slider); verticalOffset += 15; }
private void CreateStatusBar() { #region Status Bar int index = 20; Panel statusPanel = new Panel(); statusPanel.ShowBackground = true; statusPanel.ShowBorder = false; statusPanel.Docking = System.Windows.Forms.DockStyle.Bottom; statusPanel.IsVisible = true; statusPanel.RelitiveZIndex = index++; statusPanel.Size = new System.Drawing.Size(152, 24); Controls.Add(statusPanel); index = 1; m_SpeedGraph = new MultiGraph(); m_SpeedGraph.Location = new System.Drawing.Point(2, 2); m_SpeedGraph.Size = new System.Drawing.Size(150, 20); m_SpeedGraph.IsVisible = true; m_SpeedGraph.RelitiveZIndex = index++; statusPanel.Controls.Add(m_SpeedGraph); m_FPSGraph = new SubGraph(150); m_FPSGraph.IsVisible = true; m_FPSGraph.LineColor = new SlimDX.Color4(0.75f, 0.3f, 1f, 0.3f); m_SpeedGraph.Graphs.Add(m_FPSGraph); m_FPSLabel = new DynamicLabel(); m_FPSLabel.ForeColor = new SlimDX.Color4(0.75f, 0.3f, 1f, 0.3f); m_FPSLabel.MaxLength = 16; m_FPSLabel.Location = new System.Drawing.Point(154, 0); m_FPSLabel.FixedSize = false; m_FPSLabel.FontType = FontType.Small; m_FPSLabel.TextAlign = System.Drawing.ContentAlignment.TopLeft; m_FPSLabel.IsVisible = true; m_FPSLabel.RelitiveZIndex = index++; statusPanel.Controls.Add(m_FPSLabel); #endregion }
protected void AddPathControl(Panel panel, string text, string value, EventHandler openFileDialog, EventHandler openLocation, ref int index, ref int verticalOffset, out DynamicLabel valueLabel) { Label label = new Label(); label.TextAlign = System.Drawing.ContentAlignment.TopLeft; label.FixedSize = true; label.Size = new System.Drawing.Size(this.Size.Width - 100, 15); label.Location = new System.Drawing.Point(0, verticalOffset); label.Text = text; label.FontType = FontType.Small; label.IsVisible = true; label.Padding = new System.Windows.Forms.Padding(5); label.RelitiveZIndex = index++; panel.Controls.Add(label); verticalOffset += 20; valueLabel = new DynamicLabel(); valueLabel.TextAlign = System.Drawing.ContentAlignment.TopLeft; valueLabel.FixedSize = true; valueLabel.Size = new System.Drawing.Size(this.Size.Width - 70, 15); valueLabel.Location = new System.Drawing.Point(5, verticalOffset); valueLabel.MaxLength = 100; valueLabel.Text = value; valueLabel.FontType = FontType.Small; valueLabel.IsVisible = true; valueLabel.Padding = new System.Windows.Forms.Padding(5); valueLabel.RelitiveZIndex = index++; panel.Controls.Add(valueLabel); Button openFileDialogButton = new Button(); openFileDialogButton.Size = new System.Drawing.Size(25, 20); openFileDialogButton.Location = new System.Drawing.Point(this.Size.Width - 65, verticalOffset); openFileDialogButton.Text = "..."; openFileDialogButton.FontType = FontType.Small; openFileDialogButton.IsVisible = true; openFileDialogButton.RelitiveZIndex = index++; openFileDialogButton.Click += openFileDialog; panel.Controls.Add(openFileDialogButton); Button openLocationButton = new Button(); openLocationButton.Size = new System.Drawing.Size(30, 20); openLocationButton.Location = new System.Drawing.Point(this.Size.Width - 35, verticalOffset); openLocationButton.Text = "Open"; openLocationButton.FontType = FontType.Small; openLocationButton.IsVisible = true; openLocationButton.RelitiveZIndex = index++; openLocationButton.Click += openLocation; panel.Controls.Add(openLocationButton); verticalOffset += 25; }
protected ToggleButton AddToggleButton(Panel panel, object obj, string text, EventHandler click, int buttonSize, int buttonSpace, ref int currentButtonOffset, ref int index, ref int verticalOffset) { ToggleButton button = new ToggleButton(); button.Size = new System.Drawing.Size(buttonSize, 20); button.Location = new System.Drawing.Point(currentButtonOffset, verticalOffset); button.Text = text; button.Tag = obj; button.FontType = FontType.Small; button.IsVisible = true; button.RelitiveZIndex = index++; button.Click += click; panel.Controls.Add(button); currentButtonOffset += buttonSpace; return button; }
protected void AddButtonSet(Panel panel, string labelText, object[] obj, string[] text, EventHandler click, ref int index, ref int verticalOffset, List<ToggleButton> buttons) { Label label = new Label(); label.TextAlign = System.Drawing.ContentAlignment.TopLeft; label.FixedSize = true; label.Size = new System.Drawing.Size(200, 15); label.Location = new System.Drawing.Point(0, verticalOffset); label.Text = labelText; label.FontType = FontType.Small; label.IsVisible = true; label.Padding = new System.Windows.Forms.Padding(5); label.RelitiveZIndex = index++; panel.Controls.Add(label); verticalOffset += 20; int totalSpace = Size.Width - 5; int buttonSize = ((totalSpace - (5 * obj.Length)) / obj.Length); int buttonSpace = buttonSize + 5; int currentButtonOffset = 5; for (int i = 0; i < obj.Length; i++) { buttons.Add(AddToggleButton(panel, obj[i], text[i], click, buttonSize, buttonSpace, ref currentButtonOffset, ref index, ref verticalOffset)); } verticalOffset += 30; }
private void CreateStatusBar() { #region Status Bar int index = 20; m_StatusPanel = new Panel(); m_StatusPanel.ShowBackground = true; m_StatusPanel.ShowBorder = false; m_StatusPanel.Docking = System.Windows.Forms.DockStyle.Bottom; m_StatusPanel.IsVisible = true; m_StatusPanel.RelitiveZIndex = index++; m_StatusPanel.Size = new System.Drawing.Size(152, 50); Controls.Add(m_StatusPanel); index = 1; m_SpeedGraph = new MultiGraph(); m_SpeedGraph.Location = new System.Drawing.Point(2, 2); m_SpeedGraph.Size = new System.Drawing.Size(150, 48); m_SpeedGraph.IsVisible = true; m_SpeedGraph.RelitiveZIndex = index++; m_StatusPanel.Controls.Add(m_SpeedGraph); m_FPSGraph = new Graph(150); m_FPSGraph.IsVisible = true; m_FPSGraph.LineColor = new SlimDX.Color4(0.75f, 0.3f, 1f, 0.3f); m_SpeedGraph.Graphs.Add(m_FPSGraph); m_FPSLabel = new DynamicLabel(); m_FPSLabel.ForeColor = new SlimDX.Color4(0.75f, 0.3f, 1f, 0.3f); m_FPSLabel.MaxLength = 16; m_FPSLabel.Location = new System.Drawing.Point(154, 0); m_FPSLabel.FixedSize = false; m_FPSLabel.FontType = FontType.Small; m_FPSLabel.TextAlign = System.Drawing.ContentAlignment.TopLeft; m_FPSLabel.IsVisible = true; m_FPSLabel.RelitiveZIndex = index++; m_StatusPanel.Controls.Add(m_FPSLabel); m_PacketGraph = new Graph(150); m_PacketGraph.IsVisible = true; m_PacketGraph.LineColor = new SlimDX.Color4(0.75f, 1f, 0.3f, 0.3f); m_SpeedGraph.Graphs.Add(m_PacketGraph); m_PacketLabel = new DynamicLabel(); m_PacketLabel.ForeColor = new SlimDX.Color4(0.75f, 1f, 0.3f, 0.3f); m_PacketLabel.MaxLength = 20; m_PacketLabel.Location = new System.Drawing.Point(154, 10); m_PacketLabel.FixedSize = false; m_PacketLabel.FontType = FontType.Small; m_PacketLabel.TextAlign = System.Drawing.ContentAlignment.TopLeft; m_PacketLabel.IsVisible = true; m_PacketLabel.RelitiveZIndex = index++; m_StatusPanel.Controls.Add(m_PacketLabel); m_DroppedFramesGraph = new Graph(150); m_DroppedFramesGraph.IsVisible = true; m_DroppedFramesGraph.LineColor = new SlimDX.Color4(0.75f, 1f, 0.3f, 1f); m_SpeedGraph.Graphs.Add(m_DroppedFramesGraph); m_DroppedFramesLabel = new DynamicLabel(); m_DroppedFramesLabel.ForeColor = new SlimDX.Color4(0.75f, 1f, 0.3f, 1f); m_DroppedFramesLabel.MaxLength = 20; m_DroppedFramesLabel.Location = new System.Drawing.Point(240, 0); m_DroppedFramesLabel.FixedSize = false; m_DroppedFramesLabel.FontType = FontType.Small; m_DroppedFramesLabel.TextAlign = System.Drawing.ContentAlignment.TopLeft; m_DroppedFramesLabel.IsVisible = true; m_DroppedFramesLabel.RelitiveZIndex = index++; m_StatusPanel.Controls.Add(m_DroppedFramesLabel); m_RecordingStatusLabel = new DynamicLabel(); m_RecordingStatusLabel.ForeColor = new SlimDX.Color4(0.75f, 1f, 0.3f, 1f); m_RecordingStatusLabel.MaxLength = 20; m_RecordingStatusLabel.Location = new System.Drawing.Point(240, 10); m_RecordingStatusLabel.FixedSize = false; m_RecordingStatusLabel.FontType = FontType.Small; m_RecordingStatusLabel.TextAlign = System.Drawing.ContentAlignment.TopLeft; m_RecordingStatusLabel.IsVisible = true; m_RecordingStatusLabel.RelitiveZIndex = index++; m_StatusPanel.Controls.Add(m_RecordingStatusLabel); m_FFTGraph = new MultiGraph(); m_FFTGraph.Location = new System.Drawing.Point(340, 2); m_FFTGraph.Size = new System.Drawing.Size(DSParticles3.ParticleEnsemble.VelocityAutoCorrelationLength / 2, 22); //m_FFTGraph.Size = new System.Drawing.Size(512, 22); m_FFTGraph.IsVisible = true; m_FFTGraph.RelitiveZIndex = index++; m_StatusPanel.Controls.Add(m_FFTGraph); m_CorrelationFunctionGraph = new Graph(ArtworkStaticObjects.Ensemble.xtest.Length);// the number in brackets is how many data points in the graph m_CorrelationFunctionGraph.Scrolling = false; // this may need to be true (test) m_CorrelationFunctionGraph.IsVisible = true; m_CorrelationFunctionGraph.LineColor = new SlimDX.Color4(0.75f, 1f, 1f, 1f); m_CorrelationFunctionGraph.ScaleEveryFrame = true; m_FFTGraph.Graphs.Add(m_CorrelationFunctionGraph); m_FFTGraph2 = new MultiGraph(); m_FFTGraph2.Location = new System.Drawing.Point(340, 26); m_FFTGraph2.Size = new System.Drawing.Size(DSParticles3.ParticleEnsemble.VelocityAutoCorrelationLength / 2, 22); //m_FFTGraph2.Size = new System.Drawing.Size(512, 22); m_FFTGraph2.IsVisible = true; m_FFTGraph2.RelitiveZIndex = index++; m_StatusPanel.Controls.Add(m_FFTGraph2); m_FFTFreqsGraph = new PeakGraph(24, ArtworkStaticObjects.Ensemble.AveragedFFTamplitudes.Length);// the number in brackets is how many data points in the graph m_FFTFreqsGraph.Scrolling = false; // this may need to be true (test) m_FFTFreqsGraph.IsVisible = true; m_FFTFreqsGraph.LineColor = new SlimDX.Color4(0.75f, 1f, 0.2f, 0.2f); m_FFTFreqsGraph.PeakLineColor = new SlimDX.Color4(0.75f, 1f, 0f, 1f); m_FFTFreqsGraph.ShowTicks = true; m_FFTFreqsGraph.ShowPeaks = true; m_FFTFreqsGraph.TickSpace = ArtworkStaticObjects.Ensemble.AveragedFFTamplitudes.Length / 64; m_FFTFreqsGraph.ScaleEveryFrame = true; m_FFTGraph2.Graphs.Add(m_FFTFreqsGraph); #endregion }