
怎么把条形码中的文本字与字之间的间距变大,是调整什么属性?
private void GetViewText(Bitmap p_Bitmap, string p_ViewText)
{
this._textAlignment = StringAlignment.Center;
StringFormat drawFormat = new StringFormat();
drawFormat.Alignment = this._textAlignment;
//drawFormat.LineAlignment = StringAlignment.Center;
// Brush drawBrush = new SolidBrush(this._fontColor);
if (m_ValueFont == null) return;
Graphics _Graphics = Graphics.FromImage(p_Bitmap);
SizeF _DrawSize = _Graphics.MeasureString(p_ViewText, m_ValueFont);
if (_DrawSize.Height > p_Bitmap.Height - 10 || _DrawSize.Width > p_Bitmap.Width)
{
_Graphics.Dispose();
return;
}
int _StarY = p_Bitmap.Height - (int)_DrawSize.Height;
_Graphics.FillRectangle(Brushes.White, new Rectangle(0, _StarY, p_Bitmap.Width, (int)_DrawSize.Height));
_Graphics.DrawString(p_ViewText, m_ValueFont, Brushes.Black, 90, _StarY, drawFormat);
//RectangleF reF = new RectangleF(0, barImage.Height + this.VerticalMargin + this._fontPadding, width, this._emSize);
//_Graphics.DrawString(p_ViewText, m_ValueFont, Brushes.Black, reF, drawFormat);
}
------解决思路----------------------
反正字也不多 要不单个画得了
用bmp的width / Text.Length 得到一个文字 需要的宽度
然后遍历字符串挨个绘制