为矩形提供尺寸

编程入门 行业动态 更新时间:2024-10-23 21:38:19
本文介绍了为矩形提供尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

Hi程序员 我有问题我现在可以绘制一个矩形,但我的问题是我想要命名矩形的长度和宽度,其大小为窗口形式 如图所示 200cm b $ b ____________________ | | | | | | 100cm | | | ___________________ |

Hi Programmers I have problem i can able to draw a rectangle now, but my question is i want to name the length and width of the rectangle with its size in windows form Eg shown in Diagram 200cm ____________________ | | | | | | 100cm | | |___________________|

推荐答案

具体如何做到这一点在很大程度上取决于你如何绘制矩形。如果你正在处理UserControl的绘制事件,那么它非常简单 - 只需使用Graphics.DrawString方法添加文本(一旦你将实际的矩形偏移得足够远)。 如果你的方式不同,那么可能需要更多的工作,但我们需要更多关于你如何做的细节。 Exactly how you do this depends to a large extent on how you are drawing your rectangle. If you are handling the paint event of a UserControl, then it's pretty easy - just use the Graphics.DrawString method to add the text (once you have offset the actual rectangle far enough away). If you are doing it differently, then it may take more work, but we would need a lot more detail about how you are doing it.

更多推荐

为矩形提供尺寸

本文发布于:2023-11-25 12:06:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1629677.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:矩形   尺寸

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!