Hello,
We save values for link pen and solidbrush color preferences for users. On the C# side, we can set these values for existing links when drawing the diagram using the following lines of code:
link.Pen = new MindFusion.Drawing.Pen(userPenColorPref);
link.Brush = new SolidBrush(userSolidBrushPref);
Our values are saved as ARGB and are 8 character hexadecimals. They are passed into the two MindFusion functions above as ARGB Color instance and this works just fine. The correct colors are used to draw various routes on the diagram.
What I need is a way to set these values in the JavaScript side. This was not an issue in our Silverlight MindFusion map, but is now an issue in our MVC version because we need to handle a lot of functionality client-side.
I need to be able to draw a new link with the user's preferred pen and solidbrush color on the client side. The only examples of setting the pen and solidbrush in JavaScript that I see use a 6 character hexadecimal value, such as #000000, or a string color name like "blue". I need to instead draw the link using the color values the user has set in the database, which is of type Color ARGB. Like I said, this works fine server-side, just not client-side.
I tried creating the Pen and SolidBrush object server-side since I know this gets the correct color values, but using these objects to set the corresponding pen and solidbrush values in JavaScript does not get the correct color. (Using JavaScript methods setPen() and setBrush()).
Example:
//server side create the pen using user's preferred color
MindFusion.Drawing.Pen userPen = new MindFusion.Drawing.Pen(userPenColorPref);
//JavaScript clientside
//this does not result in the correct color
link.setPen('@userPen');
How can we accomplish this?
Thanks.