2011-07-31 2 views
0

PictureBox 컨트롤이 있고 거기에 바코드 이미지가 있습니다.이 이미지를 같은 용지에 여러 번 추가 할 수 있기를 원합니다.PictureBox 다중 열 시간에 이미지 인쇄

이제 저는 매번 한 장의 이미지 만 인쇄 할 수 있습니다. 아마 5 개 또는 10 개의 이미지를 추가하여 함께 넣고 동시에 인쇄하고 싶습니다.

어떻게 할 수 있습니까 ??

+0

PrintDocument.PrintPage 이벤트 처리기에서 원하는만큼 e.Graphics.DrawImage()를 자주 호출하십시오. –

답변

0

이미지 크기가 10 인 비트 맵을 만들고 바코드를 그려서 PictureBox에 넣습니다.

1

모든 이미지를 하나의 이미지에 결합한 다음 해당 이미지를 인쇄 할 수 있습니다. so :

int repeatTimes= 10; 

Image imageSource = Image.FromFile(@"your image file path");//or your resource.. 

Bitmap myCombinationImage = new Bitmap(new Size(imageSource.Width, imageSource.Heigh * repeatTimes); 

using (Graphics graphics = Graphics.FromImage(myCombinationImage)) 
{ 
    Point newLocation = new Point(0, 0); 
    for (int imageIndex; imageIndex < repeatTimes; imageIndex++) 
    { 
     graphics.DrawImage(imageSource, newLocation); 
     newLocation = new Point(newLocation.X, newLocation.Y + imageSource.Height); 
    } 
} 

pictureBox.Image = myCombinationImage; 
+0

@SzamDev이 질문에 답변을 드렸습니까? –