Autor Beitrag
Thu#
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 19



BeitragVerfasst: Sa 19.12.09 17:04 
Hallo,

hier am besten mal mein Code:

ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
                     //Uhrzeit
                    string strUhrzeit = DateTime.Now.Hour + ":" + DateTime.Now.Minute + ":" + DateTime.Now.Second;
                    System.Drawing.Font drawFont = new System.Drawing.Font("Arial"22, FontStyle.Bold);
                    SolidBrush drawBrush = new SolidBrush(Color.Black);
                   
                        // POSITION RECHNEN
                        Bitmap bmp = (Bitmap)pct_preview.Image;
                        int intX_POSI = bmp.Width - 70;
                        int intY_POSI = bmp.Height - 20;
                        

                    PointF drawPoint = new Point(intX_POSI, intY_POSI);
                    e.Graphics.DrawString(strUhrzeit, drawFont, drawBrush, drawPoint);


Also ich hab mir damit wunderbar die Uhrzeit auf mein Bild gezeichnet, an die untere rechte Ecke. Doch diese Zeichnung ist ja auf diese "Leinwand" vor der PictureBox gemalt. Ich möchte aber, dass das gezeichnete auf der Bitmap ist, so dass ich das Bild auch abspeichern könnte, und die gezeichnete Uhrzeit mit drauf ist. Wie bekomm ich das hin?

Danke euch

Gruß : )
danielf
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1012
Erhaltene Danke: 24

Windows XP
C#, Visual Studio
BeitragVerfasst: Mo 21.12.09 15:43 
Hallo,

in Zeile 13 schreibst du ja deinen String auf das Graphics-Objekt, welches du per Event-Parameter bekommen hast, auf den Screen. Wenn du nun nicht auf den Screen schreiben willst, sondern auf das Bild, musst du das Graphics von dem Bild nehmen.

Hinweis:
Graphics.FromImage()...

Gruß Daniel
Thu# Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 19



BeitragVerfasst: Di 22.12.09 15:03 
Ah wunderbar, hat geklappt! Danke!