프로젝트

일반

사용자정보

개정판 86bff326

ID86bff326fb25f02d809b59ae6219c9eeb230e0c9
상위 285635d3
하위 1e901a8d

김태성이(가) 약 5년 전에 추가함

- pdf export 수정

Change-Id: I44d70e1a8adce8d9b1dcaa92958594d1780fa02f

차이점 보기:

KCOM/Events/Export.cs
127 127
        #endregion
128 128

  
129 129
        //코멘트가 있는 페이지
130
        public System.Drawing.Image Exporting(Canvas canvas, System.Drawing.Image img)
130
        public System.Drawing.Image Exporting(Visual visual,double pageWidth,double pageHeight)
131
        {
132
            BitmapEncoder encoder = new PngBitmapEncoder();
133
            RenderTargetBitmap renderBitmap = new RenderTargetBitmap((int)pageWidth, (int)pageHeight, 96d, 96d, PixelFormats.Default);
134

  
135
            DrawingVisual drawingVisual = new DrawingVisual();
136
            using (DrawingContext drawingContext = drawingVisual.RenderOpen())
137
            {
138
                VisualBrush visualBrush = new VisualBrush(visual);
139
                drawingContext.DrawRectangle(visualBrush, null, new System.Windows.Rect(new System.Windows.Point(0,0), new System.Windows.Point(pageWidth, pageHeight)));
140
            }
141

  
142
            renderBitmap.Render(drawingVisual);
143
            MemoryStream mystream = new MemoryStream();
144
            encoder.Frames.Add(BitmapFrame.Create(renderBitmap));
145
            encoder.Save(mystream);
146

  
147
            System.Drawing.Image myImage;
148
            myImage = System.Drawing.Image.FromStream(mystream);
149

  
150
            //using (Graphics gr = Graphics.FromImage(Resultimg))
151
            //{
152
            //    //Graphics 객체에 Image 를 그릴때 Rectangle x,y 값을 추가 입력  
153
            //    gr.DrawImage(myImage, new Rectangle(0,0,img.Width,img.Height));
154
            //}
155

  
156
            //image = RasterImageConverter.ConvertFromImage(Resultimg, ConvertFromImageOptions.None);
157

  
158
            return myImage;
159
        }
160

  
161
        public System.Drawing.Image Exporting_old(Canvas canvas, System.Drawing.Image img)
131 162
        {
132 163
            System.Drawing.Image Resultimg = new System.Drawing.Bitmap(img, img.Width, img.Height);
133 164

  
......
147 178
            using (Graphics gr = Graphics.FromImage(Resultimg))
148 179
            {
149 180
                //Graphics 객체에 Image 를 그릴때 Rectangle x,y 값을 추가 입력  
150
                gr.DrawImage(myImage, new Rectangle(0,0,img.Width,img.Height));
181
                gr.DrawImage(myImage, new Rectangle(0, 0, img.Width, img.Height));
151 182
            }
152 183

  
153 184
            //image = RasterImageConverter.ConvertFromImage(Resultimg, ConvertFromImageOptions.None);

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)