bonjour,
le code suivant permet de créer un rectangle avec du texte.
le texte change de couleur
mai le fond du rectangle non...
/******************************************************************************
* Textback Class
******************************************************************************/
Textback.prototype = new DynamicComponent();
Textback.parent = DynamicComponent.prototype;
Textback.prototype.constructor = Textback;
/******************************************************************************
* Constructor
******************************************************************************/
function Textback()
{
}
/******************************************************************************
* Initialize object
******************************************************************************/
Textback.prototype.init = function(svgId, objectName)
{
Textback.parent.init.call(this, svgId, objectName, false);
this.m_SizeFont = GetVisioPropAsInt(this.m_SvgNode, "FontSize");
this.m_txtParentElem = getChildNodeFromName(this.m_SvgNode, "text");
this.m_rectElem = getChildNodeFromName(this.m_SvgNode, "rect");
removeAllChild(this.m_txtParentElem);
this.m_txtElem = createTextNode(this.m_txtParentElem, "");
}
/******************************************************************************
* Callback for refresh event
******************************************************************************/
Textback.prototype.OnRefresh = function()
{
var value = this.m_arrayValueDefinition[0].getValue();
var coltext = colortext;
var red = Math.round((coltext & 0x000000FF) >> 0);
var green = Math.round((coltext & 0x0000FF00) >> 8);
var blue = Math.round((coltext & 0x00FF0000) >> 16);
var fill = "fill:rgb("+ red +","+ green+","+blue+")";
var size = "font-size:"+this.m_SizeFont;
var fontType = "font-family:Arial Unicode MS"
this.m_txtParentElem.setAttribute("style", fill+";"+size+";"+fontType);
var colback = colorback;
red = Math.round((colback & 0x000000FF) >> 0);
green = Math.round((colback & 0x0000FF00) >> 8);
blue = Math.round((colback & 0x00FF0000) >> 16);
var back = "rgb("+ red +","+ green+","+blue+")";
this.m_rectElem.style.backgroundColor = back;
var st = value;
this.m_txtElem.nodeValue = st;
}
est ce que quelqu'un a une idée pour ce probléme??
merci d'avance.