我想用c#内置的形式画一条线. [英] I want to draw a line in the form built in c#.
问题描述
你好,
我想在用c#创建的表单上画一条线.我该怎么办.
hello,
I want to draw a line on form that i have created in c#.How can I do This.
推荐答案
如果它是水平或垂直的,只需画一个Panel
控件的边框为1像素宽.
编辑=========================
如果要绘制不是垂直或水平的线,则可以这样进行:
If it''s horizontal or vertical, just draw aPanel
control with a border that is 1 pixel wide.
EDIT ===========================
If you want to draw a line that is NOT vertical or horizontal, you can do it this way:
System.Drawing.Pen myPen;
myPen = new System.Drawing.Pen(System.Drawing.Color.Red);
System.Drawing.Graphics g = this.CreateGraphics();
g.DrawLine(myPen, 0, 0, 200, 200);
myPen.Dispose();
g.Dispose();
一个简单的谷歌搜索将在您坐在屁股上等待某人用勺子喂食您的时间内揭示出这个答案.
顺便说一句,我的态度是由您重新发布问题引起的,而不是在这里告诉我您除了水平或垂直像素之外还需要其他内容.
编辑=========================
如果您是第四次发布问题,我将举报您受到滥用.这是您唯一的警告.
A simple google search would have revealed this answer in the amount of time that you sat on your ass waiting for someone to spoon-feed it to you.
BTW, my attitude was caused by you reposting your question instead of telling me here that you wanted something other than a single pixel horizontal or vertical line.
EDIT ===========================
If you post your question a 4th time, I''m going to report you for abuse. This is your only warning.
这篇关于我想用c#内置的形式画一条线.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!