Hallo
Ich möchte in der Form frmPlayerMitChart ein animiertes Bitmap als Filter anzeigen. Allerdings bricht das Programm schon beim Konstruktor der Form mit einer OutOfVideoMemoryException ab. Ich benutze folgenden Code :
An diesem Punkt kommt die OutOfWideoMemoryException hoch.Ich weis aber nicht warum. Ich brauche dringend Hilfe.
Danke
Jens Leidel
Ich möchte in der Form frmPlayerMitChart ein animiertes Bitmap als Filter anzeigen. Allerdings bricht das Programm schon beim Konstruktor der Form mit einer OutOfVideoMemoryException ab. Ich benutze folgenden Code :
C#:
using DirectShowLib; // findet man unter :http://sourceforge.net/projects/directshownet/
using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;
Konstruktor:
public frmPlayerMitChart()
{
InitializeComponent();
// We paint the windows ourself
this.SetStyle(ControlStyles.UserPaint | controlStyles.AllPaintingInWmPaint, true);
// Get the colorkeyed bitmap without antialiasing
Bitmap bmp = new Bitmap(256, 256, PixelFormat.Format24bppRgb);
//
Bitmap alphabmp = new Bitmap(256, 256, PixelFormat.Format32bppArgb);
Graphics g = Graphics.FromImage(bmp);
// Do antialiased drawings
g.SmoothingMode = SmoothingMode.AntiAlias;
g.TextRenderingHint = TextRenderingHint.AntiAlias;
// Clear the bitmap with complete transparency
g.Clear(Color.Transparent);//
// Draw serveral cicles with various Alpha values
g.FillEllipse(violet25, 9, 9, 110, 110);
g.DrawEllipse(blackBorder, 9, 9, 110, 110);
g.DrawString("25%", font, text100, 40, 50);
// Release GDI+ objects
blackBorder.Dispose();
violet25.Dispose();
red50.Dispose();
green75.Dispose();
blue100.Dispose();
font.Dispose();
text100.Dispose();
g.Dispose();
// Basic Presentation Parameters...
presentParams = new PresentParameters();
presentParams.Windowed = true;
presentParams.SwapEffect = SwapEffect.Discard;
// Assume a hardware Direct3D device is available
// Add MultiThreaded to be safe. Each DirectShow filter runs in a separate thread...
device = new Device(
0,
DeviceType.Hardware,
this,
CreateFlags.SoftwareVertexProcessing | CreateFlags.MultiThreaded,
presentParams
);
...
}
Danke
Jens Leidel