Hallo,also ich habe das mal mit dem Timer versucht, aber es funktioniert auch nicht!
Ich bekomme kein Bild angezeigt.
Ich habe das ganze mit dem Label ausprobiert und das funktioniert, aber mit dem Image klappt es nicht.
Ich bitte um Lösungsvorschläge.
Default.aspx.cs
C#-Quelltext
1: 2: 3: 4: 5: 6: 7: 8:
| protected void Timer1_Tick(object sender, EventArgs e) { Bitmap image = new Bitmap(700, 500); Graphics g = Graphics.FromImage(image); g.DrawRectangle(Pens.Red, 0, 50, 50, 50); Font font = new Font("Calibri", 8, FontStyle.Regular); image.Save(Response.OutputStream, ImageFormat.Png); } |
Default.aspx
XML-Daten
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17:
| <body> <form id="form1" runat="server"> <div> <asp:Timer ID="Timer1" OnTick="Timer1_Tick" runat="server" Interval="1000"> </asp:Timer> </div> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <Triggers> <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" /> </Triggers> <ContentTemplate> <asp:Image ID="image" runat="server" /> </ContentTemplate> </asp:UpdatePanel> </form> </body> |
Gruß, Vitalic