/// <summary> /// Constructor, initializing the components /// </summary> public View() { InitializeComponent(); SetSize(); zGraph = new ZGraph(ref zedGraphAudio); spec = new ShowSpectrogram(ref pb_spec); act = new ShowActivity(ref pb_activity); pos = new ShowPosition(ref pb_position); sno = new ShowSnore(ref pb_snore); zGraph.LoadZedGraph(); Change_Rec_logo(); }
/// <summary> /// Sets position and size of all surface elements at the beginning and in case of resizing /// </summary> private void SetSize() { Rectangle Audio = new Rectangle(); Rectangle Spec = new Rectangle(); Rectangle Activity = new Rectangle(); Rectangle Position = new Rectangle(); Rectangle Snore = new Rectangle(); Rectangle Logo = new Rectangle(pb_logo.Location, pb_logo.Size); // Variables which define position of all surface elements int x_right = 100; // Distance from right edge to audio/spectrogram int y_top = 55; // Distance from top edge to audio/spectrogram int y_bot = 100; // Distance from bottom edge to audio/spectrogram int dist = 10; // Distance between surface elements Audio.Height = (int)(this.ClientRectangle.Height - y_top - y_bot - dist) / 2; Audio.Width = (int)(this.ClientRectangle.Width - x_right - dist); Spec.Width = Audio.Width; Spec.Height = Audio.Height; Audio.X = dist; Audio.Y = y_top; Spec.X = Audio.X; Spec.Y = Audio.Y + Audio.Height + 10; Logo.X = this.ClientRectangle.Width - dist - Logo.Width; Logo.Y = pb_logo.Location.Y; Position.Height = Audio.Height; Position.Width = x_right - 2 * dist; Activity.Width = Position.Width; Activity.Height = Convert.ToInt16(Spec.Height / (1.3)); Snore.Width = Position.Width; Snore.Height = Spec.Height / 4 - 2 * dist; Position.X = Audio.X + Audio.Width + dist; Position.Y = Audio.Y; Activity.X = Position.X; Activity.Y = Spec.Y; Snore.X = Position.X; Snore.Y = Spec.Y + Convert.ToInt16(Spec.Height / (1.3)) + dist; zedGraphAudio.Location = Audio.Location; zedGraphAudio.Size = Audio.Size; pb_spec.Location = Spec.Location; pb_spec.Size = Spec.Size; pb_logo.Location = Logo.Location; pb_position.Location = Position.Location; pb_position.Size = Position.Size; pb_activity.Location = Activity.Location; pb_activity.Size = Activity.Size; pb_snore.Location = Snore.Location; pb_snore.Size = Snore.Size; tbData.Size = new Size(350, y_bot - 2 * dist); tbData.Location = new Point((int)this.ClientRectangle.Width / 2 - tbData.Size.Width / 2, Spec.Y + Spec.Height + dist); buttonSave.Size = new Size(180, y_bot - 2 * dist - 10); buttonSave.Location = new Point(5 * dist, tbData.Location.Y); tB_snore.Size = buttonSave.Size; tB_snore.Location = new Point(pb_snore.Location.X, tbData.Location.Y); //label_low.Size = buttonSave.Size; label_low.Location = new Point(pb_snore.Location.X, tbData.Location.Y + tB_snore.Height); //label_high.Size = buttonSave.Size; label_high.Location = new Point(pb_snore.Location.X, tbData.Location.Y - label_high.Height / 2); buttonConnect.Size = buttonSave.Size; buttonConnect.Location = new Point((int)this.ClientRectangle.Width - buttonSave.Location.X - buttonConnect.Size.Width - tB_snore.Size.Width - dist, tbData.Location.Y); pb_rec.Size = new Size(120, 45); pb_rec.Location = new Point(buttonSave.Location.X + buttonSave.Width + dist, this.ClientRectangle.Height - y_bot + 20); spec = new ShowSpectrogram(ref pb_spec); act = new ShowActivity(ref pb_activity); pos = new ShowPosition(ref pb_position); sno = new ShowSnore(ref pb_snore); }
/// <summary> /// Sets position and size of all surface elements at the beginning and in case of resizing /// </summary> private void SetSize() { Rectangle Audio = new Rectangle(); Rectangle Spec = new Rectangle(); Rectangle Activity = new Rectangle(); Rectangle Position = new Rectangle(); Rectangle Snore = new Rectangle(); Rectangle Logo = new Rectangle(pb_logo.Location, pb_logo.Size); // Variables which define position of all surface elements int x_right = 100; // Distance from right edge to audio/spectrogram int y_top = 55; // Distance from top edge to audio/spectrogram int y_bot = 100; // Distance from bottom edge to audio/spectrogram int dist = 10; // Distance between surface elements Audio.Height = (int)(this.ClientRectangle.Height - y_top - y_bot - dist) / 2; Audio.Width = (int)(this.ClientRectangle.Width - x_right - dist); Spec.Width = Audio.Width; Spec.Height = Audio.Height; Audio.X = dist; Audio.Y = y_top; Spec.X = Audio.X; Spec.Y = Audio.Y + Audio.Height + 10; Logo.X = this.ClientRectangle.Width - dist - Logo.Width; Logo.Y = pb_logo.Location.Y; Position.Height = Audio.Height; Position.Width = x_right - 2 * dist; Activity.Width = Position.Width; Activity.Height = Convert.ToInt16(Spec.Height/(1.3)); Snore.Width = Position.Width; Snore.Height = Spec.Height / 4 - 2 * dist; Position.X = Audio.X + Audio.Width + dist; Position.Y = Audio.Y; Activity.X = Position.X; Activity.Y = Spec.Y; Snore.X = Position.X; Snore.Y = Spec.Y + Convert.ToInt16(Spec.Height / (1.3)) + dist; zedGraphAudio.Location = Audio.Location; zedGraphAudio.Size = Audio.Size; pb_spec.Location = Spec.Location; pb_spec.Size = Spec.Size; pb_logo.Location = Logo.Location; pb_position.Location = Position.Location; pb_position.Size = Position.Size; pb_activity.Location = Activity.Location; pb_activity.Size = Activity.Size; pb_snore.Location = Snore.Location; pb_snore.Size = Snore.Size; tbData.Size = new Size(350, y_bot - 2 * dist); tbData.Location = new Point((int)this.ClientRectangle.Width / 2 - tbData.Size.Width / 2, Spec.Y + Spec.Height + dist); buttonSave.Size = new Size(180, y_bot - 2 * dist-10); buttonSave.Location = new Point(5 * dist, tbData.Location.Y); tB_snore.Size = buttonSave.Size; tB_snore.Location = new Point(pb_snore.Location.X, tbData.Location.Y); //label_low.Size = buttonSave.Size; label_low.Location = new Point(pb_snore.Location.X, tbData.Location.Y + tB_snore.Height); //label_high.Size = buttonSave.Size; label_high.Location = new Point(pb_snore.Location.X, tbData.Location.Y - label_high.Height/2); buttonConnect.Size = buttonSave.Size; buttonConnect.Location = new Point((int)this.ClientRectangle.Width - buttonSave.Location.X - buttonConnect.Size.Width - tB_snore.Size.Width-dist, tbData.Location.Y); pb_rec.Size = new Size(120, 45); pb_rec.Location = new Point(buttonSave.Location.X + buttonSave.Width + dist, this.ClientRectangle.Height-y_bot+20); spec = new ShowSpectrogram(ref pb_spec); act = new ShowActivity(ref pb_activity); pos = new ShowPosition(ref pb_position); sno = new ShowSnore(ref pb_snore); }