Click here to Skip to main content
15,900,973 members
Home / Discussions / C#
   

C#

 
QuestionList suggestions for my needs Pin
grmihel229-Apr-10 2:58
grmihel229-Apr-10 2:58 
AnswerRe: List suggestions for my needs Pin
Henry Minute29-Apr-10 4:42
Henry Minute29-Apr-10 4:42 
GeneralRe: List suggestions for my needs Pin
grmihel23-May-10 4:28
grmihel23-May-10 4:28 
AnswerRe: List suggestions for my needs Pin
PIEBALDconsult29-Apr-10 8:23
mvePIEBALDconsult29-Apr-10 8:23 
GeneralRe: List suggestions for my needs Pin
grmihel23-May-10 4:24
grmihel23-May-10 4:24 
GeneralRe: List suggestions for my needs Pin
PIEBALDconsult3-May-10 5:19
mvePIEBALDconsult3-May-10 5:19 
GeneralRe: List suggestions for my needs Pin
grmihel24-May-10 0:13
grmihel24-May-10 0:13 
QuestionMulti-Page TIFF support Pin
Jordy "Kaiwa" Ruiter28-Apr-10 23:27
Jordy "Kaiwa" Ruiter28-Apr-10 23:27 
So, I gave this a try today for my ImageViewer UserControl (See my articles for more detail on it). And people have requested me to implement Multi-Page TIFF support.

Now I have been trying lots of different techniques for it but none of them seem to really work. My UserControl accepts images in 2 different ways. By passing in a FilePath or an Image through properties. Both these properties end up with having storing the image into a Bitmap.

Now this Bitmap is used in my Draw methods and if I try to do a SelectActiveFrame() it crashes on me with GDI+ An generic error has occured ExternalException (0x80004005).
What I tried to do is creating a new Bitmap of the original and then doing the SelectActiveFrame() and that did not crash. However it did not display either.

Here is a sample of my code from my DrawObject class:

C#
// Gets the total number of frames in the .tiff file
pages = this.bmp.GetFrameCount(System.Drawing.Imaging.FrameDimension.Page);
currentPage = 0;
if (pages > 1) { multiPage = true; } else { multiPage = false; }


C#
public void NextPage()
{
   try
   {
      if (this.bmp != null)
      {
         int nextPage = this.currentPage + 1;

         if (nextPage <= this.pages)
         {
            Bitmap myImg = new Bitmap(this.bmp);
                                                
            myImg.SelectActiveFrame(System.Drawing.Imaging.FrameDimension.Page, nextPage);

            this.bmp.Dispose();
            this.bmp = null;

            this.bmp = myImg;

            currentPage = nextPage;
         }
      }
   }
   catch (Exception ex)
   {
      System.Windows.Forms.MessageBox.Show("ImageViewer error: " + ex.ToString());
   }
}


And here is the code that calls the NextPage() function:

C#
drawing.NextPage();

pbFull.Refresh();
UpdatePanels(true);


And PreviousPage() is exactly the same but with a minus ofcourse.

Any help would be much appreciated, I've been staring at it for hours now Frown | :(
AnswerRe: Multi-Page TIFF support Pin
Luc Pattyn29-Apr-10 0:59
sitebuilderLuc Pattyn29-Apr-10 0:59 
QuestionRe: Multi-Page TIFF support [modified] Pin
Jordy "Kaiwa" Ruiter29-Apr-10 1:11
Jordy "Kaiwa" Ruiter29-Apr-10 1:11 
GeneralRe: Multi-Page TIFF support [modified] Pin
Luc Pattyn29-Apr-10 1:36
sitebuilderLuc Pattyn29-Apr-10 1:36 
GeneralRe: Multi-Page TIFF support Pin
Jordy "Kaiwa" Ruiter29-Apr-10 2:41
Jordy "Kaiwa" Ruiter29-Apr-10 2:41 
GeneralRe: Multi-Page TIFF support Pin
Luc Pattyn29-Apr-10 3:03
sitebuilderLuc Pattyn29-Apr-10 3:03 
GeneralRe: Multi-Page TIFF support Pin
Jordy "Kaiwa" Ruiter29-Apr-10 3:24
Jordy "Kaiwa" Ruiter29-Apr-10 3:24 
GeneralRe: Multi-Page TIFF support Pin
Luc Pattyn29-Apr-10 3:32
sitebuilderLuc Pattyn29-Apr-10 3:32 
GeneralRe: Multi-Page TIFF support Pin
Jordy "Kaiwa" Ruiter29-Apr-10 3:39
Jordy "Kaiwa" Ruiter29-Apr-10 3:39 
GeneralRe: Multi-Page TIFF support Pin
Luc Pattyn29-Apr-10 3:51
sitebuilderLuc Pattyn29-Apr-10 3:51 
QuestionIs it Possible to download a pdf file from a web page without showing the URL of pdf file in address bar Pin
Puneet Bhatnagar28-Apr-10 22:49
Puneet Bhatnagar28-Apr-10 22:49 
AnswerRe: Is it Possible to download a pdf file from a web page without showing the URL of pdf file in address bar Pin
Gaurav Dudeja India28-Apr-10 22:57
Gaurav Dudeja India28-Apr-10 22:57 
GeneralRe: Is it Possible to download a pdf file from a web page without showing the URL of pdf file in address bar Pin
Matt Meyer29-Apr-10 6:12
Matt Meyer29-Apr-10 6:12 
AnswerRe: Is it Possible to download a pdf file from a web page without showing the URL of pdf file in address bar [modified] Pin
Covean29-Apr-10 0:18
Covean29-Apr-10 0:18 
AnswerRe: Is it Possible to download a pdf file from a web page without showing the URL of pdf file in address bar Pin
AspDotNetDev29-Apr-10 10:42
protectorAspDotNetDev29-Apr-10 10:42 
GeneralRe: Is it Possible to download a pdf file from a web page without showing the URL of pdf file in address bar Pin
PunkIsNotDead29-Apr-10 17:18
PunkIsNotDead29-Apr-10 17:18 
GeneralRe: Is it Possible to download a pdf file from a web page without showing the URL of pdf file in address bar Pin
AspDotNetDev29-Apr-10 17:25
protectorAspDotNetDev29-Apr-10 17:25 
AnswerRe: Is it Possible to download a pdf file from a web page without showing the URL of pdf file in address bar Pin
PunkIsNotDead29-Apr-10 17:35
PunkIsNotDead29-Apr-10 17:35 

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.