Muestra las diferencias entre dos versiones de la página.
| Ambos lados, revisión anterior Revisión previa Próxima revisión | Revisión previa | ||
|
sp:aspnet:wapps [2010/06/30 18:52] alfred |
sp:aspnet:wapps [2020/05/09 09:25] (actual) |
||
|---|---|---|---|
| Línea 666: | Línea 666: | ||
| ===== Otros ===== | ===== Otros ===== | ||
| + | |||
| Línea 682: | Línea 683: | ||
| public void ProcessRequest(HttpContext context) { | public void ProcessRequest(HttpContext context) { | ||
| context.Response.ContentType = "image/jpeg"; | context.Response.ContentType = "image/jpeg"; | ||
| - | System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(100, 100, System.Drawing.Imaging.PixelFormat.Format32bppRgb); | + | System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(100, 100); |
| System.Drawing.Brush b = new System.Drawing.SolidBrush (System.Drawing.Color.FromArgb(255, 0,0)); | System.Drawing.Brush b = new System.Drawing.SolidBrush (System.Drawing.Color.FromArgb(255, 0,0)); | ||
| System.Drawing.Graphics.FromImage(bmp).FillRectangle(b, new System.Drawing.Rectangle(0, 0, 100, 100)); | System.Drawing.Graphics.FromImage(bmp).FillRectangle(b, new System.Drawing.Rectangle(0, 0, 100, 100)); | ||
| Línea 694: | Línea 695: | ||
| } | } | ||
| } | } | ||
| + | </code> | ||
| + | Aunque también lo podrías poner en una página: | ||
| + | <code> | ||
| + | <%@ Page ContentType = "image/jpeg"%> | ||
| + | <%@ Import Namespace = "System.Drawing" %> | ||
| + | <%@ Import Namespace = "System.Drawing.Imaging" %> | ||
| + | |||
| + | <Script Runat = "Server"> | ||
| + | Bitmap bmp = new Bitmap(100, 100); | ||
| + | Brush b = new SolidBrush (System.Drawing.Color.FromArgb(255, 0,0)); | ||
| + | Graphics.FromImage(bmp).FillRectangle(b, new Rectangle(0, 0, 100, 100)); | ||
| + | bmp.Save(Response.OutputStream, ImageFormat.Jpeg); | ||
| + | </Script> | ||
| </code> | </code> | ||