這是我自己寫(xiě)的一個(gè)進(jìn)度條控件,如圖:
目前成都創(chuàng)新互聯(lián)已為上1000+的企業(yè)提供了網(wǎng)站建設(shè)、域名、雅安服務(wù)器托管、網(wǎng)站托管、企業(yè)網(wǎng)站設(shè)計(jì)、衡水網(wǎng)站維護(hù)等服務(wù),公司將堅(jiān)持客戶導(dǎo)向、應(yīng)用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協(xié)力一起成長(zhǎng),共同發(fā)展。
邊框粗細(xì)和邊框顏色以及進(jìn)度條顏色都可以調(diào)。
進(jìn)度條大小你可以自己拉伸。
同時(shí),進(jìn)度條還提供了豐富的動(dòng)畫(huà)效果(如邊框閃爍效果【可關(guān)閉】,進(jìn)度條滑動(dòng)效果等。)
將邊框粗細(xì)調(diào)為0即可實(shí)現(xiàn)無(wú)邊框(同時(shí)邊框閃爍效果(見(jiàn)“Flash”屬性)也將關(guān)閉?。?/p>
進(jìn)度值(見(jiàn)“ProgressValue”屬性)類型為Single(單精度浮點(diǎn)數(shù))
將我提供的DLL文件拖到工具箱即可安裝
只能用于Windows窗體應(yīng)用程序!
目標(biāo)平臺(tái):.Net Framework 3.5
屬性說(shuō)明:
1.BorderColor 用于調(diào)整邊框顏色
2.BorderWidth 用于調(diào)整邊框粗細(xì)
3.Flash 用于開(kāi)啟、關(guān)閉邊框閃爍效果
4.ProgressValue 用于設(shè)置、查看進(jìn)度值
5.ForeColor 用于設(shè)置進(jìn)度條顏色
6.BackColor 用于設(shè)置控件背景色
附件如果丟失,請(qǐng)私信。
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_調(diào)用來(lái)源 As String) '按指定sql,反饋1個(gè)查詢值
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語(yǔ)句執(zhí)行前,必須打開(kāi)連接
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_調(diào)用來(lái)源 ":執(zhí)行sql語(yǔ)句失??!" Str_sql)
Fun_sql1 = False
End Try
End Function
Function Fun_sqln(Str_sql As String, V_調(diào)用來(lái)源 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語(yǔ)句執(zhí)行前,必須打開(kāi)連接
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_調(diào)用來(lái)源 ":執(zhí)行sql語(yǔ)句失?。? 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_調(diào)用來(lái)源 As String) '執(zhí)行指定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語(yǔ)句執(zhí)行前,必須打開(kāi)連接
cm = New OleDbCommand(Str_sql, cn)
cm.ExecuteNonQuery()
cn.Close()
Fun_sql_exec = True
Catch ex As Exception
MessageBox.Show(V_調(diào)用來(lái)源 ":執(zhí)行sql語(yǔ)句失??!" Str_sql)
Fun_sql_exec = False
End Try
End Function
1 生成txt文件。
DimSaveFileDialog1AsNewSaveFileDialog()?'創(chuàng)建一個(gè)保存對(duì)話框
SaveFileDialog1.Filter?="txt?files?(*.txt)|*.txt"?'設(shè)置擴(kuò)展名
IfSaveFileDialog1.ShowDialog()?=?System.Windows.Forms.DialogResult.OKThen?'如果確定保存
My.Computer.FileSystem.WriteAllText(SaveFileDialog1.Filename,?Textbox1.Text,False)?'保存文本,False表示不追加文本,直接覆蓋其內(nèi)容
EndIf
原文鏈接:
Imports?System.Text
Imports?System.Runtime.InteropServices
Public?Class?Form1
'?相關(guān)API函數(shù)聲明,注釋掉的這里沒(méi)用到,但是也比較常用吧,這些函數(shù)的功能都能搜到。
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
'?相關(guān)消息定義,也有沒(méi)用到的
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
'?儲(chǔ)存窗口句柄
Dim?WindowHandle?As?IntPtr
'?儲(chǔ)存兩個(gè)(或者多個(gè))編輯框句柄
Dim?EditHandle?As?New?List(Of?IntPtr)
Dim?EditWindowsText?As?List(Of?String)
'?儲(chǔ)存復(fù)選框句柄
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?回調(diào)函數(shù),該函數(shù)名作為API函數(shù)EnumChildWindows?的一個(gè)參數(shù)
'?該函數(shù)實(shí)現(xiàn)了枚舉各個(gè)子窗口,找出編輯框?qū)傩缘墓δ?/p>
Public?Function?EnumChildProcC(ByVal?hwnd?As?IntPtr,?ByVal?lParam?As?Integer)?As?Boolean
Dim?dwWindowClass?As?StringBuilder?=?New?StringBuilder(100)
'?獲得某一個(gè)句柄的類名
GetClassName(hwnd,?dwWindowClass,?100)
If?dwWindowClass.ToString.Contains("EDIT")?Or?dwWindowClass.ToString.Contains("Edit")?Then?????'?類名包含EDIT的為編輯框
EditHandle.Add(hwnd)????????????????????????'?存儲(chǔ)該句柄
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
'?枚舉所有主窗口的子窗口(控件),枚舉時(shí)自動(dòng)調(diào)用回調(diào)函數(shù),完成編輯框句柄的獲取
EnumChildWindows(WindowHandle,?AddressOf?EnumChildProcC,?0)
'?尋找復(fù)選框
CheckHandle?=?FindWindowEx(WindowHandle,?IntPtr.Zero,?vbNullString,?"記住密碼")
Dim?str?As?New?StringBuilder
Dim?j?As?Integer?=?0
'?對(duì)編輯框文本賦值
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)
'?對(duì)復(fù)選框進(jìn)行鼠標(biāo)單擊操作
SendMessage(CheckHandle,?BM_CLICK,?0,?0)
'SendMessage(CheckHandle,?BM_SETCHECK,?True,?0)
End?If
End?Sub
End?Class
1.不正確
Dim abc As myClass,定義一個(gè)可以引用myClass類型對(duì)象的變量abc。這個(gè)abc變量存在于棧上。
abc=New myClass。New myClass創(chuàng)建myClass實(shí)例對(duì)象,這個(gè)對(duì)象存在于托管堆上。然后(同時(shí))讓abc引用(指向)這個(gè)對(duì)象。
abc變量在棧上,而對(duì)象在托管堆上。
abc儲(chǔ)存的是對(duì)象的地址,而不是對(duì)象本身。
看下面的代碼
Dim a As myClass,b As myClass,c As myClass
a=New myClass
b=a
c=a
整個(gè)過(guò)程中只創(chuàng)建了一個(gè)myClass對(duì)象,位于托管堆上。
三個(gè)myClass類型的變量a、b、c位于棧上,都指向了這一個(gè)myClass對(duì)象
2.類的成員分 實(shí)例成員 和 靜態(tài)成員
實(shí)例成員 必須在實(shí)例對(duì)象上調(diào)用
靜態(tài)成員 可以直接調(diào)用,不需要實(shí)例對(duì)象。
當(dāng)前名稱:關(guān)于vb.net實(shí)例大全的信息
轉(zhuǎn)載來(lái)源:http://jinyejixie.com/article46/dochchg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供軟件開(kāi)發(fā)、域名注冊(cè)、建站公司、標(biāo)簽優(yōu)化、用戶體驗(yàn)、微信公眾號(hào)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)