473,320 Members | 1,691 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

TextureBrush Out Of Memory Exception

Hello,

Hopefully someone here can help me. I'm not sure what I am doing wrong, but
I am getting an Out Of Memory exception when I try to use a TextureBrush. I
have simplified my code to reproduce this error. Here is the code:

private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs
e)
{
Bitmap bmp = new Bitmap(@"C:\myimage.gif");
Rectangle rect = new Rectagle(10, 10, 100, 50);
TextureBrush brush = new TextureBrush(bmp, rect);
e.Graphics.FillRectangle(brush, rect);
}

The exception is thrown on the TextureBrush constructor. I have also found
that if I do not set the Rectangle parameter it works just fine, but then of
course my image is displayed at Point(0, 0) rather than Point(10, 10) where I
want it to begin.

I have searched for an answer to this and found nothing so I'm sure it must
be something simple I am doing wrong. Any help would be greatly appreciated.

Thanks,
Dave
Jul 21 '05 #1
0 1573

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Ganesan selvaraj | last post by:
I using C# .net. i want to split the text files based of the some condition. my source text file size may be 4 kb to 4 gb. some time when i split the i got the "out of memory exception. when i...
6
by: Fred Zwarts | last post by:
Hello, I am trying to debug some complex debug code. In order to track the use of dynamically allocated memory, I replaced the standard global new and delete operators. (Not for changing the...
2
by: CroDude | last post by:
Heya all! I have a weird problem when creating a texture brush in a Paint event. When program gets to the line where I'm creating a new TextureBrush object, it crashes with OutOfMemory...
2
by: Aravind | last post by:
Hi, I am ruuning to out of memory exception , My system has RAM of 4 GB and virtual memory paging size set to 4GB .When I check the memory occupied by the process during the exception , it is less...
0
by: foos | last post by:
Hello, Hopefully someone here can help me. I'm not sure what I am doing wrong, but I am getting an Out Of Memory exception when I try to use a TextureBrush. I have simplified my code to...
2
by: Ilkka | last post by:
I have created an C++ application with Windows Forms, ADO and SQL server 2005. Now I need to change something and started debugging the code. Then suddenly I receive an error. "An unhandled...
2
by: =?Utf-8?B?Tm9tYW4gQWxp?= | last post by:
Hi, We are facing a strange problem in our ASP. NET website. Some times it gives the following unhandled exception. Error Message: Exception of type System.Web.HttpUnhandledException was...
1
by: George2 | last post by:
Hello everyone, Such code segment is used to check whether function call or exception- handling mechanism runs out of memory first (written by Bjarne), void perverted() { try{
0
by: Mitch | last post by:
Im trying to do a simple 3d project and I dont want to use dx or xna. Im using DrawPoly to draw my meshes, and trying to use FillPolygon and a texturebrush to fill the polys with a image. The image...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.