为矩形提供尺寸 [英] Give dimension to rectangle

查看:67
本文介绍了为矩形提供尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi程序员





我有问题我现在可以绘制一个矩形,但我的问题是我想要命名矩形的长度和宽度,其大小为窗口形式



如图所示



200cm < br $> 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.


这篇关于为矩形提供尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆