title: Interface implementation in to my project
body: <p><strong>STARTING QUESTION</strong></p>
  
  <p>My general understanding of Interfaces is fine, I’ve read hundreds of examples and different articles on this subject but I’m still on a hold, because all this reading still hasn't given me an answer to where to use this tool in my own project.</p>
  
  <p>I'll try to come with a concrete example from my project on where I probably would have benefits from using Interfaces and hopefully someone could give me a concrete answer on how I should implement it.</p>
  
  <p>My purpose with this project was to draw an image in A4 size and preview it in a PictureBox (resized) and then have a GUI to create and move a barcode (with a caption text underneath) on this image in the PictureBox.</p>
  
  <p>Now I want to be able to draw another text object with same functionalities to move it around and show on the preview. But this will be a normal text and therefore it would have a different font and no caption.
  This could easily be done with a collection and a loop when drawing.</p>
  
  <p>But what if I want to add more objects to this image, wouldn't it be a lot easier to maintain and extent, if I used Interfaces?
  I would also like to elaborate my programming, by learning how to use something a little bit more complex.</p>
  
  <p><strong>CURRENT APPROACH TO A SOLUTION</strong></p>
  
  <p>My main Interface</p>
  
  <pre><code>public interface IElementCreator
  {
      int posX { get; set; }
      int posY { get; set; }
      StringFormat format { get; set; }
      string value { get; set; }
      Font font { get; set; }
      bool caption { get; set; }
      Font captionFont { get; set; }
  }
  </code></pre>
  
  <p>My main class for creating an element</p>
  
  <pre><code>public class ElementBase : IElementCreator, IImageUpdater
  {
      #region IElementCreator Variables
  
      private int _posX;
      private int _posY;
      private StringFormat _format;
      private string _value;
      private Font _font;
      private bool _caption;
      private Font _captionFont;
  
      #endregion
  
      #region IElementCreator Members
  
      public int posX
      {
          get { return _posX; }
          set { _posX = value; }
      }
  
      public int posY
      {
          get { return _posY; }
          set { _posY = value; }
      }
  
      public StringFormat format
      {
          get { return _format; }
          set { _format = value; }
      }
  
      public string value
      {
          get { return _value; }
          set { _value = value; }
      }
  
      public Font font
      {
          get { return _font; }
          set { _font = value; }
      }
  
      public bool caption
      {
          get { return _caption; }
          set { _caption = value; }
      }
  
      public Font captionFont
      {
          get { return _captionFont; }
          set { _captionFont = value; }
      }
  
      #endregion
  
      #region Constructor
  
      public ElementBase(int posX, int posY, StringFormat format, string value, Font font, bool caption, Font captionFont)
      {
          this.posX = posX;
          this.posY = posY;
          this.format = format;
          this.value = value;
          this.font = font;
          this.caption = caption;
          this.captionFont = captionFont;
      }
  
      #endregion
  
      public Image updatePreview(IElementCreator element, Image img)
      {
      }
  }
  </code></pre>
  
  <p>Interface to update the preview image</p>
  
  <pre><code>public interface IImageUpdater
  {
      Image updatePreview(IElementCreator element, Image img);
  }
  </code></pre>
  
  <p>I've not been able to test this yet, I've made the code and I'll start testing later.</p>
  
  <p>What I'm trying to achieve, is to have an interface to handle the creation of a basic text element. With this it should be possible to extent with new classes to handle text elements with different settings.</p>
  
  <p>This is just a starting point and I know some code are missing for everything to make sence, but I just want to share and make sure that i'm not completely of track.</p>