vb.net窗体图片,VB图片框控件

visual studio 怎么在窗体添加图片

1、打开你的VS,创建一个WPF窗体程序。

站在用户的角度思考问题,与客户深入沟通,找到平潭网站设计与平潭网站推广的解决方案,凭借多年的经验,让设计与互联网技术结合,创造个性化、用户体验好的作品,建站类型包括:成都做网站、成都网站设计、企业官网、英文网站、手机端网站、网站推广、域名注册虚拟主机、企业邮箱。业务覆盖平潭地区。

2、创建好的WPF窗体程序是这样的。

3、在视图——属性窗口中调图窗体程序的属性,在属性的画笔栏中可以更改窗体程序的背景。

4、然后按键F5调试窗口看一下。

5、如果我想将WPF程序背景更改为任何一张其他的图片,如左图的枫叶。

6、可以看到我们的图片与应用程序的窗体大小不一致,我们只需要调节在图片边缘中部那里调整就行了。

7、修改好的图片就出来了,再按键F5调试运行一下看看。

VB.net关于两个窗体图片传送的两个问题

1)首先你的程序是从form1开始的,这个时候并没有一个form2存在,所以要新建一个form2类型的对象。另外要看到form2的话,还要加一句 newform2.show()。

2)这里 objx=x 只是增加对对象的一个引用,并不是新建了一个objx对象,所以objx就相当于 x ,也就是picturebox1 。

求大神指点vb.net 怎么以指定方式打开图片呢?

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

'建立新的系统进程    

Dim process As New System.Diagnostics.Process()

If RadioButton1.Checked Then

'设置文件名,此处为图片的真实路径+文件名    

process.StartInfo.FileName = "c:\a.bmp"

'设置进程运行参数    

process.StartInfo.Arguments = "rundll32.exe shimgvw.dll"

Else

process.StartInfo.FileName = "mspaint.exe"

process.StartInfo.Arguments = "c:\a.bmp"

End If

'此项为是否使用Shell执行程序,因系统默认为true,此项也可不设,但若设置必须为true    

'process.StartInfo.UseShellExecute = True

'此处可以更改进程所打开窗体的显示样式,可以不设    

'process.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden

process.Start()

process.Close()

End Sub

vb.net中怎么设置背景图片全部填充在窗体里

建个图片框控件,它有个随控件大小改变,图片也改变的属性,设置为“是”然后用该控件的MOVE方法,来实现。在Form_Resize事件里编,不知道NET有这个事件没。

vb 如何使部分窗体生成图片

只要将VB窗口内的需要部分保存成图片文件就可以了

要用到API函数的:

Private Type POINTAPI

x As Long

y As Long

End Type

Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long

Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long

Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long

Private Declare Function DrawIcon Lib "user32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As Long

Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long

Private Sub Command1_Click()

Dim hdc As Long

Dim sw As Integer

Dim sh As Integer

Dim CurPos As POINTAPI

Dim Cur As Long

Me.Hide

DoEvents

Picture1.AutoRedraw = True

hdc = GetDC(0)

GetCursorPos CurPos

Cur = GetCursor

Picture1.Width = Screen.Width

Picture1.Height = Screen.Height

sw = Screen.Width / Screen.TwipsPerPixelX

sh = Screen.Height / Screen.TwipsPerPixelY

BitBlt Picture1.hdc, 0, 0, sw, sh, hdc, 0, 0, vbSrcCopy

Me.Show

DrawIcon Picture1.hdc, CurPos.x - 10, CurPos.y - 10, Cur

ReleaseDC 0, hdc

Picture1.AutoRedraw = False

以下放到模块里:

Option Explicit

Type RECT_Type

left As Long

top As Long

right As Long

bottom As Long

End Type

'The following declare statements are case sensitive.

Declare Function GetActiveWindow Lib "User32" () As Long

Declare Function GetDesktopWindow Lib "User32" () As Long

Declare Sub GetWindowRect Lib "User32" (ByVal Hwnd As Long, _

lpRect As RECT_Type)

Declare Function GetDC Lib "User32" (ByVal Hwnd As Long) As Long

Declare Function CreateCompatibleDC Lib "Gdi32" (ByVal hdc As Long) _

As Long

Declare Function CreateCompatibleBitmap Lib "Gdi32" (ByVal hdc _

As Long, ByVal nWidth As Long, _

ByVal nHeight As Long) As Long

Declare Function SelectObject Lib "Gdi32" (ByVal hdc As Long, _

ByVal hObject As Long) As Long

Declare Function BitBlt Lib "Gdi32" (ByVal hDestDC As Long, _

ByVal X As Long, ByVal Y _

As Long, ByVal nWidth As Long, _

ByVal nHeight As Long, _

ByVal hSrcDC As Long, _

ByVal XSrc As Long, _

ByVal YSrc As Long, _

ByVal dwRop As Long) As Long

Declare Function OpenClipboard Lib "User32" (ByVal Hwnd As Long) As Long

Declare Function EmptyClipboard Lib "User32" () As Long

Declare Function SetClipboardData Lib "User32" (ByVal wFormat As Long, _

ByVal hMem As Long) As Long

Declare Function CloseClipboard Lib "User32" () As Long

Declare Function ReleaseDC Lib "User32" (ByVal Hwnd As Long, _

ByVal hdc As Long) As Long

Declare Function DeleteDC Lib "Gdi32" (ByVal hdc As Long) As Long

Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Global Const SRCCOPY = HCC0020

Global Const CF_BITMAP = 2

Function ScreenDump()

Dim AccessHwnd As Long, DeskHwnd As Long

Dim hdc As Long

Dim hdcMem As Long

Dim rect As RECT_Type

Dim junk As Long

Dim fwidth As Long, fheight As Long

Dim hBitmap As Long

' DoCmd.Hourglass True

'---------------------------------------------------

' Get window handle to Windows and Microsoft Access

'---------------------------------------------------

DoEvents

DeskHwnd = GetDesktopWindow()

AccessHwnd = GetActiveWindow()

'---------------------------------------------------

' Get screen coordinates of Microsoft Access

'---------------------------------------------------

Call GetWindowRect(AccessHwnd, rect)

fwidth = rect.right - rect.left

fheight = rect.bottom - rect.top

'---------------------------------------------------

' Get the device context of Desktop and allocate memory

'---------------------------------------------------

hdc = GetDC(DeskHwnd)

hdcMem = CreateCompatibleDC(hdc)

hBitmap = CreateCompatibleBitmap(hdc, fwidth, fheight)

If hBitmap 0 Then

junk = SelectObject(hdcMem, hBitmap)

'---------------------------------------------

' Copy the Desktop bitmap to memory location

' based on Microsoft Access coordinates.

'---------------------------------------------

junk = BitBlt(hdcMem, 0, 0, fwidth, fheight, hdc, rect.left, _

rect.top, SRCCOPY)

'---------------------------------------------

' Set up the Clipboard and copy bitmap

'---------------------------------------------

junk = OpenClipboard(DeskHwnd)

junk = EmptyClipboard()

junk = SetClipboardData(CF_BITMAP, hBitmap)

junk = CloseClipboard()

End If

'---------------------------------------------

' Clean up handles

'---------------------------------------------

junk = DeleteDC(hdcMem)

junk = ReleaseDC(DeskHwnd, hdc)

' DoCmd.Hourglass False

End Function

这里是拖动鼠标的框里内容截取,你也可以改成固定范围的截取。


名称栏目:vb.net窗体图片,VB图片框控件
本文来源:http://ybzwz.com/article/dscejog.html