Hi,
ich hab ein Problem mit meinem Code, da die Exception ausgibt "Nicht genügend Arbeitsspeicher".
Ich wollte mir einen Screenshot vom Bildschirm machen und den Screenshot wieder in einzelne Blöcke aufteilen.
Dafür habe ich mir Pictureboxen dynamisch erstellt. Alle klappt super bis ich die Koordinaten von "Rectangle cloneRect = new Rectangle(iPointXPic, 0, 40, 25);" mit Int angebe. Also mit "iPointXPic" dann kommt die Meldung.
Kann mir einer sagen woran das liegt?
So sieht es mit "Rectangle cloneRect = new Rectangle(0, 0, 40, 25);" aus.
Edit:[Only registered and activated users can see links. Click Here To Register...]
MfG Ludder231
ich hab ein Problem mit meinem Code, da die Exception ausgibt "Nicht genügend Arbeitsspeicher".
Ich wollte mir einen Screenshot vom Bildschirm machen und den Screenshot wieder in einzelne Blöcke aufteilen.
Dafür habe ich mir Pictureboxen dynamisch erstellt. Alle klappt super bis ich die Koordinaten von "Rectangle cloneRect = new Rectangle(iPointXPic, 0, 40, 25);" mit Int angebe. Also mit "iPointXPic" dann kommt die Meldung.
PHP Code:
Bitmap bmpScreenshot = new Bitmap(640, 320, PixelFormat.Format32bppArgb);
Graphics gfxScreenshot = Graphics.FromImage(bmpScreenshot);
gfxScreenshot.CopyFromScreen(180, 370, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
pbAnalyseBild.Image = bmpScreenshot;
int iIndex = 0;
int iPointXPB = 650;
int iPointYPB = 30;
int iPointYPic = 0;
int iPointXPic = 0;
PictureBox[] pbPictureBox = new PictureBox[50];
for (int i = 0; i < 5; i++)
{
for (int k = 0; k < 10; k++)
{
Rectangle cloneRect = new Rectangle(iPointXPic, 0, 40, 25);
System.Drawing.Imaging.PixelFormat format = bmpScreenshot.PixelFormat;
Bitmap cloneBitmap = bmpScreenshot.Clone(cloneRect, format);
pbPictureBox[iIndex] = new PictureBox();
pbPictureBox[iIndex].Location = new Point(iPointXPB, iPointYPB);
pbPictureBox[iIndex].Name = "pic" + iIndex;
pbPictureBox[iIndex].Size = new Size(40, 25);
pbPictureBox[iIndex].Image = cloneBitmap;
this.Controls.Add(pbPictureBox[iIndex]);
iPointYPB += 30;
iPointXPic += 30;
iIndex++;
}
iPointXPB += 50;
iPointYPB = 30;
}
So sieht es mit "Rectangle cloneRect = new Rectangle(0, 0, 40, 25);" aus.
Edit:[Only registered and activated users can see links. Click Here To Register...]
MfG Ludder231