Comments (6)
Yes, we can use 'StringTrimming.EllipsisCharacter' to control the layout of texts. Seemsdn
Here's some pseudo codes:
var fmtItemName = new StringFormat(){Trimming=StringTrimming.EllipsisCharacter};
var fmtItemType = new StringFormat(){Alignment = StringAlignment.Far};
//measure itemType's text width
var layoutSize = g.MeasureString(itemType, font, MAX_WIDTH, fmtItemType);
//draw texts
g.DrawString(itemName, font, brush, new RectangleF(LEFT, y, MAX_WIDTH-laytouSize.Width, lineHeight), fmtItemName);
g.DrawString(itemType, font, brush, RIGHT, y, fmtItemType);
y+=lineHeight;
from wzcomparerr2.
Simply change the x position of every draw call.
like this:
{
int value;
string numValue;
//Defense tooltip icon
x += 62;
g.DrawImage(Resource.UIToolTip_img_Item_Equip_Summary_icon_pdd, x, y);
DrawReqNum(g, "0", NumberType.LookAhead, x - 5, y + 6, StringAlignment.Far);
//Boss DMG tooltip icon
x += 62;
g.DrawImage(Resource.UIToolTip_img_Item_Equip_Summary_icon_bdr, x, y);
this.Gear.Props.TryGetValue(GearPropType.bdR, out value);
numValue = (value > 0 ? "+ " : null) + value + " % ";
DrawReqNum(g, numValue, NumberType.LookAhead, x - 5, y + 6, StringAlignment.Far);
//Ignored Monster DEF tooltip icon
x += 62;
g.DrawImage(Resource.UIToolTip_img_Item_Equip_Summary_icon_igpddr, x, y);
this.Gear.Props.TryGetValue(GearPropType.imdR, out value);
numValue = (value > 0 ? "+ " : null) + value + " % ";
DrawReqNum(g, numValue, NumberType.LookAhead, x - 5, y + 6, StringAlignment.Far);
}
from wzcomparerr2.
Thank you @Kagamia!
I have one more question.
Is there a way to change the overlap of the text? For example, if the item name has X characters, it will automatically add an ellipsis?
from wzcomparerr2.
Code thanks to a friend of mine: http://pastebin.com/pUyzFDfL
Result:
Can GearGraphics.DrawString
do convenient word wrapping?
from wzcomparerr2.
Currently GearGraphics
can only used for monospaced font formatting.
I'm still trying to support all possible fonts and word wrap, maybe it will appear in next version XD
from wzcomparerr2.
Thank you for your hard work and dedication on this program. It's amazing.
I will close this thread since my questions have been answered. :)
from wzcomparerr2.
Related Issues (20)
- 最新的 20230914 build 无法渲染 KMST 1.2.1161 的任何地图 HOT 4
- QuickView NPC Tooltip Render doesn't display NPCs with an outlinked Default thumbnail HOT 1
- MapRenderer: transparency not applied to background color (argb) selection HOT 9
- MapRender: png output on maps with transparent objects HOT 3
- KMS和KMST客户端比对后有部分新增图片未输出到对比档案 HOT 2
- 对比客户端的文件,感觉好像把每个文件都对比了一下 HOT 2
- Add CuttableCount display support in QuickView HOT 1
- 帧动画合成GIF的问题,每一帧的位置有偏差 HOT 5
- Spine does not account for phaseAtlas HOT 2
- All png files are not saved HOT 6
- MapRender 在高于 1920 x 1080 分辨率的显示器下,不会以 1920x1080 的分辨率窗口化 HOT 5
- 武器伤害上限加入单位 HOT 1
- 只会出现在 BUFF 中的技能 500061002 中的数值 #strX 无法正确被解析,能否将技能效果说明的部分隐藏 HOT 2
- 最新KMS客户端1.2.388中NPC功能文字颜色变了,希望maprender也能相应变色。 HOT 1
- KMST 1170 到 1171 更新文件有特别变化 HOT 5
- WzPatcher 希望加入跳过更新前校验检查功能 HOT 1
- KMST 1.2.1172 的活动地图渲染不正确 HOT 5
- 将林之灵的武器和副武器更改成“记忆长杖”以及“飞越”
- CMS V207 的 WorldMap177 渲染不正常
- KMST 1.2.173: Certain Skill Tooltips give an error HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wzcomparerr2.