大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
这是我自己写的一个进度条控件,如图:
目前成都创新互联已为上1000+的企业提供了网站建设、域名、雅安服务器托管、网站托管、企业网站设计、衡水网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。
边框粗细和边框颜色以及进度条颜色都可以调。
进度条大小你可以自己拉伸。
同时,进度条还提供了丰富的动画效果(如边框闪烁效果【可关闭】,进度条滑动效果等。)
将边框粗细调为0即可实现无边框(同时边框闪烁效果(见“Flash”属性)也将关闭!)
进度值(见“ProgressValue”属性)类型为Single(单精度浮点数)
将我提供的DLL文件拖到工具箱即可安装
只能用于Windows窗体应用程序!
目标平台:.Net Framework 3.5
属性说明:
1.BorderColor 用于调整边框颜色
2.BorderWidth 用于调整边框粗细
3.Flash 用于开启、关闭边框闪烁效果
4.ProgressValue 用于设置、查看进度值
5.ForeColor 用于设置进度条颜色
6.BackColor 用于设置控件背景色
附件如果丢失,请私信。
dim str as string = "hjl"
dim hjl as new textbox
hjl.text = str
真不太懂你的意思,
Imports System.Data.OleDb
'Imports System.Data.OracleClient
Imports System.Data.SqlClient
'链接Oracle
'cn = New SqlConnection(""Data Source=TNS名称;Persist Security Info=True;User ID=用户名;Password=密码;" ")
'Imports System.Data.OracleClient
'Dim oOracleConn As OracleConnection = New OracleConnection()
'oOracleConn.ConnectionString = ""Data Source=MyOracleDB; User Id=username; Password=passwd; Integrated Security=no; "
'oOracleConn.Open()
'链接SQL Server
'cn = New SqlConnection("Data Source=.;Initial Catalog=Sales;Integrated Security=False;User ID=sa;Password=;")
'链接Access
'cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" db_path ";Persist Security Info=False")
Public Class Fun_DataBase
Dim cn As OleDbConnection
Dim cm As OleDbCommand
Dim da As OleDbDataAdapter
Dim ds As DataSet
Dim db_path As String = "D:\Documents\Visual Studio 2013\Projects\VBnet1\VBnet1\Resources\Database1.mdb"
Function Fun_sql1(Str_sql As String, V_调用来源 As String) '按指定sql,反馈1个查询值
Try
'Dim cn As New OleDbConnection("Data Source=.;Initial Catalog=Sales;Integrated Security=False;User ID=sa;Password=123456;")
'链接Access
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" db_path ";Persist Security Info=False")
cn.Open() 'sql语句执行前,必须打开连接
cm = New OleDbCommand(Str_sql, cn)
cm.ExecuteNonQuery()
Dim strValue As String = cm.ExecuteScalar.ToString
'MessageBox.Show(strValue)
Fun_sql1 = strValue
cn.Close()
Fun_sql1 = True
Catch ex As Exception
MessageBox.Show(V_调用来源 ":执行sql语句失败!" Str_sql)
Fun_sql1 = False
End Try
End Function
Function Fun_sqln(Str_sql As String, V_调用来源 As String) '按指定sql,反馈1行n列查询值
Try
'链接Access
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" db_path ";Persist Security Info=False")
cn.Open() 'sql语句执行前,必须打开连接
Dim cmd As New OleDbCommand("select * from grade", cn)
'Dim dr As SqlDataReader
Dim dr As OleDbDataReader
dr = cmd.ExecuteReader()
Dim strDisplay As String = ""
While dr.Read()
Fun_sqln = dr(0).ToString "|"
End While
cn.Close()
Fun_sqln = True
Catch ex As Exception
MessageBox.Show(V_调用来源 ":执行sql语句失败!" Str_sql)
Fun_sqln = False
End Try
'Dim s = Split(F.Fun_sqln("ef"), "|")
'Dim i As Integer
'i = UBound(s)
'For i = 0 To UBound(s)
' MessageBox.Show(s(i))
'Next
End Function
Public Function Fun_sql_exec(Str_sql As String, V_调用来源 As String) '执行指定sql,反馈T|F
Try
'链接Access
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" db_path ";Persist Security Info=False")
cn.Open() 'sql语句执行前,必须打开连接
cm = New OleDbCommand(Str_sql, cn)
cm.ExecuteNonQuery()
cn.Close()
Fun_sql_exec = True
Catch ex As Exception
MessageBox.Show(V_调用来源 ":执行sql语句失败!" Str_sql)
Fun_sql_exec = False
End Try
End Function
1 生成txt文件。
DimSaveFileDialog1AsNewSaveFileDialog() '创建一个保存对话框
SaveFileDialog1.Filter ="txt files (*.txt)|*.txt" '设置扩展名
IfSaveFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OKThen '如果确定保存
My.Computer.FileSystem.WriteAllText(SaveFileDialog1.Filename, Textbox1.Text,False) '保存文本,False表示不追加文本,直接覆盖其内容
EndIf
原文链接:
Imports System.Text
Imports System.Runtime.InteropServices
Public Class Form1
' 相关API函数声明,注释掉的这里没用到,但是也比较常用吧,这些函数的功能都能搜到。
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As IntPtr, ByVal hWnd2 As IntPtr, ByVal lpsz1 As String, ByVal lpsz2 As String) As IntPtr
Private Delegate Function EnumChildProc(ByVal hWnd As IntPtr, ByVal lParam As Integer) As Boolean
Private Declare Function EnumChildWindows Lib "user32.dll" (ByVal hWndParent As IntPtr, ByVal lpEnumFunc As EnumChildProc, ByVal lParam As Integer) As Boolean
Private Declare Auto Function SendMessage Lib "User32.dll" (ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As Integer, ByVal lParam As String) As Integer
'Private Declare Function CheckDlgButton Lib "user32" Alias "CheckDLGButtonA" (ByVal hDlg As IntPtr, ByVal nIDButton As IntPtr, ByVal wCheck As Integer) As Integer
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hWnd As IntPtr, ByVal lpClassName As StringBuilder, ByVal nMaxCount As Integer) As Integer
'Private Declare Function GetWindowThreadProcessId Lib "user32" Alias "GetWindowThreadProcessId" (ByVal hwnd As IntPtr, ByVal lpdwProcessId As Long) As Integer
Private Declare Auto Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLength" (ByVal hwnd As IntPtr) As Integer
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As IntPtr, ByVal lpString As StringBuilder, ByVal cch As Integer) As Integer
' 相关消息定义,也有没用到的
Const WM_SETTEXT = HC
Const WM_GETTEXT = HD
'Const WM_SETFOCUS = H7
'Const WM_KILLFOCUS = H8
'Const WM_CLOSE = H10
'Const WM_SYSCOMMAND = H112
'Const SC_CLOSE = HF060
'Const SC_MINIMIZE = HF020
Const BM_GETCHECK = HF0
Const BM_SETCHECK = HF1
Const BM_GETSTATE = HF2
Const BM_SETSTATE = HF3
Const BM_SETSTYLE = HF4
Const BM_CLICK = HF5
'Const BM_GETIMAGE = HF6
'Const BM_SETIMAGE = HF7
Const BST_UNCHECKED = O0
Const BST_CHECKED = O1
Const BST_INDETERMINATE = O2
' 储存窗口句柄
Dim WindowHandle As IntPtr
' 储存两个(或者多个)编辑框句柄
Dim EditHandle As New List(Of IntPtr)
Dim EditWindowsText As List(Of String)
' 储存复选框句柄
Dim CheckHandle As IntPtr = 0
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Button1_Click(sender, e)
End Sub
' EnumChildWindows 回调函数,该函数名作为API函数EnumChildWindows 的一个参数
' 该函数实现了枚举各个子窗口,找出编辑框属性的功能
Public Function EnumChildProcC(ByVal hwnd As IntPtr, ByVal lParam As Integer) As Boolean
Dim dwWindowClass As StringBuilder = New StringBuilder(100)
' 获得某一个句柄的类名
GetClassName(hwnd, dwWindowClass, 100)
If dwWindowClass.ToString.Contains("EDIT") Or dwWindowClass.ToString.Contains("Edit") Then ' 类名包含EDIT的为编辑框
EditHandle.Add(hwnd) ' 存储该句柄
End If
' 返回 True 一直枚举完
Return True
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
WindowHandle = FindWindow(vbNullString, "登陆")
If WindowHandle.ToInt32 = 0 Then
MsgBox("未捕获到窗口" + "登陆")
Return
End If
' 枚举所有主窗口的子窗口(控件),枚举时自动调用回调函数,完成编辑框句柄的获取
EnumChildWindows(WindowHandle, AddressOf EnumChildProcC, 0)
' 寻找复选框
CheckHandle = FindWindowEx(WindowHandle, IntPtr.Zero, vbNullString, "记住密码")
Dim str As New StringBuilder
Dim j As Integer = 0
' 对编辑框文本赋值
For j = 0 To EditHandle.Count - 1
SendMessage(EditHandle(j), WM_SETTEXT, 0, "Text")
'GetWindowText(EditHandle(j), str, 20)
'EditWindowsText.Add(Str.ToString)
'Str.Clear()
Next
If EditHandle.Count = 0 Then
MsgBox("未找到输入框!")
End If
If CheckHandle.ToInt32 0 Then
'CheckDlgButton(WindowHandle, id, 1)
' 对复选框进行鼠标单击操作
SendMessage(CheckHandle, BM_CLICK, 0, 0)
'SendMessage(CheckHandle, BM_SETCHECK, True, 0)
End If
End Sub
End Class
1.不正确
Dim abc As myClass,定义一个可以引用myClass类型对象的变量abc。这个abc变量存在于栈上。
abc=New myClass。New myClass创建myClass实例对象,这个对象存在于托管堆上。然后(同时)让abc引用(指向)这个对象。
abc变量在栈上,而对象在托管堆上。
abc储存的是对象的地址,而不是对象本身。
看下面的代码
Dim a As myClass,b As myClass,c As myClass
a=New myClass
b=a
c=a
整个过程中只创建了一个myClass对象,位于托管堆上。
三个myClass类型的变量a、b、c位于栈上,都指向了这一个myClass对象
2.类的成员分 实例成员 和 静态成员
实例成员 必须在实例对象上调用
静态成员 可以直接调用,不需要实例对象。