HtmlImage.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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 override void RenderAttributes(HtmlTextWriter writer){
  13. PreProcessRelativeReference(writer,"src");
  14. base.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 int Height
  54. {
  55. get {
  56. string attr = Attributes ["height"];
  57. if (attr != null)
  58. return Int32.Parse (attr, CultureInfo.InvariantCulture);
  59. return -1;
  60. }
  61. set { Attributes["height"] = AttributeToString (value); }
  62. }
  63. public string Src{
  64. get{
  65. string attr = Attributes["src"];
  66. if (attr != null){
  67. return attr;
  68. }
  69. return String.Empty;
  70. }
  71. set{
  72. Attributes["src"] = AttributeToString(value);
  73. }
  74. }
  75. public int Width{
  76. get{
  77. string attr = Attributes["width"];
  78. if (attr != null){
  79. return Int32.Parse(attr,CultureInfo.InvariantCulture);
  80. }
  81. return -1;
  82. }
  83. set{
  84. Attributes["width"] = AttributeToString(value);
  85. }
  86. }
  87. } // class HtmlImage
  88. } // namespace System.Web.UI.HtmlControls