Click here to Skip to main content
15,909,091 members
Home / Discussions / C#
   

C#

 
GeneralRe: path 2 get image file from resource Pin
Luc Pattyn9-Apr-07 13:57
sitebuilderLuc Pattyn9-Apr-07 13:57 
QuestionSystem.Diagnostics.Design? Pin
Vodstok9-Apr-07 6:17
Vodstok9-Apr-07 6:17 
AnswerRe: System.Diagnostics.Design? Pin
Colin Angus Mackay9-Apr-07 6:23
Colin Angus Mackay9-Apr-07 6:23 
GeneralRe: System.Diagnostics.Design? Pin
Vodstok9-Apr-07 7:13
Vodstok9-Apr-07 7:13 
GeneralRe: System.Diagnostics.Design? Pin
Colin Angus Mackay9-Apr-07 7:37
Colin Angus Mackay9-Apr-07 7:37 
GeneralRe: System.Diagnostics.Design? Pin
Vodstok9-Apr-07 7:43
Vodstok9-Apr-07 7:43 
AnswerRe: System.Diagnostics.Design? Pin
Dan Neely9-Apr-07 7:11
Dan Neely9-Apr-07 7:11 
QuestionWhere is my memory? [modified] Pin
lak-b9-Apr-07 5:17
lak-b9-Apr-07 5:17 
I have this code (it’s for picture resize):

    <br />
    public static void Resize(int newWidth, int newHeight, Bitmap Source, ref Bitmap Recipient)<br />
    {<br />
        IntPtr ptr = Source.GetHbitmap();<br />
        System.Drawing.Image g = System.Drawing.Image.FromHbitmap(ptr);<br />
<br />
        Size thumbSize = new Size(newWidth, newHeight);<br />
        //Creating blank image as a canvas<br />
        Bitmap imgOutput = new Bitmap(thumbSize.Width, thumbSize.Height);<br />
        imgOutput.MakeTransparent();<br />
        imgOutput.MakeTransparent(Color.Black);<br />
        //Create graphics object for alteration<br />
<br />
        Graphics newGraphics = Graphics.FromImage(imgOutput);<br />
        newGraphics.Clear(Color.FromArgb(0, 255, 255, 255)); //blank the image<br />
        //Setting High Quality Transformation<br />
        newGraphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;<br />
        newGraphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;<br />
        newGraphics.DrawImage(g, 0, 0, thumbSize.Width, thumbSize.Height);<br />
        newGraphics.Flush();<br />
<br />
        newGraphics.Dispose();<br />
        g.Dispose();<br />
        ptr = new IntPtr();<br />
        Recipient = new Bitmap(imgOutput);<br />
        imgOutput.Dispose();  <br />
<br />
        //Recipient = new Bitmap(Source);<br />
    }     


And I want to run it in the loop for some pictures. But when I try to do this, a lot of memory becomes busy (some times OutOfMemory error rises). When the loop ends memory is steel busy.

Seem like I have a memory leak. But I can’t understand what is wrong in my code?
Sorry for language -)



-- modified at 12:08 Monday 9th April, 2007
AnswerRe: Where is my memory? Pin
S. Senthil Kumar9-Apr-07 6:36
S. Senthil Kumar9-Apr-07 6:36 
GeneralRe: Where is my memory? Pin
lak-b9-Apr-07 7:49
lak-b9-Apr-07 7:49 
GeneralRe: Where is my memory? Pin
S. Senthil Kumar9-Apr-07 9:28
S. Senthil Kumar9-Apr-07 9:28 
QuestionDecorator Pattern Related Question Pin
jubilanttiger9-Apr-07 4:31
jubilanttiger9-Apr-07 4:31 
AnswerRe: Decorator Pattern Related Question Pin
Leslie Sanford9-Apr-07 6:14
Leslie Sanford9-Apr-07 6:14 
QuestionThread Aorting Pin
HexaDeveloper9-Apr-07 3:37
HexaDeveloper9-Apr-07 3:37 
AnswerRe: Thread Aorting Pin
Leslie Sanford9-Apr-07 5:32
Leslie Sanford9-Apr-07 5:32 
GeneralRe: Thread Aorting [modified] Pin
HexaDeveloper10-Apr-07 14:01
HexaDeveloper10-Apr-07 14:01 
Questioncombobox database value Pin
msogun9-Apr-07 3:36
msogun9-Apr-07 3:36 
AnswerRe: combobox database value Pin
Colin Angus Mackay9-Apr-07 3:42
Colin Angus Mackay9-Apr-07 3:42 
QuestionWhich is better C# or VC++.NET Pin
BlrBoy9-Apr-07 2:33
BlrBoy9-Apr-07 2:33 
AnswerRe: Which is better C# or VC++.NET Pin
Colin Angus Mackay9-Apr-07 3:41
Colin Angus Mackay9-Apr-07 3:41 
QuestionBetter to save locally? Pin
Aaron VanWieren9-Apr-07 2:27
Aaron VanWieren9-Apr-07 2:27 
AnswerRe: Better to save locally? Pin
Colin Angus Mackay9-Apr-07 3:40
Colin Angus Mackay9-Apr-07 3:40 
GeneralRe: Better to save locally? Pin
Aaron VanWieren9-Apr-07 5:47
Aaron VanWieren9-Apr-07 5:47 
GeneralRe: Better to save locally? Pin
Colin Angus Mackay9-Apr-07 6:22
Colin Angus Mackay9-Apr-07 6:22 
GeneralRe: Better to save locally? Pin
Aaron VanWieren9-Apr-07 6:33
Aaron VanWieren9-Apr-07 6:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.