Skip to content

Instantly share code, notes, and snippets.

@ochilab
Last active December 18, 2015 18:59
Show Gist options
  • Save ochilab/5829218 to your computer and use it in GitHub Desktop.
Save ochilab/5829218 to your computer and use it in GitHub Desktop.
multi-tiff イメージファイルから指定したページを表示する(C++/CLI)
private:void ShowSelectedImage( int page )
{
Graphics ^g1 = pictureBox1->CreateGraphics() ;
FileStream^ fs ;
fs = gcnew FileStream( tifName , FileMode::Open , FileAccess::Read ) ;
Image^ im = Image::FromStream( fs ) ;
FrameDimension ^fd = gcnew FrameDimension( im->FrameDimensionsList[0] ) ;
//Bitmap^ map ;
int fd_count = im->GetFrameCount( fd ) ;//ページ数
if( 1 <= page && page <= fd_count )//存在するページ数なら絵とページ数を変更
{
page = page - 1 ;
im->SelectActiveFrame( fd , page ) ;
//map_flag = 1 ;
//map = gcnew Bitmap( im ) ;
//g1->DrawImage( im , 0 , 0 , pictureBox1->Width - 1 , pictureBox1->Height - 1 ) ;
Bitmap^ map1 = gcnew Bitmap( im , pictureBox1->Width , pictureBox1->Height ) ;
pictureBox1->Image = map1 ;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment