在Visual Studio 2005中,如何從文件加載字體並將其用於RDLC報告?如何從RDLC報告中的文件加載字體?
我知道如何從文件中加載字體,這要歸功於this問題,但我無法在RDLC報告中使用它。
在Visual Studio 2005中,如何從文件加載字體並將其用於RDLC報告?如何從RDLC報告中的文件加載字體?
我知道如何從文件中加載字體,這要歸功於this問題,但我無法在RDLC報告中使用它。
看來,唯一的方法是在Windows上安裝字體,並使用它像系統上可用的任何其他字體。
如果你只需要字體的標題或兩個,或條形碼列,那麼你可以對圖像類型的數據集列,premake圖像文本位圖
// From dreaming in code
/// <summary>
/// Function for converting text to a Bitmap object
/// </summary>
/// <param name="width">Width of the image</param>
/// <param name="height">Height of the image</param>
/// <param name="str">String to be converted</param>
/// <param name="textColor">Color we want the text</param>
/// <param name="recColor">Color we want the background</param>
/// <param name="f">Name of the font we want used</param>
/// <returns></returns>
/// <remarks></remarks>
public Bitmap ConvertTextToBitmap(ref int width, ref int height, ref string str, ref Color textColor, ref Brush recColor, ref string fontName)
{
using (Bitmap bmp = new Bitmap(width, height))
{
using (Graphics gfx = Graphics.FromImage((Image)bmp))
{
gfx.SmoothingMode = SmoothingMode.AntiAlias;
Font font = new Font(fontName, 11, FontStyle.Regular, GraphicsUnit.Pixel);
gfx.FillRectangle(Brushes.Transparent, new Rectangle(0, 0, bmp.Width, bmp.Height));
gfx.FillRectangle(recColor, 0, 0, width, height);
gfx.DrawString(str, font, new SolidBrush(textColor), 2, 3);
bmp.Save(Application.StartupPath + "\\" + str + ".bmp", ImageFormat.Bmp);
return bmp;
}
}
}
你也可以使自定義報告項目來取代默認的文本框等,但從所有經驗這些都是一個大的PITA
我可以在報告上動態地做到這一點? – FerranB 2009-03-17 11:09:24