Sunteți pe pagina 1din 1

01/02/2017

windows­HowtoRotateShapesinC#­StackOverflow

xDismiss

JointheStackOverflowCommunity

StackOverflowisacommunityof6.6million

programmers,justlikeyou,helpingeachother.

Jointhem;itonlytakesaminute:

Signup
Signup

IhaveashapeinmyC#codelikeanellipse.NowIwanttoprogrammaticallyrotateit.Forexample,nowIhaveaverticalellipseandinthe

runningIwanttochangeittoahorizontalone.HowIsitpossible?

c#

c# windows editedJul3'14at21:57 michaelc35 307 2 11 askedJul3'14at20:42 AliNGame 160 9 3

307

2

11

askedJul3'14at20:42

michaelc35 307 2 11 askedJul3'14at20:42 AliNGame 160 9 3 WPF,Winforms?Whattechareyouusing?–

160

9

3 WPF,Winforms?Whattechareyouusing?–BradleyDotNETJul3'14at20:44

HowareyourepresentingthatEllipseinyourcode?–BenjaminScheibeJul3'14at20:45

1 Withoutsomeinformationabouthowyourellipseisrepresentedand/orhowyou'redrawingit,it'simpossible

tosay.Typicallyyouuseatransformationmatrixtotransformtheshapeoritsindividualpoints.Butagain,

theformthatmatrixtakesdependsonyourshape'srepresentation.Withoutmoreinformationfromyou,we

can'tansweryourquestion. JimMischelJul3'14at21:16

Thankguys.mycodeisC#forwindowsphone8.inwindowsphoneprogrammingIaddusing

Microsoft.Expression.Shapes;thenIusethiscodetoadditinaGrid: AliNGame Jul4'14at4:29

Ellipsebtn=newEllipse();btn.width=100;btn.height=100;grid.children.add(btn); AliNGame Jul4'14

at4:30

1Answer

ProblemSolved:

CompositeTransform co = new CompositeTransform(); co.Rotation = ‐90; btn.RenderTransform = co;

answeredJul4'14at6:54

; btn . RenderTransform = co ; answeredJul4'14at6:54 AliNGame 160 9

160

9