redraw shape after shapedata change

  • Thread starter Jüergen Schürhoff
  • Start date
J

Jüergen Schürhoff

Hello,
I have created a connector shape. The line Ends can be changed by shape
-data. These changes are only shown, when the shape is redrawed.

How can I force the redraw of the shape by VBA-Code or shapesheet
functions?
 
B

Barb Way

I don't seem to have a problem doing this.
I created a connector shape and inserted a formula in the Line Format /
BeginArrow cell, similar to '=Prop.Row_1', where the property is a string
type. When I update the value of the shape data, I am seeing the type of
the arrow change accordingly.
How are you updating the shapes and their Shape Data?

One thing you could try is to toggle Application.ShowChanges off and then
back on. In fact, check to be sure you are not leaving ShowChanges off in
any code you are running, since that might lead to exactly what you
describing, per the help file:
******
When ShowChanges is False, the Visio instance will not refresh the screen
(repaint drawing windows) as documents change or when they become obscured
by other windows. All shapes in drawing and stencil windows are deselected
and the Visio instance will not allow programs to change the selections of
windows.
******


Barb Way
Product Support - Visio
Microsoft Corporation
[This posting is provided "As Is" with no warranties, and confers no
rights.]
--------------------

Hello,
I have created a connector shape. The line Ends can be changed by shape
-data. These changes are only shown, when the shape is redrawed.

How can I force the redraw of the shape by VBA-Code or shapesheet
functions?
 
J

Jüergen Schürhoff

Thank You for the answer.

with the predefined Line ends it works for me as well,
but with userdefined Line ends the line ends are not updated.
My Application.showChanges is set to true.

I fond a way to update my connectors with a
sendKeys "%^g"

As shown in the following eventhandler:


Private Sub vsoApplication_CellChanged(ByVal vsoCell As IVCell)
Dim mastershape As Visio.Master
Dim shape As Visio.shape
Dim t
Dim vsoApplication
Set mastershape = vsoCell.shape.Master

'Get the instance of Visio associated with the Document object.
Set vsoApplication = vsoCell.Application
Debug.Print "The Application.show value is: " &
VsoApplication.ShowChanges

If Masershape <> "Nothing" Then
t = InStr(vsoCell.shape.Name, "leitung")
'check if the shape is a pipe (Leitung in german)
If t <> 0 Then
t = InStr(vsoCell.Name, "Prop.Connectiontype")
Debug.Print "The Cahnged Cell is named: " & vsoCell.Name
'check if the Property of the Line end has changed
If t <> 0 Then
' send Crtl + Alt + g to redraw the whole Application
SendKeys "^%g"

End If
End If
End If
End Sub



This has the disatvantage that all Shapes are redrawn, which takes a lot
of time if the drawings are having some hundrets of shapes (P&I Diagramms).

So how can I redraw just one shape?
 
B

Barb Way

I couldn't find a way to render only one shape - just the window/page
level. If your code is going to be doing several changes in response to
some event, you may want to toggle ShowChanges off before starting a batch,
and then toggling it back on afterwards, to help with perf.

Barb Way
Product Support - Visio
Microsoft Corporation
[This posting is provided "As Is" with no warranties, and confers no
rights.]
--------------------

Thank You for the answer.

with the predefined Line ends it works for me as well,
but with userdefined Line ends the line ends are not updated.
My Application.showChanges is set to true.

I fond a way to update my connectors with a
sendKeys "%^g"

As shown in the following eventhandler:


Private Sub vsoApplication_CellChanged(ByVal vsoCell As IVCell)
Dim mastershape As Visio.Master
Dim shape As Visio.shape
Dim t
Dim vsoApplication
Set mastershape = vsoCell.shape.Master

'Get the instance of Visio associated with the Document object.
Set vsoApplication = vsoCell.Application
Debug.Print "The Application.show value is: " &
VsoApplication.ShowChanges

If Masershape <> "Nothing" Then
t = InStr(vsoCell.shape.Name, "leitung")
'check if the shape is a pipe (Leitung in german)
If t <> 0 Then
t = InStr(vsoCell.Name, "Prop.Connectiontype")
Debug.Print "The Cahnged Cell is named: " & vsoCell.Name
'check if the Property of the Line end has changed
If t <> 0 Then
' send Crtl + Alt + g to redraw the whole Application
SendKeys "^%g"

End If
End If
End If
End Sub



This has the disatvantage that all Shapes are redrawn, which takes a lot
of time if the drawings are having some hundrets of shapes (P&I Diagramms).

So how can I redraw just one shape?


Barb said:
I don't seem to have a problem doing this.
I created a connector shape and inserted a formula in the Line Format /
BeginArrow cell, similar to '=Prop.Row_1', where the property is a string
type. When I update the value of the shape data, I am seeing the type of
the arrow change accordingly.
How are you updating the shapes and their Shape Data?

One thing you could try is to toggle Application.ShowChanges off and then
back on. In fact, check to be sure you are not leaving ShowChanges off in
any code you are running, since that might lead to exactly what you
describing, per the help file:
******
When ShowChanges is False, the Visio instance will not refresh the screen
(repaint drawing windows) as documents change or when they become obscured
by other windows. All shapes in drawing and stencil windows are deselected
and the Visio instance will not allow programs to change the selections of
windows.
******


Barb Way
Product Support - Visio
Microsoft Corporation
[This posting is provided "As Is" with no warranties, and confers no
rights.]
--------------------

Hello,
I have created a connector shape. The line Ends can be changed by shape
-data. These changes are only shown, when the shape is redrawed.

How can I force the redraw of the shape by VBA-Code or shapesheet
functions?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top