Book a Demo

Author Topic: How to change color of stereotype label in C#?  (Read 2955 times)

fico_addins

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
How to change color of stereotype label in C#?
« on: March 18, 2019, 08:38:02 pm »
Hi guys,

I want to change the color of the stereotype label of a connector in C#. This is, the <<trace>> or whatever text is set in the stereotype.



I saw in a SQL query that the fields regarding this are "Btm_Mid_Label" and "Stereotype".

Is there a way of doing this? I'm dynamically creating elements, and I already change the line color, but this tag appears always in black.

Thanks!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to change color of stereotype label in C#?
« Reply #1 on: March 18, 2019, 09:30:46 pm »
The good news is that this is possible.
If I right click on the label I can change it's color, independent from the actual connector

when I check in the database I see that the field Geometry has been changed
SX=50;SY=20;EX=56;EY=20;EDGE=2;$LLB=;LLT=;LMT=;LMB=CX=30:CY=13:OX=0:OY=0:HDN=0:BLD=0:ITA=0:UND=0:CLR=15624315:ALN=1:DIR=0:ROT=0;LRT=;LRB=;IRHS=;ILHS=;

I suspect you can edit this field through the EA.DiagramLink.Geometry field using the API

Geert

fico_addins

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: How to change color of stereotype label in C#?
« Reply #2 on: March 20, 2019, 08:25:58 pm »
Thank you so much Geert!

It drove me a little crazy because after dynamically creating the desired elements and connectors and dragging them into a diagram, the corresponding diagram links were not showing up in the DB.

I solved it by doing:
Code: [Select]
Repository.SaveDiagram(currDiag.DiagramID);
Repository.RefreshModelView(package.PackageID);

(I think SaveDiagram is not necessary, but just in case...)

Cheers!