in Visual C#, in a windows form application how to draw a line or a box on the form a except usd GDI+ thanks
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
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.
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.
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.
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.
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.
a*i
8 楼
better resort to GDI+ for those. not much harder than hand-drawing and a lot more flexible..:D
【在 a*****i 的大作中提到】 : better resort to GDI+ for those. : not much harder than hand-drawing and a lot more flexible..:D
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