ciao a tutti,
ho realizzato un pagina in asp.net che alla pressione di un bottone dovrebbe generare un'immagine eseguendo un metodo in c# e poi farla vedere a video ma c'è un problema... non me la fa vedere!!!
Posto i codici
pagina asp
e il metodo in c#codice:<%@ Page language="c#" Inherits="WebDrawSamp.WebForm1" CodeFile="WebForm1.aspx.cs" ContentType="image/gif" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD> <title>WebForm1</title> <meta name="CODE_LANGUAGE" Content="C#"> </HEAD> <body> <form id="Form1" method="post" runat="server"> <asp:Button id="Button1" style="Z-INDEX: 101; LEFT: 396px; POSITION: absolute; TOP: 32px" runat="server" Text="Draw" Width="110px" Height="34px" onclick="Button1_Click"></asp:Button> </form> </body> </HTML>
ho intuito che un problema risiede nel non aver dato il content-type alla pagina asp, ma se dò come content type=image/gif non posso vedere il bottone e quindi sono punto e da capo.codice:protected void Button1_Click(object sender, System.EventArgs e) { Pen redPen = new Pen(Color.Red, 3); HatchBrush brush = new HatchBrush(HatchStyle.Cross, Color.Red, Color.Yellow); Pen hatchPen = new Pen(brush, 2); Bitmap curBitmap = new Bitmap(200, 200); Graphics g = Graphics.FromImage(curBitmap); g.FillRectangle(brush, 50, 50, 100, 100); g.DrawLine(Pens.WhiteSmoke, 10, 10, 180, 10); g.DrawLine(Pens.White, 10, 10, 10, 180); curBitmap.Save(this.Response.OutputStream, ImageFormat.Gif); g.Dispose(); }
Forse dovrei inserire un <asp:image> ???
Chiedo lumi!!! :master:

Rispondi quotando
guarda che il codice è uguale al 99,999E99% al tuo
ho solo aggiunto un dispose qua e là
