2010-03-23 4 views
1

회전 및 변형과 같은 캔버스에서 내 객체에 대한 일부 변형을 수행했습니다.WPF 변형 동작

나중에 새 좌표를 저장할 수 있습니까? 객체를 움직이려하면 새로운 변형 만 사용합니다.

답변

0

내가 볼 수 있듯이, 이것은 상당히 사소한 것입니다. 일반적으로 WPF가 그런 종류의 일을 처리하도록 할 수 있습니다.

그렇다면 여기에 내가 올 수 있었던 것은 based on information from here입니다. 주어진 텍스트 블록 "textBlockName":

HwndSource hwndSource = PresentationSource.FromVisual(textBlockName) as HwndSource; 

Visual root = hwndSource.RootVisual; 

// Translate the point from the visual to the root. 

GeneralTransform transformToRoot = textBlockName.TransformToVisual(root); 

Point p = new Point(0,0); 

p = transformToRoot.Transform(p); 

p = hwndSource.CompositionTarget.TransformToDevice.Transform(p) ; 

//Display the top left point of the text box, after transforms. 
MessageBox.Show(p.ToString()); 

편집 : 더 자세히 살펴보면 더 나은 해결책을 찾을 수 없습니다. 이것은 내가 생각할 수있는 모든 상황을 처리하는 것 같다.

+0

사실 나는 전혀 변환하지 않고 관리합니다. 나는 비트 맵 자신의 회전 등을 사용한다. – Robbskinizer