2016-10-04 9 views
0

셰이프 배열에 Visio 셰이프를 추가했습니다. 크기별로 Visio 셰이프를 나열하려고합니다. 주문을 오름차순/내림차순으로 어떻게 주문합니까?모양 배열의 Visio 셰이프 크기 목록

Shape[] VisioShape = new Shape[0]; 
int Count = 0 
foreach (Shape shape in VisioPage.Shapes) 
{ 
if (shape.OneD != 0) 
{ 
    VisioShape[Count] = shape; 
    Count++; 
} 
} 

답변

0

일부 LINQ는 어떻습니까?

void Main() 
{ 
    var vApp = MyExtensions.GetRunningVisio(); 

    Visio.Page vPag = vApp.ActivePage; 
    var q = from s in vPag.Shapes.Cast<Visio.Shape>() 
      where s.OneD == 0 
      orderby s.CellsU["Height"].ResultIU 
      select s.Text; 
    q.Dump(); 
} 

어떤 모양과 같이 주어

enter image description here

:

Visio shapes

Linqpad이 반환 다음은 (http://visualsignals.typepad.co.uk/vislog/2015/12/getting-started-with-c-in-linqpad-with-visio.html이 게시물 당) 내가 LinqPad에 쓴 빠른 조각입니다

다른 방향으로 주문하려면을 추가하십시오.은 orderby 줄 끝에 있습니다.

orderby s.CellsU["Height"].ResultIU descending