vbnet窗体加载画面 vbnet窗体数据如何交互
VB中怎样在启动窗体时自动加载图片
窗体启动时载入图片:
创新互联建站,为您提供成都网站建设公司、成都网站制作、网站营销推广、网站开发设计,对服务门窗定制等多个行业拥有丰富的网站建设及推广经验。创新互联建站网站建设公司成立于2013年,提供专业网站制作报价服务,我们深知市场的竞争激烈,认真对待每位客户,为客户提供赏心悦目的作品。 与客户共同发展进步,是我们永远的责任!
Private Sub Form_Load()
Me.Picture = LoadPicture( "路径+文件名")
End Sub
如果程序和图像文件在同一目录内可以改成:
Me.Picture = LoadPicture( App.Path "\文件名")
读写INI文件的方法:
在工程中,新建一个模块,将如下代码粘贴进去!
Public Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
Public Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Public Sub WriteToIni(ByVal FileName As String, ByVal Section As String, ByVal Key As String, ByVal Value As String)
Dim buff As String * 128
buff = Value + Chr(0)
WritePrivateProfileString Section, Key, buff, FileName
End Sub
Public Function ReadFromIni(ByVal FileName As String, ByVal Section As String, ByVal Key As String) As String
Dim i As Long
Dim buff As String * 128
GetPrivateProfileString Section, Key, "", buff, 128, FileName
i = InStr(buff, Chr(0))
ReadFromIni = Trim(Left(buff, i - 1))
End Function
在Form窗体代码某事件【比如:Form_Load()事件】 过程中,
’读取INI文件的例子
Dim p As String
p=ReadFromIni("路径+INI文件名", "名称1", "名称2")
比如:p=ReadFromIni("d:\MusicPlayer.ini", "设置", "文件夹路径")
’写入INI文件的例子
WriteToIni "路径+INI文件名", "名称1", "名称2","字符串或者一个变量"
比如:
WriteToIni "d:\MusicPlayer.ini", "设置", "文件夹路径", "e:\mymusic"
或者:
dim f as string
f="e:\mymusic"
WriteToIni "d:\MusicPlayer.ini", "设置", "文件夹路径", f
vb.net卸载窗体和加载窗体遇到的问题
尽量丢掉vb6的习惯,注意对象的作用域及垃圾回收机制,为对象设定适当的范围,如全局对象下面给个示例(从sub main启动):public module sample public sub main() dim frm as new from1("sample form") frm.show windows.forms.application.run() end subend module public class form1 inherts windows.forms.form private btnnew as new windows.forms.button private btnclose as new windows.forms.button public sub new(byval text as string) me.text=text btnnew.text="new form" btnclose.text="exit" btnnew.location=new drawing.point(30,10) btnclose.location=new drawing.point(30,35) me.controls.add(btnnew) me.controls.add(btnclose) addhandler btnnew.click,addressof btnnew_click addhandler btnclose.click,addressof btnclose_click end sub private sub btnnew_click(byval o as object,byval e as eventargs) me.close() dim newform as new form1("new sample form") newform.show() end sub private sub btnclose_click(byval o as object,byval e as eventargs) windows.forms.application.exit() end subend class
vb.net怎么加载和卸载窗体
VB.net 加载窗体 form2.show() 卸载窗体 me.close()加载窗体和VB没啥区别,而卸载就截然不同了。附:VB 加载窗体 form2.show 卸载窗体 unload me
vb中如何实现给窗体加载,卸载背景图片
1、点击窗体点击form1,在属性窗口的picture属性中选择要form1背景的图片;可以使form1加载图片背景;
2、删除背景时,鼠标放到picture属性的值(Bitmap)内,点击鼠标,然后点击delete键,删除背景,picture的值变为none;
请采纳,谢谢
vb中如何实现窗体重新加载
VB6.0窗体重新加载可使用Load语句、Show方法等实现。
1)Show 方法,用以显示 MDIForm 或 Form 对象。
窗体名.Show
2)Load 语句,把窗体或控件加载到内存中。
Load.窗体名
3)Visual Basic 窗体经历的状态
通常地,Visual Basic 窗体在整个存活期中有四种状态:
创建,但不加载。
加载,但不显示。
显示。
内存和资源完全收回。
在一定环境下,窗体可有第五种状态:当其中有一个控件仍被引用时,窗体处于卸载和未引用状态。
4)在其他程序运行时,当代码涉及到完全卸载窗体上的控件事件或属性,被卸载窗体会被加载到内存。
Private Sub Command1_Click()
Form1.Text1 = "Abc"
End Sub
上述代码执行,Form1就被加载于内存。
当前文章:vbnet窗体加载画面 vbnet窗体数据如何交互
链接分享:http://pwwzsj.com/article/hihegs.html