HtmlImageGIF.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using System;
  2. using System.Text;
  3. namespace ClearSlideLibrary.HtmlController
  4. {
  5. internal class HtmlImageGIF : HtmlPresentationElement
  6. {
  7. private readonly string _src;
  8. private readonly string _nameOfImage;
  9. public int Width
  10. {
  11. set { base.width = value; }
  12. }
  13. public int Height
  14. {
  15. set { base.height = value; }
  16. }
  17. public HtmlImageGIF(string slideId, string src,
  18. string nameOfImage, int top, int left)
  19. {
  20. base.id = slideId;
  21. base.top = top;
  22. base.left = left;
  23. this._src = src;
  24. this._nameOfImage = nameOfImage;
  25. }
  26. public override string DrawElement()
  27. {
  28. StringBuilder imageBuilder = new StringBuilder();
  29. string imageId = id + "s" + _nameOfImage;
  30. string source = _src + "/" + imageId + ".gif";
  31. imageBuilder.Append("<div id=\"" + imageId + "\" style=\"top:" + top.ToString() + "px;left:" +
  32. left.ToString() + "px;height:" + height.ToString() + "px;width:" + width.ToString() +
  33. "px;\">");
  34. imageBuilder.Append("<img src=\"" + source + "\" />");
  35. imageBuilder.Append("</div>");
  36. return imageBuilder.ToString();
  37. }
  38. public override string ToString()
  39. {
  40. Console.WriteLine("The top is:" + this.top);
  41. Console.WriteLine("The left is:" + this.left);
  42. Console.WriteLine("The width is:" + this.width);
  43. Console.WriteLine("The height is:" + this.height);
  44. Console.WriteLine("The src is:" + _src);
  45. return string.Format("[{0}, {1}, {2}, {3},{4}]", top, left, width, height, _src);
  46. }
  47. }
  48. }