vbnet绘点 VBNET下载
vb.net 真的没法画点吗?
.NET确实没有提供画一个像素点得方法
让客户满意是我们工作的目标,不断超越客户的期望值来自于我们对这个行业的热爱。我们立志把好的技术通过有效、简单的方式提供给客户,将通过不懈努力成为客户在信息化领域值得信任、有价值的长期合作伙伴,公司提供的服务项目有:域名申请、虚拟空间、营销软件、网站建设、祁门网站维护、网站推广。
你可以试一下用FillEllipse填充一个宽1像素,高2像素的椭圆
原理就是FillEllipse的时候,最左边那一列一般都会多出一个一像素的点;高至少要2,少了就什么都画不出来
asp.net中怎么画一些随机点,用VB.NET的
namespace Linfo
{
public partial class VerifyCode : BasePage
{
public Random rand = new Random();
protected void Page_Load(object sender, EventArgs e)
{
string strListCode = "0123456789abcdefghigklmnopqrstuvwxyz";
int num = 0;
string strNum = num.ToString();
string strListNum = "";
for (int i = 0; i = 3; i++)
{
num = this.rand.Next(1, 36);
strListNum = strListNum + strListCode.Substring(num - 1, 1);
}
this.Session["checkcode"] = strListNum;
base.Response.Cookies.Add(new HttpCookie("CheckCode", SHA1(strListNum)));
this.CreateImage(strListNum);
}
private void CreateImage(string checkCode)
{
int iwidth = checkCode.Length * 8;
Bitmap image = new Bitmap(70, 30);
Graphics g = Graphics.FromImage(image);
g.SmoothingMode = SmoothingMode.HighQuality;
Font f = new Font("Arial ", 14f, FontStyle.Bold);
Brush b = new SolidBrush(Color.Black);
Rectangle rect = new Rectangle(0, 0, 80, 30);
HatchBrush hatchBrush = new HatchBrush(HatchStyle.DarkDownwardDiagonal, Color.LightGray, Color.LightSkyBlue);
g.FillRectangle(hatchBrush, rect);
float CPostion = 1f;
for (int i = 0; i checkCode.Length; i++)
{
this.TransformG(g);
SizeF size = g.MeasureString(checkCode[i].ToString(), f);
g.DrawString(checkCode[i].ToString(), f, b, CPostion, 5f);
CPostion += size.Width - 1f;
g.ResetTransform();
}
MemoryStream ms = new MemoryStream();
image.Save(ms, ImageFormat.Jpeg);
g.Dispose();
image.Dispose();
base.Response.ClearContent();
base.Response.ContentType = "image/Jpeg";
base.Response.BinaryWrite(ms.ToArray());
}
private void TransformG(Graphics g)
{
Matrix myMatrix = new Matrix();
int num1 = this.rand.Next(80, 900);
int num2 = this.rand.Next(80, 800);
float dd1 = num1;
float dd2 = num2;
dd1 /= 10000f;
dd2 /= 10000f;
float f1 = dd1;
float f2 = dd2;
myMatrix.Shear(f1, f2);
g.MultiplyTransform(myMatrix);
}
}
}
怎样在VB.net中画一个点呢?
画点:
在PictureBox的Paint事件里面:
dim myGraphics=e.Graphics
Dim myPointArray As Point() = {New Point(0, 0), New Point(50, 30), New Point(30, 60)}
myGraphics.DrawPolygon(myPen, myPointArray)
画圆:
Dim g As Graphics
g = PictureBox1.CreateGraphics
g.FillEllipse(Brushes.Red, x, y, 10, 10)
VB.NET如何在PICTUREBOX里画一个点,或者说是一个可以规定半径的实心圆?我用的是Visual Basic 2005....
自己用GDI+画的 无论什么什么尺寸的picturebox都行
不过别太小了o(∩_∩)o
代码放在哪里自己决定啊
最好是放在 picturebox的resize时间里
每次picturebox大小改变都重画一次坐标
Dim b As New Bitmap(PictureBox1.Width, PictureBox1.Height)
Dim g As Graphics = Graphics.FromImage(b)
g.Clear(Color.White)
Dim p As New Pen(Color.Black)
p.EndCap = Drawing2D.LineCap.ArrowAnchor
g.DrawLine(p, 30, PictureBox1.Height - 30, 30, 30)
g.DrawLine(p, 30, PictureBox1.Height - 30, PictureBox1.Width - 30, PictureBox1.Height - 30)
Dim i As Integer
Dim bs As New SolidBrush(Color.Green)
Dim po As New Point
po.X = 0
po.Y = PictureBox1.Height - 35
For i = 700 To 1000 Step 50
g.DrawString(i, Me.Font, bs, po.X, po.Y)
g.DrawLine(p, po.X + 28, po.Y + 5, po.X + 30, po.Y + 5)
po.Y -= (PictureBox1.Height - 100) / 6
Next
po.X = 30
po.Y = PictureBox1.Height - 30
For i = 0 To 40 Step 5
g.DrawString(i, Me.Font, bs, po.X, po.Y + 5)
g.DrawLine(p, po.X, po.Y + 2, po.X, po.Y)
po.X += (PictureBox1.Width - 100) / 8
Next
PictureBox1.Image = b
求问VB.NET中(注不是VB6.0)没有画点吗,急!!求高手帮忙
Dim b As New Bitmap(320, 200)'定义图像宽高
Dim clrs As Color=Color.Black
for y as int32=1 to 199
for x as int32=1 to 319
if x=y then
clrs = Color.White'假设是对角线,x=y时使用白色
else
clrs = Color.Black'平时使用黑色
endif
b.SetPixel(x, y, clrs)'画点
next
next
b.Save("test.tif", System.Drawing.Imaging.ImageFormat.Tiff)'保存到图片文件
==================
原创例子,祝进步!!
标题名称:vbnet绘点 VBNET下载
标题网址:http://myzitong.com/article/dodsigd.html