■ BufferedGraphics 클래스를 사용하는 방법을 보여준다.
▶ 예제 코드 (C#)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
using System.Drawing; using System.Drawing.Drawing2D; #region 폼 페인트 처리하기 - Form_Paint(sender, e) /// <summary> /// 폼 페인트 처리하기 /// </summary> /// <param name="sender">이벤트 발생자</param> /// <param name="e">이벤트 인자</param> private void Form_Paint(object pSender, PaintEventArgs e) { using(BufferedGraphics bufferedGraphics = BufferedGraphicsManager.Current.Allocate(e.Graphics, ClientRectangle)) { bufferedGraphics.Graphics.Clear(Color.Silver); bufferedGraphics.Graphics.InterpolationMode = InterpolationMode.High; bufferedGraphics.Graphics.SmoothingMode = SmoothingMode.AntiAlias; bufferedGraphics.Graphics.TranslateTransform ( AutoScrollPosition.X, AutoScrollPosition.Y ); Pen pen = new Pen(Color.FromArgb(111, 91, 160), 3); bufferedGraphics.Graphics.DrawLine(pen, 0, 0, 100, 100); pen.Dispose(); bufferedGraphics.Render(e.Graphics); } } #endregion |