vb.net调用gdi,vb调用c

VB2010中如何使用gdi

vb里的 Long 在 vb.net里是integer或者int32

创新互联公司专业为企业提供平邑网站建设、平邑做网站、平邑网站设计、平邑网站制作等企业网站建设、网页设计与制作、平邑企业网站模板建站服务,十年平邑做网站经验,不只是建网站,更提供有价值的思路和整体网络服务。

你的参数类别要修改一下.

vb.net中使用GDI画图,然后平移,可是平移之前的图还在,怎么去掉平移之前的,保留平移之后的?

如果是简单的移动,先把图形绘制到大小和PictureBox的Bitmap上,然后再绘制到PictureBox就行。

不过在VB.NET中用GDI绘制最好用BufferedGraphics图形缓冲区,速度马马虎虎(VB就这样了),但是不闪烁,不存在背景擦除的问题。

vb.net GDI绘图刷新问题

绘图代码写在Paint事件中,如

Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint

Dim g As Graphics = Me.CreateGraphics

g.DrawLine(Pens.Red, 100, 100, 200, 100)

End Sub

'方法二:在 PictureBox1上显示图像----图画在Bitmap

PictureBox1.Image = Nothing

Dim wid As Integer = PictureBox1.ClientSize.Width

Dim hgt As Integer = PictureBox1.ClientSize.Height

Dim bm As New Bitmap(wid, hgt)

Dim g As Graphics = Graphics.FromImage(bm)

'画图代码

'画图代码

PictureBox1.Image = bm

PictureBox1.Refresh()

g.Dispose()

VB.net可以调用API吗?怎么调用?比如我要调用Gditransparentbit函数怎么写代

(1).使用DllImport特征类来申明Windows API函数:

下面是在Visual Basic .Net中使用DllImport特征类申明二个Windows API函数的具体示例:

'函数ExtractIcon,其功能是是从指定文件的指定位置导出图标的Windows句柄。

< System.Runtime.InteropServices.DllImport ( "Shell32.dll" , EntryPoint := "ExtractIcon" ) > _

Public Function _

ExtractIcon ( ByVal src As System.IntPtr , ByVal strFileName As string , ByVal uiIconIndex As UInt32 ) As System.IntPtr

End Function

'函数Icon_Num,其功能是获得指定文件中的图标数目

< System.Runtime.InteropServices.DllImport ( "Shell32.dll" , EntryPoint := "ExtractIcon" ) > _

Public Function _

Icon_Num ( ByVal src As System.IntPtr , ByVal strFileName As string , ByVal uiIconIndex As Integer ) As Integer

End Function

在使用DllImport特征类申明Windows API函数时,如果申明的函数名称和函数的入口点相同,则可以在申明Windows API函数时,省略定义函数入口点对应的代码,即EntryPoint对象字段对应的代码,这样声明ExtractIcon函数的代码也可以简化为如下所示:

< System.Runtime.InteropServices.DllImport ( "Shell32.dll" ) > _

Public Function _

ExtractIcon ( ByVal src As System.IntPtr , ByVal strFileName As string , ByVal uiIconIndex As UInt32 ) As System.IntPtr

End Function

(2).使用“Declare”语句来申明Windows API函数:

使用“Declare”语句的确比使用DllImport特征类要简单了许多,下面是在Visual Basic .Net中使用“Declare”语句来声明上述二个Windows API函数的具体方法:

Declare Auto Function ExtractIcon Lib "Shell32.dll" Alias "ExtractIcon" ( ByVal src As System.IntPtr , ByVal strFileName As string , ByVal uiIconIndex As UInt32 ) As System.IntPtr

'声明ExtractIcon函数

Declare Auto Function Icon_Num Lib "Shell32.dll" Alias "ExtractIcon" ( ByVal src As System.IntPtr , ByVal strFileName As string , ByVal uiIconIndex As Integer ) As Integer

'声明Icon_Num函数

在Visual Basic .Net中声明Windows API函数时,“Declare”语句中Alias关键字的作用相当于使用DllImport特征类中的EntryPoint对象字段。同样在使用“Declare”语句声明Windows API函数时,如果声明的函数和函数的入口点相同,也可以省略Alias关键字对应的代码,所以ExtractIcon函数也可以简化为如下:

Declare Auto Function ExtractIcon Lib "Shell32.dll" ( ByVal src As System.IntPtr , ByVal strFileName As string , ByVal uiIconIndex As UInt32 ) As System.IntPtr

VB.NET怎么应用GDI画串口通讯数据的实时曲线

拖一个PictureBox1控件

创建一个Paint事件。在事件中加入

Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint

' Create pens.

Dim redPen As New Pen(Color.Red, 3)

Dim greenPen As New Pen(Color.Green, 3)

' Create points that define curve.

Dim point1 As New Point(50, 50)

Dim point2 As New Point(100, 25)

Dim point3 As New Point(200, 5)

Dim point4 As New Point(250, 50)

Dim point5 As New Point(300, 100)

Dim point6 As New Point(350, 200)

Dim point7 As New Point(250, 250)

Dim curvePoints As Point() = {point1, point2, point3, point4, _

point5, point6, point7}

' Draw lines between original points to screen.

e.Graphics.DrawLines(redPen, curvePoints)

' Draw curve to screen.

e.Graphics.DrawCurve(greenPen, curvePoints)

End Sub

得到数据后,改point的数据。然后PictureBox1.Refresh()就行了

vb.net GDI+

当然是全部重画。

层只不过是制图软件弄出来的一个方便的东西而已。

就像你画画,画上去如果你要擦掉当然是擦到底色咯。(当然GDI+也可以像你画画一样只擦一部分)

GDI+时钟我写过一个VB6的。代码详见我博客。地址显然百度不让贴上= =。所以你可以看下我的资料。

你可以模拟层,就是把所有绘制信息都保存起来。你的流程应当是:

如果要绘制了,更新绘制信息(可以是数组啥的。),交给一个Draw过程

Draw过程:根据绘制信息,全部绘制。

By vIstaswx ,before junior school graduation exam.

当前题目:vb.net调用gdi,vb调用c
网页地址:https://www.cdcxhl.com/article18/hcesgp.html

成都网站建设公司_创新互联,为您提供网站收录网站排名营销型网站建设小程序开发关键词优化云服务器

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

网站优化排名