Click here to Skip to main content
15,904,287 members
Home / Discussions / C#
   

C#

 
QuestionHeaders and Footers in Office 2007 object model Pin
Viram23-Sep-08 20:20
Viram23-Sep-08 20:20 
QuestionExport as PDF file from C# page Pin
r aa j23-Sep-08 20:09
r aa j23-Sep-08 20:09 
Generalcreate family tree with C# visual basic 2005 Pin
jielun23-Sep-08 19:54
jielun23-Sep-08 19:54 
GeneralRe: create family tree with C# visual basic 2005 Pin
John_Adams23-Sep-08 21:43
John_Adams23-Sep-08 21:43 
GeneralRe: create family tree with C# visual basic 2005 Pin
ChandraRam24-Sep-08 0:04
ChandraRam24-Sep-08 0:04 
Questioncreate family tree with C# visual basic 2005 pls help me Pin
jielun23-Sep-08 19:53
jielun23-Sep-08 19:53 
AnswerRe: create family tree with C# visual basic 2005 pls help me Pin
John_Adams23-Sep-08 21:40
John_Adams23-Sep-08 21:40 
QuestionRequirement: How I can get all the applications registered in windows os includes with Administative Tools Pin
apparikiran23-Sep-08 19:53
apparikiran23-Sep-08 19:53 
AnswerRe: Requirement: How I can get all the applications registered in windows os includes with Administative Tools Pin
Tamer Oz23-Sep-08 21:36
Tamer Oz23-Sep-08 21:36 
QuestionRequirement: Getting all the installed exe's in windows os and Administrative tools Pin
apparikiran23-Sep-08 19:48
apparikiran23-Sep-08 19:48 
QuestionHow to marshal string array from C# to VB? Pin
nicolus23-Sep-08 19:35
nicolus23-Sep-08 19:35 
AnswerRe: How to marshal string array from C# to VB? Pin
oobimoo24-Sep-08 1:18
oobimoo24-Sep-08 1:18 
GeneralRe: How to marshal string array from C# to VB? Pin
nicolus24-Sep-08 23:10
nicolus24-Sep-08 23:10 
QuestionC# Word automation Pin
g_dev23-Sep-08 18:27
g_dev23-Sep-08 18:27 
QuestionRe: Invoke/Thread Pin
myNameIsRon23-Sep-08 17:52
myNameIsRon23-Sep-08 17:52 
AnswerRe: Invoke/Thread Pin
N a v a n e e t h23-Sep-08 17:56
N a v a n e e t h23-Sep-08 17:56 
GeneralRe: Invoke/Thread Pin
myNameIsRon23-Sep-08 19:24
myNameIsRon23-Sep-08 19:24 
AnswerRe: Invoke/Thread Pin
Mohammad Dayyan23-Sep-08 18:51
Mohammad Dayyan23-Sep-08 18:51 
GeneralRe: Invoke/Thread Pin
myNameIsRon23-Sep-08 19:30
myNameIsRon23-Sep-08 19:30 
GeneralRe: Invoke/Thread Pin
Mohammad Dayyan24-Sep-08 3:45
Mohammad Dayyan24-Sep-08 3:45 
AnswerRe: Invoke/Thread Pin
Mark Churchill23-Sep-08 22:59
Mark Churchill23-Sep-08 22:59 
GeneralRe: Invoke/Thread Pin
myNameIsRon24-Sep-08 4:30
myNameIsRon24-Sep-08 4:30 
GeneralRe: Invoke/Thread Pin
Mark Churchill24-Sep-08 18:56
Mark Churchill24-Sep-08 18:56 
GeneralRe: Invoke/Thread Pin
myNameIsRon24-Sep-08 19:47
myNameIsRon24-Sep-08 19:47 
QuestionOut of memory error Pin
Xmen Real 23-Sep-08 17:14
professional Xmen Real 23-Sep-08 17:14 
hi guys,
i have developed an application that will convert every image file in selected folder to .png and scale images to some specified sizes with checking which one is best. Those sizes are 64 128 256 512 1024 2048. The app checks which is nearest size to scale. For instance, if image dimension is (65 x 125) then it will scale it to 64 x 128 because 65 is nearest to 64 than 128 and 125 is nearest to 128 than 64 and so on...so to this i have coded the app like this :

private void button3_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog fbd = new FolderBrowserDialog();
            if (fbd.ShowDialog() == DialogResult.OK)
            {
                Xal.Clear(); // ArrayList               
                getDirs(fbd.SelectedPath); // To Fill AL
                string[] tmp_filePaths = (string[])Xal.ToArray(typeof(string));
                for (int a = 0; a < tmp_filePaths.Length; a++)
                {
                    if (!tmp_filePaths[a].EndsWith(".txt"))
                    {
                        Image tmp_image = Image.FromFile(tmp_filePaths[a]); //<< Error Line (out of memory)
                        int newwidth = roundToNearestPixel(tmp_image.Width);
                        int newheight = roundToNearestPixel(tmp_image.Height);
                        Bitmap tmp_bmp = new Bitmap(newwidth, newheight);
                        Graphics tmp_gra = Graphics.FromImage(tmp_bmp);
                        tmp_gra.DrawImage(tmp_image, 0, 0, newwidth, newheight);
                        tmp_bmp.Save(@"D:\texts\" + Path.GetFileNameWithoutExtension(tmp_filePaths[a]) + ".png", System.Drawing.Imaging.ImageFormat.Png);
                        tmp_gra.Dispose();
                    }
                }
            }            
        }

        short[] dimensions = new short[] { 64, 128, 256, 512, 1024, 2048, 4096 };
        int roundToNearestPixel(int value)
        {
            int result;
            if (value <= 64)
            {
                result = 64;
                return result;
            }
            int pointer = 0;

            for (int a = 0; a < dimensions.Length; a++)
            {
                if (dimensions[a] >= value)
                {
                    pointer = a;
                    break;
                }
            }
            int shortdistance = value - dimensions[pointer - 1];
            int largedistance = dimensions[pointer] - value;
            if (shortdistance < largedistance)
                result = dimensions[pointer - 1];
            else
                result = dimensions[pointer];
            return result;
        }


now its doing what i needed but it gives an error as well that is out of memory after every 174 images, i have commented that line. So can anybody tell me how to solve this ?

thanks

TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i’TV.C\y<pŠjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can

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.