Autor Beitrag
Vitalic
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 68



BeitragVerfasst: Di 12.10.10 15:21 
Hallo,

ich Versuche momentan ein Rechteck zu zeichnen, bekomme jedoch komische Zeichen über dem Bild (siehe Anhang).
Was mache ich hier falsch?

ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
        protected void Page_Load(object sender, EventArgs e)
        {
            Bitmap bild = new Bitmap(500300);
            Rectangle rechteck = new Rectangle(200100100100);
            Graphics grafik;
            grafik = Graphics.FromImage(bild);

            SolidBrush pinsel = new SolidBrush(Color.LightBlue);
            grafik.FillRectangle(pinsel, rechteck);
            Pen stift = new Pen(Color.Blue, 2);
            grafik.DrawRectangle(stift, rechteck);
            bild.Save(Response.OutputStream, ImageFormat.Gif);
        }

ausblenden XML-Daten
1:
2:
3:
4:
5:
6:
7:
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Image ID="bild" runat="server" />
    </div>
    </form>
</body>


Gruß,

Vitalic
Einloggen, um Attachments anzusehen!
danielf
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1012
Erhaltene Danke: 24

Windows XP
C#, Visual Studio
BeitragVerfasst: Di 12.10.10 15:44 
Hallo,

du schreibst das erzeugte Bild in den Response Output Stream (Zeile 12). Deshalb schickst du dort alles mit. Was du machen willst, ist ein Bild erstellen und dieses dem Image Control der ASP Seite zuzuweisen.

Sprich anstelle das Bild dem Stream zurückzuschreiben this.bild.Image = bild;

Gruß
Vitalic Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 68



BeitragVerfasst: Di 12.10.10 16:30 
@ danielf

this.bild.Image = bild; klappt leider nicht.


Gruß
Vitalic Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 68



BeitragVerfasst: Mo 18.10.10 11:41 
Hat keiner eine Lösung zu dem Problem?
traceurmicha
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 160
Erhaltene Danke: 9

Win XP SP2, Win 7 Pro., Ubuntu 9, Debian 5
C#, ASP.NET, MSSQL, PHP(Microsoft Visual Studio 2010 Ultimate, SharpDevelop 4, Microsoft SQL Server2008 Express, Eclipse for PHP)
BeitragVerfasst: Mo 18.10.10 11:48 
Ich habe mal deinen Code 1 zu 1 kopiert und ausgeführt, ich habe keinerlei Probleme damit im ie.

Was für einen Browser benutzt du?

_________________
Programmieren ist ein Rennen zwischen den Softwareentwicklern, die versuchen größere und bessere idiotensichere Programme zu schreiben und dem Universum, welches versucht größere und bessere Idioten zu produzieren. Zur Zeit liegt das Universum in Führung.
Vitalic Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 68



BeitragVerfasst: Mo 18.10.10 12:36 
@ traceurmicha

Danke!

Es liegt wirklich am Browser, im IE geht es wunderbar.

Ich benutze Chrome.
Vitalic Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 68



BeitragVerfasst: Di 19.10.10 12:00 
Ich habe ein weiteres Problem, bei dieser Zeichnung.


Ich habe eine Masterfolie erstellt und verwende 3 ContentPlaceHolder.
Wenn ich nun das Bild in dem Content ausgeben möchte, dann verschwindet die komplette Masterfolie und es wird nur das Bild angezeigt.

ausblenden XML-Daten
1:
2:
3:
<asp:Content ID="Content5" runat="server" ContentPlaceHolderID="ContentPlaceHolder3">
    <asp:Image ID="bild" runat="server" />
</asp:Content>
Vitalic Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 68



BeitragVerfasst: Mi 20.10.10 11:39 
Hat einer eine Idee, warum das ganze verschwindet?


Auch wenn ich einen Button habe und nach dem Drücken das Bild ausgebe, dann verschwindet auch der Button, wie kann man das verhindern?