can i change block/rectangle color?

  • Last Post 14 July 2014
vbknight posted this 24 February 2014

using FR Engine SDK 11 can i change the color of rectangle/block?

  • Liked by
  • beta-tank
Order By: Standard | Newest | Votes
SDK_support posted this 27 February 2014

Please set appropriate IBlock::UserProperty for such purpose, the property name VisualComponents.BlockColor. Possible code example:

FREngine.IBlock block = Document.Pages[0].Layout.VisualBlocks[0]; block.set_UserProperty("VisualComponents.BlockColor", 0x0000FFFF); imageViewer.Invalidate(true);

As the result first block in Layout will be yellow. The last line: imageViewer.Invalidate is needed to repaint the window.

  • Liked by
  • vbknight
  • beta-tank
vbknight posted this 28 February 2014

thank you for this, but how can i change the block color when adding block using below code?

page.Layout.Blocks.AddNew(FREngine.BlockTypeEnum.BT_Text, region);

SDK_support posted this 28 February 2014

IBloсks::AddNew method requires to specify the position of the newly created block in the blocks collection to be specified in this method call in FRE 11. So you need to add a block and then get this particular block through the ILayout::VisualBlocks collection and then change the block color via UserProperty.

vbknight posted this 04 March 2014

Thanks for your help. very much appreciated.

beta-tank posted this 09 July 2014

@SDK_support ♦♦ What format has bg color? I know that first two letters are alpha chanel, but I can't set color in standart HEX format. For example 77FF2600 must be red (FF2600 without alpha chanel), but in imageViewer i see something like blue.

UPD. I find solution. Only deeded invert number, for ex.: 77 alpha chanel and FF2600 color to 770062FF.

SDK_support posted this 14 July 2014

Color is specified like int value which is calculated from the RGB triplet using the formula: (red value) + (256 x green value) + (65536 x blue value), where red value is the first triplet component, green value is the second triplet component, blue value is the third triplet component. For example, the int value of the color white equals 16777215.