[WPF] InkCanvas 사용하기
아래의 URL에 있는 질문에 대한 답변입니다.
http://www.hoons.kr/Board.aspx?Name=QAnet3&Mode=2&BoardIdx=24513&Key=&Value=
WPF는 InkCanvas를 통하여 펜을 그린다고 되있더군요.
그런데 InkCanvas에서 그 DrawLine에 관해서 굵기를 조정하고 싶을 경우는 어떤 방법으로 써야될지 궁금해서
이렇게 적어봅니다
--------------------------------------------------------------------------------------------------------------------------------------
<Window x:Class="Ink.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <Grid> <InkCanvas x:Name="inkCanvas" > </InkCanvas> </Grid> </Window>
위와 같이 InkCanvas의 이름을 inkCanvas 라고 붙여주고
해당 cs 파일에서
DrawingAttributes inkAttributes = new DrawingAttributes();
inkAttributes.Height = 10;
inkAttributes.Width = 1;
inkAttributes.Color = Colors.Red;
inkCanvas.DefaultDrawingAttributes = inkAttributes;
위와 같이 DefaultDrawingAttributes에 값을 넣어주면 됩니다.
참고로 FitToCurve 속성을 True로 해주면 Bezier Curve로 이쁘게 그려줍니다.
그리고 IgnorePressure, IsHighlighter StylusTip 등등의 프로퍼티도 존재합니다.
"프로그래밍 / TIP& Study" 분류의 다른 글
| [퀴즈] SQLite collate 문제 (0) | 2010/07/16 |
| [TIP] XP, Vista에서 CD/DVD롬이 보이지 않을 경우 (0) | 2009/08/05 |
| [C#] WinForm 에서 Docking 순서 변경하기 (0) | 2009/07/29 |
| [C#] Control Library 만들 때 TIP (0) | 2009/06/26 |
| [C#] 자연스럽게 Pen으로 그리기 (0) | 2009/06/23 |
| [WPF] Canvas의 Width, Height Binding (0) | 2009/06/23 |
| [C#] DateTime으로 7일 후는 어떻게? (0) | 2009/06/23 |
| [C#] string의 byte 길이 구하기 (0) | 2009/06/22 |
프로그래밍/TIP& Study
2009/06/29 21:04

댓글을 달아 주세요