Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
TextRenderer.DrawText()当目标矩形太小时,是否能够绘制文本的结尾?
TextRenderer.DrawText()
TextFormatFlags.Bottom没有帮助我。
TextFormatFlags.Bottom
换句话说:如何在其顶部边缘剪切文本?
在内存中创建一个“溢出区域”大小的位图。使用 -Y 坐标将您的文本字符串绘制到此溢出区域,以便它绘制与您要剪辑到的区域对齐的图像顶部。您现在在图像中拥有溢出文本,您可以在想要的位置进行绘制。
例如,如果您想在只能显示 75 像素的区域中绘制 100 像素高的文本,请创建一个 25 像素高的图像,然后在 y=-75 处将文本绘制到该图像。