[vtkusers] Why is the text of vtkCaptionWidget displayed at the default position no matter what position value I set?

Liu_tj tjlp at netease.com
Tue Oct 25 10:02:09 EDT 2016


Hi, David,

I follow your tips. It doesn't work. The text is still displayed at the default position.

Thanks
Liu Peng





在2016-10-24,"David Lonie" <david.lonie at kitware.com> 写道:
收件人:"Liu_tj" <tjlp at netease.com>
抄送:"vtkusers" <vtkusers at vtk.org>
主题:Re: [vtkusers] Why is the text of vtkCaptionWidget displayed at the default position no matter what position value I set?


On Sun, Oct 23, 2016 at 11:13 AM, Liu_tj <tjlp at netease.com> wrote:

Hi, VTK guys,

When I display a vtkCaptionWidget, I want to set the position of the text. So I call the vtkActor2D:;SetPostion() and SetPosition2(), but when the widget is displayed, the text is alway at the left bottom corner, why? Below is my C# code:
[snip]
rep.GetCaptionActor2D().GetTextActor().SetPosition(textPos1[0], textPos1[1]);
rep.GetCaptionActor2D().GetTextActor().SetPosition2(textPos2[0], textPos2[1]);



Try just setting the position of the caption actor itself. When the caption actor renders, it sets the text actor's position. So,


rep.GetCaptionActor2D().SetPosition(textPos1[0], textPos1[1]);
rep.GetCaptionActor2D().SetPosition2(textPos2[0], textPos2[1]);


should get you what you want.


HTH,
Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20161025/869c0e59/attachment.html>


More information about the vtkusers mailing list