HtmlImage.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /* System.Web.UI.HtmlControls
  2. * Authors
  3. * Leen Toelen ([email protected])
  4. */
  5. using System;
  6. using System.Web;
  7. using System.Web.UI;
  8. using System.Globalization;
  9. namespace System.Web.UI.HtmlControls{
  10. public class HtmlImage : HtmlControl{
  11. public HtmlImage(): base("img"){}
  12. protected new void RenderAttributes(HtmlTextWriter writer){
  13. PreProcessRelativeReference(writer,"src");
  14. RenderAttributes(writer);
  15. writer.Write(" /");
  16. }
  17. public string Align{
  18. get{
  19. string attr = Attributes["align"];
  20. if (attr != null){
  21. return attr;
  22. }
  23. return String.Empty;
  24. }
  25. set{
  26. Attributes["align"] = AttributeToString(value);
  27. }
  28. }
  29. public string Alt{
  30. get{
  31. string attr = Attributes["alt"];
  32. if (attr != null){
  33. return attr;
  34. }
  35. return String.Empty;
  36. }
  37. set{
  38. Attributes["alt"] = AttributeToString(value);
  39. }
  40. }
  41. public int Border{
  42. get{
  43. string attr = Attributes["border"];
  44. if (attr != null){
  45. return Int32.Parse(attr,CultureInfo.InvariantCulture);
  46. }
  47. return -1;
  48. }
  49. set{
  50. Attributes["border"] = AttributeToString(value);
  51. }
  52. }
  53. public string Src{
  54. get{
  55. string attr = Attributes["src"];
  56. if (attr != null){
  57. return attr;
  58. }
  59. return String.Empty;
  60. }
  61. set{
  62. Attributes["src"] = AttributeToString(value);
  63. }
  64. }
  65. public int Width{
  66. get{
  67. string attr = Attributes["width"];
  68. if (attr != null){
  69. return Int32.Parse(attr,CultureInfo.InvariantCulture);
  70. }
  71. return -1;
  72. }
  73. set{
  74. Attributes["width"] = AttributeToString(value);
  75. }
  76. }
  77. } // class HtmlImage
  78. } // namespace System.Web.UI.HtmlControls