PanelClientSteps.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows.Forms;
  7. namespace ErgometerApplication
  8. {
  9. public class PanelClientSteps : Panel
  10. {
  11. public Label UitlegText;
  12. public Label HeaderLabel;
  13. private string text;
  14. public PanelClientSteps() : base()
  15. {
  16. this.HeaderLabel = new System.Windows.Forms.Label();
  17. this.UitlegText = new System.Windows.Forms.Label();
  18. //
  19. // initialize panel
  20. //
  21. this.BackColor = System.Drawing.SystemColors.ControlLightLight;
  22. this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  23. this.Controls.Add(this.UitlegText);
  24. this.Controls.Add(this.HeaderLabel);
  25. this.Dock = System.Windows.Forms.DockStyle.Top;
  26. this.Location = new System.Drawing.Point(0, 0);
  27. this.Name = "PanelClientSteps";
  28. this.Size = new System.Drawing.Size(284, 150);
  29. this.Resize += PanelClientSteps_Resize;
  30. //
  31. // HeaderLabel
  32. //
  33. this.HeaderLabel.AutoSize = true;
  34. this.HeaderLabel.Font = new System.Drawing.Font("Segoe UI Semibold", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
  35. this.HeaderLabel.Location = new System.Drawing.Point(12, 9);
  36. this.HeaderLabel.Name = "HeaderLabel";
  37. this.HeaderLabel.Size = new System.Drawing.Size(105, 21);
  38. this.HeaderLabel.TabIndex = 0;
  39. this.HeaderLabel.Text = "Uitleg";
  40. //
  41. // UitlegText
  42. //
  43. this.UitlegText.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)));
  44. this.UitlegText.AutoSize = true;
  45. this.UitlegText.Font = new System.Drawing.Font("Segoe UI", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
  46. this.UitlegText.Location = new System.Drawing.Point(12, 35);
  47. this.UitlegText.Name = "UitlegText";
  48. this.UitlegText.Size = new System.Drawing.Size(800, 32);
  49. this.UitlegText.MaximumSize = new System.Drawing.Size(400, 0);
  50. this.UitlegText.TabIndex = 2;
  51. this.UitlegText.Text = text;
  52. this.UitlegText.TextChanged += UitlegText_TextChanged;
  53. }
  54. private void UitlegText_TextChanged(object sender, EventArgs e)
  55. {
  56. if (UitlegText.Size.Height + UitlegText.Location.Y + 10 > this.Size.Height)
  57. this.Size = new System.Drawing.Size(this.Size.Width, UitlegText.Size.Height + UitlegText.Location.Y + 10);
  58. }
  59. private void PanelClientSteps_Resize(object sender, EventArgs e)
  60. {
  61. UitlegText.MaximumSize = new System.Drawing.Size(this.Size.Width - 20, 0);
  62. }
  63. public void setText(string text)
  64. {
  65. this.UitlegText.Text = text;
  66. }
  67. }
  68. }