资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

vb.net怎么画点 vb在鼠标所点击处画点

求问VB.NET中(注不是VB6.0)没有画点吗,急!!求高手帮忙

Dim b As New Bitmap(320, 200)'定义图像宽高

目前创新互联已为1000多家的企业提供了网站建设、域名、网页空间、网站托管、企业网站设计、华容网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。

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)'保存到图片文件

==================

原创例子,祝进步!!

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中如何画点

Pset (x, y), color

其中x,y是所画点的坐标值,color是点的颜色值,比如:

Me.PSet (100, 100), vbRed '在当前窗体的(100,100)位置画一个红色的点

又比如:

Picture1.PSet (Picture1.ScaleWidth \ 2, Picture1.ScaleHeight \ 2), vbBlue '在Picture1中的中心位置画一个蓝色的点

vb.net 真的没法画点吗?

.NET确实没有提供画一个像素点得方法

你可以试一下用FillEllipse填充一个宽1像素,高2像素的椭圆

原理就是FillEllipse的时候,最左边那一列一般都会多出一个一像素的点;高至少要2,少了就什么都画不出来

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怎么在窗口上打个点?

VB有专门的绘图函数,可以直接绘制简单的图形,画点可以参考以下代码,取自MSDN

PSet 方法示例

这个示例用 PSet 方法在窗体上画五彩碎纸。想运行这个示例,将代码放入窗体的General 部分。按 F5 并单击窗体。

Sub Form_Click ()

Dim CX, CY, Msg, XPos, YPos ' Declare variables.

ScaleMode = 3 ' 设置 ScaleMode 为像素。

DrawWidth = 5 ' 设置 DrawWidth.

ForeColor = QBColor(4) ' 设置前景为红色。

FontSize = 24 ' 设置点的大小。

CX = ScaleWidth / 2 ' 得到水平中点。

CY = ScaleHeight / 2 ' 得到垂直中点。

Cls ' 清窗体。

Msg = "Happy New Year!"

CurrentX = CX - TextWidth(Msg) / 2 ' 水平位置。

CurrentY = CY - TextHeight(Msg) ' 垂直位置。

Print Msg ' 打印消息。

Do

XPos = Rnd * ScaleWidth ' 得到水平位置。

YPos = Rnd * ScaleHeight ' 得到垂直位置。

PSet (XPos, YPos), QBColor(Rnd * 15) ' 画五彩碎纸。

DoEvents ' 进行

Loop ' 其它处理。

End Sub


本文标题:vb.net怎么画点 vb在鼠标所点击处画点
本文链接:http://cdkjz.cn/article/doohghd.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220