C# - Change Border-Color on different Sides of the Element

Stimulsoft Ultimate discussion
Post Reply
kobayashi
Posts: 3
Joined: Thu Jul 04, 2019 9:19 am

C# - Change Border-Color on different Sides of the Element

Post by kobayashi »

Hi All,

just wondering if there is a possibility to change the Border color of an element on different sides.

Example:
I would like to have a red border-color on the left side , but other sides should be green.

While its should be dynamic ("#FF0000") <= this information will come from a table and will be replaced by TABLE.COLOR , I added an Event "Before Print" , which works fine.
But now im struggeling with the syntax for MyElement.Border .... <== Left side one color, right side another color.

Hope there is some solutions to get the goal

Thanks in advance

Code: Select all

//My code so far..

MyElement.Border =new Stimulsoft.Base.Drawing.StiBorder(Stimulsoft.Base.Drawing.StiBorderSides.All,System.Drawing.ColorTranslator.FromHtml( "#FF0000"),2, Stimulsoft.Base.Drawing.StiPenStyle.Solid);

kobayashi
Posts: 3
Joined: Thu Jul 04, 2019 9:19 am

Re: C# - Change Border-Color on different Sides of the Element

Post by kobayashi »

Self-Reply :)

Code: Select all

new Stimulsoft.Base.Drawing.StiAdvancedBorder(
	 System.Drawing.ColorTranslator.FromHtml( System.Drawing.ColorTranslator.FromHtml( DATA.Color1) ), //Top
	(double) BorderWidth,
	Stimulsoft.Base.Drawing.StiPenStyle.Solid,

	 System.Drawing.ColorTranslator.FromHtml( System.Drawing.ColorTranslator.FromHtml( DATA.Color2) ), //Bottom
	(double) BorderWidth,
	 Stimulsoft.Base.Drawing.StiPenStyle.Solid,

	 System.Drawing.ColorTranslator.FromHtml( System.Drawing.ColorTranslator.FromHtml( DATA.Color3) ), //Left
	(double) BorderWidth,
	 Stimulsoft.Base.Drawing.StiPenStyle.Solid,

	 System.Drawing.ColorTranslator.FromHtml( System.Drawing.ColorTranslator.FromHtml( DATA.Color4) ), //Right
	(double) BorderWidth,
	Stimulsoft.Base.Drawing.StiPenStyle.Solid,

	false, 
	0 , 
	null
)
Lech Kulikowski
Posts: 6238
Joined: Tue Mar 20, 2018 5:34 am

Re: C# - Change Border-Color on different Sides of the Element

Post by Lech Kulikowski »

Hello,

Thank you for the information.
Post Reply