gdi+中的drawstring函数,在字体为斜体,且右对齐的时候,为什么右边会被切掉。
已经查找了网上的几乎所有资料,都没有解决方法,当然是指用gdi+来解决,如果是通过自己计算的方法来做的话,
会比较麻烦。请高手解答。
已经查找了网上的几乎所有资料,都没有解决方法,当然是指用gdi+来解决,如果是通过自己计算的方法来做的话,
会比较麻烦。请高手解答。
解决方案 »
- 创建字段后直接更新值,会报错,请大家进来帮帮忙。
- 将Panel里所有内容存成图片?告诉我文字图片的制作方法也行啊
- IDtcpconnection组件,writeln()和writebuffer()有什么区别?不是那么简单哦
- delphi7安装第三方控件后,编译时提示找不到system.pas,除了重装还有什么解决方法?
- 如何从不确定列的Excel文件中读出数据写入到文本?-在线100分-
- 怎样在Delphi中使用个性按钮?
- 要多少分,请开口!!(MAX=8410):如何在发送正文为HTML格式的邮件(同时带附件)!!!
- real类型怎样转换成integer类型?怎么转?(急,在线等!)
- 小问题送分来了!!
- 如何卸载控件?
- 创建数据库时提示“没有注册类别”
- socket传输接收数据问题
FontFamily := TGPFontFamily.Create(WideString(trim(MemoText.Font.Name)));
iFontStyle := FontStyleRegular;
if SpeedButtonBold.Down then
begin
iFontStyle := iFontStyle or FontStyleBold;
end;
if SpeedButtonItalic.Down then
begin
iFontStyle := iFontStyle or FontStyleItalic;
end;
if SpeedButtonULine.Down then
begin
iFontStyle := iFontStyle or FontStyleUnderline;
end;
gpFont := TGPFont.Create(MemoText.Font.Name, Size, iFontStyle, UnitPixel);
sb := TGPSolidBrush.Create(MakeColor(255,255,255,255));
strFormat := TGpStringFormat.Create();
if BitBtnLeft.Down then
begin
strFormat.SetFormatFlags(StringFormatFlagsNoClip);
strFormat.SetAlignment(StringAlignmentNear);
end
else if BitBtnCenter.Down then
begin
strFormat.SetFormatFlags(StringFormatFlagsNoClip or StringFormatFlagsNoFitBlackBox);
strFormat.SetAlignment(StringAlignmentCenter);
end
else
begin
strFormat.SetFormatFlags(StringFormatFlagsNoClip or StringFormatFlagsNoFitBlackBox);
strFormat.SetAlignment(StringAlignmentFar);
end;
rc_in.X := 0;
rc_in.Y := 0;
rc_in.Width := 100000;
rc_in.Height := 100000;
g.MeasureString('sfsgsf',-1,gpFont,rc_in,strFormat,rc_out);
iWidth := Round(rc_out.Width+0.5);
iHeight := Round(rc_out.Height+0.5);
//
。以下把文字在矩形中画出来
gpOrginRectF := MakeRect(0.0, 0.0,iWidth,iHeight);
g.DrawString('sfsgsf',-1, gpFont, gpOrginRectF, strFormat,sb);
回答完毕
strFormat.SetFormatFlags(StringFormatFlagsNoClip or StringFormatFlagsNoFitBlackBox or StringFormatFlagsMeasureTrailingSpaces);
可是还是不行啊