title: How can I draw a line in my form from another class?
body: <p>I have 3 classes in my program:</p>
  <ul>
  <li><p><strong>Arrow</strong> (it contains the logic for drawing arrow, and all required information about it, like: starting point, ending point, etc.)</p>
  </li>
  <li><p><strong>Form1</strong> (that contains the drawing area(basically panel), where this arrow will be located in the future)</p>
  </li>
  <li><p><strong>UserControl</strong>, is located in <code>Form1</code> (I did <code>Form1.Controls.Add(UserControl)</code>). It has a <code>Form1</code> as a parent. In this <code>UserControl</code>, I have a button, when I click it, an arrow should be drawn on the <code>Form1</code>'s drawing area.</p>
  <p>And I'm so confused with the logic that this program should have. I tried to create <code>Arrow</code> class object in the <code>UserControl.Button_Click()</code>, and call all the Arrow's methods from there, but I can't access to Form1's controls. I also thought maybe I can create object of <code>Arrow</code> in the <code>Form1</code>. So I tried to subscribe event <code>UserControl.Button_Click()</code> with some <code>Form1</code>'s delegate, but I don't know how to do it. In this case, does delegate and the method that this delegate have as a reference should be Static?</p>
  </li>
  </ul>
  <p>So this is how my code looks like.
  (I little bit simplified and shortened my classes)
  Arrow:</p>
  <pre><code>public class Arrow
  {
      public Point PointBeginning { get =&gt; pointBeginning; set =&gt; pointBeginning = value; }
      public Point PointEnding { get =&gt; pointEnding; set =&gt; pointEnding = value; }
      public int ArrowClickCounter { get =&gt; arrowClickCounter; set =&gt; arrowClickCounter = value; }
  
      public void Draw(object sender, MouseEventArgs e)
      {
          //code for drawing
      }
  }
  </code></pre>
  <p>Form1:</p>
  <pre><code>public class Form1
  {
      public delegate void DrawArrowDelegate(object sender, MouseEventArgs e);
      DrawArrowDelegate drawArrowDelegate = DrawArrow;
      /* .. */
  
      private void DrawArrow(object sender, MouseEventArgs e)
      {
          Arrow arrow = new Arrow();
          arrow.PointBegining = //some point
          arrow.PointEnding = //some another point
          arrow.Draw(sender, e);
      }
  }
  </code></pre>
  <p>UserControl:</p>
  <pre><code>public class UserControl
  {
      /*...*/
      
      private void button_MouseClick(object sender, MouseEventArgs e)
      {
          //And here i somehow want to call delegate. But don't know how :(
      }
  }
  </code></pre>
  <p>Sorry for such confused code :(</p>
  <p>Can you please recommend me something?</p>