This is a migrated thread and some comments may be shown as answers.

Center Align Shape

6 Answers 723 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Phil
Top achievements
Rank 1
Phil asked on 25 Jan 2017, 07:38 PM

I have a column in a report that hold a small circle.  I determine the fill color of the circle dynamically with database fields.  The width of this column is static and I can center the circle horizontally.  The height of the rows, however, is dynamic and I cannot get the circle to center on each row.  The circle always seems to be at the top of the row instead of directly in center.  Is there something I am missing to center this vertically?  The vertical align property doesn't seem to work for me.

Other Info:  1.  On this report, I am not using a table.  I am using text boxes and report groups.  Maybe the shape needs to be in a panel?

                   2.  The shape is being used as a subreport on the main report.  Do I need to center the sub report on the main report?

Your help is appreciated.

Thanks,

Phil

6 Answers, 1 is accepted

Sort by
0
Katia
Telerik team
answered on 26 Jan 2017, 03:27 PM
Hi Phil,

property will affect only the text inside the report item. However, it will not position the item itself.

You can place the Shape item inside the Panel item and set Style.Padding.Top property for this panel. The value of this property can also be changed dynamically using bindings and expressions.


Regards,
Katia
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Phil
Top achievements
Rank 1
answered on 07 Mar 2017, 06:28 PM

I think I have gotten a little further in diagnosing the cause.  At first, I thought it was the shape causing the issues.  Now, I am almost certain that it is subreports.  I cannot seem to dynamically center anything in a subreport vertically.  See the attached image to give a better idea of what I am trying to accomplish.

The two items with red arrows pointing down are sub reports which will not center vertically.  The rest, which are centered vertically, at text boxes which is much easier to do.

0
Katia
Telerik team
answered on 09 Mar 2017, 04:17 PM
Hello Phil,

The exact setting of the report are not clear. Applying VerticalAlign=True to the TextBox aligns the text correctly on our side. Double check if this property is set to true for all the TextBoxes containing text.

To align a Shape item you can apply padding to the Panel item containing this shape and change it dynamically with bindings and expressions.

Another approach is to set an image that displays a circle as BackgroundImage in TextBox or Panel Style properties.


Regards,
Katia
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Phil
Top achievements
Rank 1
answered on 11 Jul 2017, 04:22 PM
What I really want is to have top and bottom anchoring set so that the center of the circle is always in the center of the row.  But this causes the circle to grow in size.  I want the circle to stay the same size.  I have tried setting the size in the code behind with a new sizeu, but this is ignored and the anchoring takes precedence.
0
Phil
Top achievements
Rank 1
answered on 11 Jul 2017, 04:51 PM

Another thing that I have seen, the Location property is being ignored.  In the code behind I have set:

var left = parent.Width.Multiply(.5D).Subtract(Unit.Pixel(6));
var top = parent.Height.Multiply(.5D).Subtract(Unit.Pixel(6));
GoalCircle.Location = new PointU(left, top);

Since my circle is 12 pixels, i will take half of the width and half of the height minus 6 pixels to get the center.  This property seems to be ignored in my ItemDataBinding Event.

0
Accepted
Katia
Telerik team
answered on 12 Jul 2017, 12:24 PM
Hello Phil,

As of R3 2016, the changes applied to item definition in events are ignored - Changes on items in report events are not applied.
Instead of accessing the item definition (GoalCircle.Location) you need to get the processing item, for example:
private void textBox1_ItemDataBinding(object sender, EventArgs e)
{
    Telerik.Reporting.Processing.TextBox txt = (Telerik.Reporting.Processing.TextBox)sender;
    ...
}

To get the processing child item you can use ElementTreeHelper.GetChildByName Method.

Instead of using events, you can also apply bindings and expressions to change the properties of the item dynamically.


Regards,
Katia
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Phil
Top achievements
Rank 1
Answers by
Katia
Telerik team
Phil
Top achievements
Rank 1
Share this question
or