Align text in Rectangle (VB)

Started by tsakali, August 28, 2010, 10:42:11 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

tsakali

HI,
I just wrote an application in VS.Net which creats a shape in visio. I open the visio project and insert an rectangle with text. Now I want to align the text to left an to the top. Thats the code i recorded in vba

Code:


    Dim UndoScopeID1 As Long
    UndoScopeID1 = Application.BeginUndoScope("Linksbündig")
    Application.ActiveWindow.Page.Shapes.ItemFromID(30).CellsSRC(visSectionParagraph, 0, visHorzAlign).FormulaU = "0"
    Application.EndUndoScope UndoScopeID1, True

    Dim UndoScopeID2 As Long
    UndoScopeID2 = Application.BeginUndoScope("Texteigenschaften")
    Application.ActiveWindow.Page.Shapes.ItemFromID(30).CellsSRC(visSectionObject, visRowText, visTxtBlkVerticalAlign).FormulaU = "0"
    Application.EndUndoScope UndoScopeID2, True


I translated it to VB.Net but i Have a problem with 2 variables which I cant find in .Net

Code:

Dim vApp As Visio.Application       
Dim UndoScopeID1 As Long
        UndoScopeID1 = vApp.BeginUndoScope("Linksbündig")
        vApp.ActiveWindow.Page.Shapes.ItemFromID(30).CellsSRC(Visio.VisSectionIndices.visSectionParagraph, 0, visHorzAlign).FormulaU = "0"
        vApp.EndUndoScope(UndoScopeID1, True)

        Dim UndoScopeID2 As Long
        UndoScopeID2 = vApp.BeginUndoScope("Texteigenschaften")
        vApp.ActiveWindow.Page.Shapes.ItemFromID(30).CellsSRC(Visio.VisSectionIndices.visSectionObject, Visio.VisRowIndices.visRowText, visTxtBlkVerticalAlign).FormulaU = "0"
        vApp.EndUndoScope(UndoScopeID2, True)


The following 2 variable:
visHorzAlign
visTxtBlkVerticalAlign



Does anybody has an idea how i have to implment it that it works from .Net?

Regards
Stefan

aledlund

The long answer (to help in the future) is to open the Object Browser in VS and look for visHorzAlign.

visCellIndices.visHorzAlign
visCellIndices.visTxtBlkVerticalAlign

al