카테고리 없음

[silverlight-4.0] Silverlight 4 베타 인쇄 미리보기를 사용하는 방법은 무엇입니까?

행복을전해요 2021. 1. 7. 02:34

I have not seen print preview as any of them but actual Printing support in which you can control which controls are printed and events based on the printing process.

-------------------

After looking for a while I found a way to do this by combining some features I found in other projects, but they used it for image manipulation. I tried with printing and it seems to work fine.

Here how it works: Get the base container for the print contents converted to a bitmap by using WriteableBitmap, here I´ll use a Canvas:

WriteableBitmap wb = new WriteableBitmap(this.canvas1, null);

이 비트 맵을 Image 컨트롤의 소스로 사용하십시오 (ScrollViewer 내부에있을 수 있습니다. 더 나은 점).

this.imagePreview.Height = wb.PixelHeight;
this.imagePreview.Width = wb.PixelWidth;
this.imagePreview.Source = wb;

스케일링 기본 단위 설정 (이 경우 1 % 사용) :

Point scale = new Point();      

scale.X = imagePreview.Width/100d;
scale.Y = imagePreview.Height/100d;

그런 다음 슬라이더를 사용하여 비율 조정 (선택 사항)

private void vSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
        
                        imagePreview.Height = scale.Y * vSlider.Value;
                                        imagePreview.Width = scale.X * vSlider.Value;           
                                                }
                                                
-------------------

나는 응답의 부족과 Hurricanepkt가 그의 답장에서 지적했듯이 Tim Heuer와 다른 사람들이 화면에 동일한 것을 표시하면 자신의 맞춤형 인쇄 미리보기 기능으로 쉽게 만들 수있는 가상 인쇄에 대해 이야기한다는 사실에서 생각합니다. 일부 목록에 나열된 인쇄 미리보기는 실제로 사람들이 가상 인쇄 문서가 실제로 무엇인지 잘못 해석하고 있습니다.



출처
https://stackoverflow.com/questions/2005864