Click here to Skip to main content
15,911,646 members
Home / Discussions / C#
   

C#

 
QuestionDataGridView-Database in csharp smart device Pin
Tunisien8622-Apr-10 6:14
Tunisien8622-Apr-10 6:14 
AnswerRe: DataGridView-Database in csharp smart device Pin
Dan Mos22-Apr-10 7:55
Dan Mos22-Apr-10 7:55 
GeneralRe: DataGridView-Database in csharp smart device Pin
Tunisien8623-Apr-10 10:00
Tunisien8623-Apr-10 10:00 
QuestionThread Sync Query Pin
AmitDey22-Apr-10 5:09
AmitDey22-Apr-10 5:09 
AnswerRe: Thread Sync Query Pin
Luc Pattyn22-Apr-10 5:18
sitebuilderLuc Pattyn22-Apr-10 5:18 
QuestionListviewItems arrangement with csharp smart device [modified] Pin
Tunisien8622-Apr-10 3:55
Tunisien8622-Apr-10 3:55 
AnswerRe: ListviewItems arrangement with csharp smart device Pin
Tunisien8622-Apr-10 5:30
Tunisien8622-Apr-10 5:30 
QuestionSave multipaged Tiff image to file, looses the pages ??? Pin
Paw Jershauge22-Apr-10 3:47
Paw Jershauge22-Apr-10 3:47 
Hmm cant find my error here.
I have the following code
private static Image ImagesToTiff(Image[] pages)
{
    try
    {
        EncoderParameters ep = new EncoderParameters(2);
        ep.Param[0] = new EncoderParameter(Encoder.SaveFlag, (long)EncoderValue.MultiFrame);
        ep.Param[1] = new EncoderParameter(Encoder.ColorDepth, (long)ColorDepth.Depth32Bit);
        MemoryStream ms = new MemoryStream();
        Bitmap Tiff = new Bitmap(pages[0]);
        Tiff.Save(ms, GetEncoder(ImageFormat.Tiff), ep);
        ep.Param[0] = new EncoderParameter(Encoder.SaveFlag, (long)EncoderValue.FrameDimensionPage);
        for (int i = 1; i < pages.Length; i++)
        {
            Tiff.SaveAdd(pages[i], ep);
            if (i == pages.Length - 1)
            {
                EncoderParameters epx = new EncoderParameters(2);
                epx.Param[0] = new EncoderParameter(Encoder.SaveFlag, (long)EncoderValue.Flush);
                epx.Param[1] = new EncoderParameter(Encoder.SaveFlag, (long)EncoderValue.LastFrame);
                Tiff.SaveAdd(epx);
            }
        }
        return Image.FromStream(ms);
    }
    catch (Exception)
    {
        throw;
    }
}

public static void DemoTheCode()
{
    Bitmap b = new Bitmap(100,100);
    Bitmap[] imgs = new Bitmap[2];
    Graphics g = Graphics.FromImage(b);
    g.FillRectangle(Brushes.Red,0,0,100,100);
    g.Save();
    imgs[0] = b;
    g.FillRectangle(Brushes.Blue,0,0,100,100);
    g.Save();
    imgs[1] = b;
    Image MyTiffOfTwoPages = ImagesToTiff(imgs);
    int Pages = MyTiffOfTwoPages.GetFrameCount(FrameDimension.Page); // this returns 2 as expected
    MyTiffOfTwoPages.Save(@"C:\Demo.Tiff", ImageFormat.Tiff); // But when i save the file, theres only one frame ???
}


Please look at the 2 last lines of code to see what i mean...

Does anyone know why ? am i missing somwthing here ?
With great code, comes great complexity, so keep it simple stupid...Shucks | :-\ Shucks | :-\

AnswerRe: Save multipaged Tiff image to file, looses the pages ??? Pin
Henry Minute22-Apr-10 5:18
Henry Minute22-Apr-10 5:18 
GeneralRe: Save multipaged Tiff image to file, looses the pages ??? Pin
Paw Jershauge22-Apr-10 20:22
Paw Jershauge22-Apr-10 20:22 
Questionc# and sql windows 7 problem Pin
michaelgr122-Apr-10 3:22
michaelgr122-Apr-10 3:22 
AnswerRe: c# and sql windows 7 problem Pin
dan!sh 22-Apr-10 4:42
professional dan!sh 22-Apr-10 4:42 
AnswerRe: c# and sql windows 7 problem Pin
Not Active22-Apr-10 4:47
mentorNot Active22-Apr-10 4:47 
GeneralRe: c# and sql windows 7 problem Pin
Swiftain22-Apr-10 4:50
Swiftain22-Apr-10 4:50 
GeneralRe: c# and sql windows 7 problem Pin
michaelgr122-Apr-10 5:52
michaelgr122-Apr-10 5:52 
GeneralRe: c# and sql windows 7 problem Pin
Not Active22-Apr-10 6:14
mentorNot Active22-Apr-10 6:14 
GeneralRe: c# and sql windows 7 problem Pin
Not Active22-Apr-10 6:13
mentorNot Active22-Apr-10 6:13 
QuestionImported DLL problem Pin
TimSWatson22-Apr-10 3:00
TimSWatson22-Apr-10 3:00 
AnswerRe: Imported DLL problem Pin
Luc Pattyn22-Apr-10 3:38
sitebuilderLuc Pattyn22-Apr-10 3:38 
AnswerRe: Imported DLL problem Pin
David Knechtges22-Apr-10 3:44
David Knechtges22-Apr-10 3:44 
QuestionThumbnail control for sorting images by drag & drop Pin
ab-tools22-Apr-10 2:32
ab-tools22-Apr-10 2:32 
AnswerRe: Thumbnail control for sorting images by drag & drop Pin
Eddy Vluggen22-Apr-10 5:36
professionalEddy Vluggen22-Apr-10 5:36 
GeneralRe: Thumbnail control for sorting images by drag & drop Pin
ab-tools22-Apr-10 5:44
ab-tools22-Apr-10 5:44 
GeneralRe: Thumbnail control for sorting images by drag & drop Pin
Eddy Vluggen22-Apr-10 6:01
professionalEddy Vluggen22-Apr-10 6:01 
GeneralRe: Thumbnail control for sorting images by drag & drop Pin
ab-tools22-Apr-10 6:11
ab-tools22-Apr-10 6:11 

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.