2012-09-19 2 views
1

내 C# 응용 프로그램에서 Microsoft Visio를 COM 개체로 사용하고 있습니다. Visio 페이지에서 자동으로 셰이프를 정렬하려고합니다. 이 작업을 위해 무엇을 코딩해야합니까? 셰이프는 데이터베이스 엔터티입니다.C#을 통해 Visio 셰이프를 자동 정렬

userView.Shapes.SomeMethod(); 

userView는 COM 개체의 이름입니다 만 SomeMethod 무엇을해야 하는가?

답변

0

This 도움이 될 수 있습니다

타당한 인용

페이지, 마스터, 또는 그룹의 모양의 부분 집합을 배치하려면 는 모양이 배치되어 할 수있는 선택 객체를 구축 을 선택한 다음 Layout 메서드를 호출합니다. Layout 메서드가 인 Selection 개체에서 수행되고 개체에 선택된 모양이없는 경우 페이지, 마스터 또는 선택 그룹의 모든 모양이 out입니다.

편집 : noonand 그냥 개체 모델에서 또 다른 모습이 있고 당신이 원하는 방법은 LayoutIncremental 방법을

발췌입니다 나타납니다

LayoutIncremental 방법에 대한 2012년 9월 21일 추가 정보 relevant help topic 말씀에서 :

Page.LayoutIncremental(AlignOrSpace, AlignHorizontal, AlignVertical, SpaceHorizontal, SpaceVertical, UnitsNameOrCode) 
+0

이것이 작동하지 않았습니다. –

0

나는 얼마 전에 비슷한 일을 할 필요가 ...

레이아웃 용으로 Microsofts Glee 라이브러리를 사용했습니다. 다운로드에 포함 된 아주 좋은 샘플이 있는데, 노드와 관계를 추가하고 "자동 배열"하는 방법을 보여줍니다. 그러나 Glee는 상업적 용도로 무료가 아닙니다.

  • http://research.microsoft.com/en-us/downloads/f1303e46-965f-401a-87c3-34e1331d32c5/default.aspx
    • 는 기본적으로 무엇을 내가 너무 기쁨을 내 모든 노드와 관계를 추가 한 다음 노드와 그 위치의 목록을 두 번째 링크를 사용하여 Visio를에 추가합니다. '

      나는이가'나이 '질문 알고 Glee image example

    2

    하지만 내가 아주 비슷한 일하고 있어요 및 관리해야 : 여기

    는 기쁨이 무엇을 할 수 있는지의 그래프의 예이다 자동 레이아웃 '은 다음 코드로 된 흐름 차트입니다.

    public enum GraphStyles { TopDown, LeftRight }; 
    public void ArrangeGraph(GraphStyles Style) 
    { 
        if (Style == GraphStyles.TopDown) 
        { 
         // set 'PlaceStyle' 
         var placeStyleCell = VisApp.ActivePage.PageSheet.get_CellsSRC(
          (short)VisSectionIndices.visSectionObject, 
          (short)VisRowIndices.visRowPageLayout, 
          (short)VisCellIndices.visPLOPlaceStyle).ResultIU = 1; 
         // set 'RouteStyle' 
         var routeStyleCell = VisApp.ActivePage.PageSheet.get_CellsSRC(
          (short)VisSectionIndices.visSectionObject, 
          (short)VisRowIndices.visRowPageLayout, 
          (short)VisCellIndices.visPLORouteStyle).ResultIU = 5; 
         // set 'PageShapeSplit' 
         var pageShapeSplitCell = VisApp.ActivePage.PageSheet.get_CellsSRC(
          (short)VisSectionIndices.visSectionObject, 
          (short)VisRowIndices.visRowPageLayout, 
          (short)VisCellIndices.visPLOSplit).ResultIU = 1; 
        } 
        else if (Style == GraphStyles.LeftRight) 
        { 
         // set 'PlaceStyle' 
         var placeStyleCell = VisApp.ActivePage.PageSheet.get_CellsSRC(
          (short)VisSectionIndices.visSectionObject, 
          (short)VisRowIndices.visRowPageLayout, 
          (short)VisCellIndices.visPLOPlaceStyle).ResultIU = 2; 
         // set 'RouteStyle' 
         var routeStyleCell = VisApp.ActivePage.PageSheet.get_CellsSRC(
          (short)VisSectionIndices.visSectionObject, 
          (short)VisRowIndices.visRowPageLayout, 
          (short)VisCellIndices.visPLORouteStyle).ResultIU = 6; 
         // set 'PageShapeSplit' 
         var pageShapeSplitCell = VisApp.ActivePage.PageSheet.get_CellsSRC(
          (short)VisSectionIndices.visSectionObject, 
          (short)VisRowIndices.visRowPageLayout, 
          (short)VisCellIndices.visPLOSplit).ResultIU = 1; 
        } 
        else { throw new NotImplementedException("GraphStyle " + Style.ToString() + " is not supported"); } 
        VisApp.ActivePage.Layout(); 
    } 
    

    이 기능을 사용하면 시간을 절약 할 수 있기를 바랍니다. 알아 내기 위해 잠시 시간이 걸렸습니다.

    visio 2010 및 visual studio 2010을 사용하고 있습니다.

    관련 문제