DSL Tools: Centralize an Shape in the diagram

Asked

Viewed 44 times

1

I’m developing a DSL. In the main window, I have two panels (Panel): in a, a list (listbox) of shapes of the diagram, and in the other, the diagram itself. I would like, by clicking on an item in the list, to center the Shape corresponding on the screen (diagram panel).

I don’t want to move the Shape to the center of the diagram changing its coordinates x,y. I want to scroll the diagram to center the Shape

Another way to explain: when a validation error occurs (Errors window at the bottom), and when clicking on the error, it centralizes the Shape invalid on screen, right? That’s what I want.

Starting point:

private void symbolsListBox_SelectedIndexChanged(object sender, EventArgs e)
{
    var listBox = sender as ListBox;
    var symbol = listBox.SelectedItem as Symbol;
    var compartment = PresentationViewsSubject.GetPresentation(symbol)
        .FirstOrDefault() as SymbolCompartmentShape;
    var diagram = docView.CurrentDiagram;

    //Next step, center the shape
    //How? God please help me!!!
}

The image example is always better!! then...

AQUI, UMA IMAGEM DE EXEMPLO DO QUE EU QUERO AQUI, UM EXEMPLO DE IMAGEM DO RESULTADO ESPERADO

Tip from friend Francisco in the comments: Translation of image texts
Image 1: "I want to click here... then center this"
Image 2: "Item clicked; centered Shape. Note that scroll who moved, not Shape"

  • This is a site in Portuguese and not everyone here knows English, if the text of the image is relevant to the question, please leave the translation.

  • Thanks for the comment, it is because I asked the question first on the site in English and I took advantage of the image. But I think I can understand. Who program in VS and has knowledge to answer will know what is written. But worth the tip, had not thought of it. :)

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.