Redian新闻
>
Help , a entry level question about C#
avatar
Help , a entry level question about C## DotNet - 窗口里的风景
o*l
1
in Visual C#, in a windows form application
how to draw a line or a box on the form a
except usd GDI+
thanks
avatar
a*i
2
use a label control and set its properties to achieve desired effects.
for example, if you need line, set its Height to 1.

【在 o*l 的大作中提到】
: in Visual C#, in a windows form application
: how to draw a line or a box on the form a
: except usd GDI+
: thanks

avatar
r*y
3
That's an ugly way even if it works.

【在 a*****i 的大作中提到】
: use a label control and set its properties to achieve desired effects.
: for example, if you need line, set its Height to 1.

avatar
a*i
4
but he doesn't want to use GDI+?
and i think it's not ugly. it's actually recommended
in a book on user interface design with vb.net if my
memory serves me well. previous versions of vb used
to have a line control, but it's no longer supported in vb.net.

【在 r****y 的大作中提到】
: That's an ugly way even if it works.
avatar
r*y
5
I think an easy way is to use PictureBox, and you can easily generate a
picture of a line or a box or 4 lines to form a box of any size using pic
editing software.
An advantage is: you can use png/emf file type. Resolution can be quite good.

【在 a*****i 的大作中提到】
: but he doesn't want to use GDI+?
: and i think it's not ugly. it's actually recommended
: in a book on user interface design with vb.net if my
: memory serves me well. previous versions of vb used
: to have a line control, but it's no longer supported in vb.net.

avatar
a*i
6
oh, i was talking about the single line only.
yeah, u can use other controls also. but i
would prefer setting border style property
instead of using custom pix to achieve the
same effects. it sounds like an easier and
more consistent solution to me.
if u use custom pix, u'd have to store them
as embedded resources if u don't wanna see
them scattered around, and their resolution
might be degraded when the form is resized.
i don't think resolution is a big concern
for simple cases by the way. stoc

【在 r****y 的大作中提到】
: I think an easy way is to use PictureBox, and you can easily generate a
: picture of a line or a box or 4 lines to form a box of any size using pic
: editing software.
: An advantage is: you can use png/emf file type. Resolution can be quite good.

avatar
r*y
7
如果想画虚线,点划线,双线,弧线拐角的开口框等等,怎么用这个方法并且consistent?

【在 a*****i 的大作中提到】
: oh, i was talking about the single line only.
: yeah, u can use other controls also. but i
: would prefer setting border style property
: instead of using custom pix to achieve the
: same effects. it sounds like an easier and
: more consistent solution to me.
: if u use custom pix, u'd have to store them
: as embedded resources if u don't wanna see
: them scattered around, and their resolution
: might be degraded when the form is resized.

avatar
a*i
8
better resort to GDI+ for those.
not much harder than hand-drawing and a lot more flexible..:D

【在 r****y 的大作中提到】
: 如果想画虚线,点划线,双线,弧线拐角的开口框等等,怎么用这个方法并且consistent?
avatar
r*y
9
GDI+当然可以了。
我只是想知道你的height=1的方法为什么叫做consistent。--如果只能用于single
line的话。

【在 a*****i 的大作中提到】
: better resort to GDI+ for those.
: not much harder than hand-drawing and a lot more flexible..:D

avatar
a*i
10
ft, that's for solid single lines only. and it's an example solution
for that particular case. for boxes with solid sides, i would suggest
setting border style to fixed single. that's easy and good enough. of
coz the approach doesn't help in cases when you need other types of
lines or other shapes. but i don't know how you would resolve the
resolution issue with custom pix when the form needs to be resized.
maybe there's some workaround, but i haven't worked a lot on that before.
by consistent i

【在 r****y 的大作中提到】
: GDI+当然可以了。
: 我只是想知道你的height=1的方法为什么叫做consistent。--如果只能用于single
: line的话。

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。