Example:
<%@ Page Language="C#" %> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head2" runat="server"> <script runat="server"> private double swift = 10; public void ChangeSize(object sender, EventArgs e) { double w = this.imgDisplay.Width.Value; double h = this.imgDisplay.Height.Value; Button button = sender as Button; if (button.CommandName.Equals("ZI")) { h += swift; w += swift; } else if (button.CommandName.Equals("ZO")) { w -= swift; h -= swift; } this.imgDisplay.Height = new Unit(h); this.imgDisplay.Width = new Unit(w); } </script> </head> <body> <form id="form2" runat="server"> <asp:Image runat="server" ID="imgDisplay" ImageUrl="~/Images/Charith.jpg" Width="100px" Height="100px" /> <asp:Button runat="server" ID="btnZoomIn" OnClick="ChangeSize" Text="+" CommandName="ZI" /> <asp:Button runat="server" ID="btnZoomOut" OnClick="ChangeSize" Text="-" CommandName="ZO" /> </form> </body>
No comments:
Post a Comment