到目前为止,我遇到了连接到Internet Explorer的最奇怪的问题。我们正在使用d3来显示图表,并且在图表中呈现了一些图标。我们正在使用Office UI构造图标。不幸的是,有些图标没有渲染,有些则没有。例如,显示诸如“加号”,“减号”或“人字形”之类的图标,但没有显示更复杂的图标。为了将图标添加到图表中,我使用以下代码:
void CSetBarcodeDlg::OnDraw() //The Code in my "Draw" button:
{
CString csMessage;
long nSymbology;
double m_PenW=Help::GetValue(m_PenWidth);
if(m_PenW==0){m_PenW=0.8;}
nSymbology = GetSymbology();
m_edtMessage.GetWindowText(csMessage);
switch (nSymbology)
{
case COD128:
DrawCode128Barcode(csMessage,m_dHeight,m_PenW,m_dNarrowBar,::GetWindowDC(this->GetSafeHwnd()),m_nStartingXPixel,m_nStartingYPixel, 0);
break;
case CODE39:
DrawCode39Barcode(csMessage,m_dHeight,m_PenW,m_dNarrowBar,::GetWindowDC(this->GetSafeHwnd()),m_nStartingXPixel,m_nStartingYPixel,m_dRatio);
break;
case CODE93:
DrawCode93Barcode(csMessage,m_dHeight,m_PenW,m_dNarrowBar,::GetWindowDC(this->GetSafeHwnd()),m_nStartingXPixel,m_nStartingYPixel);
break;
case I2OF5:
DrawI2of5Barcode(csMessage,m_dHeight,m_PenW,m_dNarrowBar,::GetWindowDC(this->GetSafeHwnd()),m_nStartingXPixel,m_nStartingYPixel,m_dRatio);
break;
case RATIONALCODABAR:
DrawRationalCodabarBarcode(csMessage,m_dHeight,m_PenW,m_dNarrowBar,::GetWindowDC(this->GetSafeHwnd()),m_nStartingXPixel,m_nStartingYPixel,m_dRatio);
break;
}
return;
}
并且我将指向样式表的链接添加为:
d3selection
.append('text')
.attr('dx', 40)
.attr('dy', 20)
.attr('fill', COLORS.inkLight)
.attr('font-size', 12)
.attr('font-family', 'FabricMDL2Icons')
.style('cursor', 'pointer')
.text('\uE8E3');
该代码可在Chrome,Firefox和Edge中正常运行,但不能在Internet Explorer中运行。最怪异的部分是,当我手动输入开发人员工具F12并取消选中我在页面中任何位置找到的CSS属性时,图标的显示就好像手动CSS更改会触发页面的重新渲染一样。我还在头上添加了 <link
rel='stylesheet'
href='https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/9.6.1/css/fabric.min.css'
/>
,但是没有用。任何帮助都将受到赞赏。