Center Text in an EpiShape

Does anyone now how to or is it possible set the alignment (cxnter) of text in an epishape.

I see there is the property .Appearance.TextVAlign and Appearance.TextHAlign, setting them to VAlign.Middle and HAline.Center. It just doesn’t appear to do anything.

Alignment works with epilabel, can’t seem to get it to work in a similar fashion with epishape. I’m assuming it’s a limitation of the component, happy to be told different.

1 Like

When I create a new epishape in a customization, the text is automatically centered.

Are you trying to change it from centered to something else? Or is yours not centered already?

I had my shape as multiline so the string enabled caption was
enabledCaption = “Line 1” + Environment.NewLine + “Line 2”; using this method it just left justifies.

Just Reread that…I meant to say I was trying to make the epishape display the text in a multi line format by splitting up the enabledCaption.

When I try this code in the form load event, my text comes out centered:

Try using Line1 = “A string for line1” and Line2 = “string”

You should see that both lines will be left justified, I want to have it center aligned.


I don’t get it. Please post your customization code.

Hi @NateS sorry that last image was after I added some spaces. I’ve Commented out the line that makes the text look the above image. I hope that’s a bit clearer for you.

		// ** put custom Rule Action logic here
		string changetime = DateTime.Today.AddSeconds(Convert.ToInt32(edvOrderHed.dataView.Table.Rows[0]["ChangeTime"])).ToString("HH:mm");
  	  string strchangedate = DateTime.Parse(edvOrderHed.dataView.Table.Rows[0]["ChangeDate"].ToString()).Date.ToString("dd/MM/yyyy");
		epiShpOrderSubmitted.EnabledCaption = String.Format("{0}" + Environment.NewLine + "{1}" + Environment.NewLine + "{2}","Submitted", strchangedate, changetime);
		//epiShpOrderSubmitted.EnabledCaption = String.Format("  {0}" + Environment.NewLine + "{1}" + Environment.NewLine + "     {2}","Submitted", strchangedate, changetime);

		epiShpOrderSubmitted.Enabled = true;
		epiShpOrderSubmitted.Visible = true;
        epiShpOrderSubmitted.Appearance.TextVAlign = VAlign.Middle;
        epiShpOrderSubmitted.Appearance.TextHAlign = HAlign.Center;
1 Like

I see the problem. I tried a bunch of syntax variations as well and couldn’t get the text to center, only left justify. Curious if you find a solution!

1 Like

The only way I got it to work was adding spaces to pad things out. Clunky but once it’s done it’s done, although doing it dynamically would be simpler in the long run.