Autor Beitrag
Questioneer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 32



BeitragVerfasst: Fr 24.10.08 11:34 
Hai Leute,

hab schon wieder ein kleines Problem.
Ich habe eine Bmp in einer PictureBox liegen, in diese PictureBox möchte ich durch eine Api Funktion oder eine Funktion von C# einzelne Pixel malen.

Wenn dich das versuche bekomme ich aber die Fehlermeldung
Zitat:

2008\Projects\Picture\Picture_02\Picture_01\bin\Debug\Picture8.bmp zugreifen, da sie von einem anderen Prozess verwendet wird.


Da es aber kein anderes Picture/Image - Steuerelement gibt, dachte ich vllt. irgendwie Apifunktionen zu verwenden die mir das Bild auf meine Form klatschen.
Was mein Ihr, habt Ihr eine Ahneung wie ich das mit der Api geregelt bekomme, oder habt Ihr bessere/andere Vorschläge ?


Vielen Dank für eure Hilfe & Mühe
Questioneer
Th69
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Moderator
Beiträge: 4807
Erhaltene Danke: 1061

Win10
C#, C++ (VS 2017/19/22)
BeitragVerfasst: Fr 24.10.08 12:09 
Ich nehme an, du liest das Bild mittels Image.FromFile() ein?
Die bessere Alternative ist Image.FromStream() zu verwenden und den übergebenen FileStream wieder zu schließen (Close() bzw. Dispose()).
Questioneer Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 32



BeitragVerfasst: Fr 24.10.08 14:37 
Hi,

ich füge das Bild einfach per Assistenten in die PictureBox ein.
Nun möchte ich per ButtonClick einfach Pixel an bestimmten Koordinaten mit einer bestimmten Farbe draufsetzen !!!


;)
Gruß
Questioneer
Questioneer Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 32



BeitragVerfasst: Fr 24.10.08 14:49 
P.S.: Das ganze muss nicht in einer PictureBox stattfinden, das kann natürlich auch direkt asf die Form geklatscht werden !

Danke Leute
Questioneer
Kha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3803
Erhaltene Danke: 176

Arch Linux
Python, C, C++ (vim)
BeitragVerfasst: Fr 24.10.08 15:25 
Welche Zeile genau ruft die Fehlermeldung hervor? Sicher nicht das Malen von Pixeln.

_________________
>λ=
Questioneer Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 32



BeitragVerfasst: Mo 27.10.08 11:31 
Hi,

ich habe das ganze jetzt so gelöst :

ausblenden Quelltext
1:
2:
3:
4:
            Form frmPreview = new Form();
            Graphics dc = this.CreateGraphics();
            Image img = Image.FromFile(strPfad);
            dc.DrawImage(img, 50, 250);


Gruß
Questioneer