2Poto - Please Ctrl+DBookmark Now!

วิชวลเบสิค/ การพัฒนาโปรแกรม


ฟังก์ชั่นเกี่ยวกับ ListBox
Tips เกี่ยวกับ ListBox


--------------------------------------------------------------------------------

Public Sub LB_FillList(Listcontrol As ListBox, ParamArray Items())


'FillList List1, "TiffanyT", "MikeS", "RochesterNY"

Dim i As Variant

With Listcontrol

For Each i In Items

.Clear

.AddItem i

Next

End With

End Sub
--------------------------------------------------------------------------------

Sub ListToArray(list As Object, Ar$())


Dim i&, listCount&

ReDim Ar(list.listCount - 1)

For i = 0 To list.listCount - 1

Ar(i) = list.list(i)

Next

End Sub


--------------------------------------------------------------------------------

Sub ToolTipList(oc_list As Object, x As Single, y As Single)


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

' Call oc_list ListBox

' x ตำแหน่งในแนวแกน x

' y ตำแหน่งในแนวแกน y

' eg. ว่างซับโปรแกรมนี้ที่ Movemouse even ของ ListBox

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

Dim YPos As Integer, iOldFontSize As Integer

iOldFontSize = Screen.ActiveForm.Font.size

Screen.ActiveForm.Font.size = oc_list.Font.size

YPos = y \ Screen.ActiveForm.TextHeight("Xyz") + oc_list.TopIndex

Screen.ActiveForm.Font.size = iOldFontSize

If YPos < oc_list.listCount Then

oc_list.ToolTipText = oc_list.list(YPos)

Else: oc_list.ToolTipText = ""

End If
End Sub



--------------------------------------------------------------------------------


Listbox - Horizontal Scrolling
By: Microsoft


Create a new Standard EXE project in

Visual Basic. Form1 is created by default.


Add a CommandButton and a ListBox to Form1.

declaration section of Form1:

Option Explicit
Private Declare Function SendMessageByNum Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Const LB_SETHORIZONTALEXTENT = &H194
Private Sub Command1_Click()

Dim s As String

Static x As Long

s = InputBox("Please enter any text", "List scroll", "this is a simple scrollbar sample for demonstration purposes")

List1.AddItem s

If x < TextWidth(s & " ") Then

x = TextWidth(s & " ")

If ScaleMode = vbTwips Then _

x = x / Screen.TwipsPerPixelX ' if twips change to pixels

SendMessageByNum List1.hwnd, LB_SETHORIZONTALEXTENT, x, 0

End If
End Sub
โดยคุณ : โก้ - [ 17 ธ.ค. 2543 , 12:54:05 น. ]

คำแนะนำ
อยากให้มีการอธิลายมากกว่านี้และก็อยากให้ยกตัวอย่าง ด้วยว่าโปรแกรมที่เขียนนั้นเป็นโปรแกรมอะไร
โดยคุณ : Tik - [ 27 ธ.ค. 2544 , 10:18:55 น.]


คำแนะนำ
อยากทราบว่า เมื่อเป็นโปรแกรมจะมีหน้าตาอย่างไร ใช้ทำอะไรครับ
วี
โดยคุณ : vee - [ 30 มิ.ย. 2002 , 08:55:09 น.]


คำแนะนำ
ช่วยเขียนอธิบายข้างหลังแต่ละบรรทัดได้ไหม จะได้เข้าใจยิ่งขึ้น
โดยคุณ : มือใหญ่หัดเขียน - ICQ : 126774167 - [ 25 ม.ค. 2003 , 05:54:35 น.]


คำแนะนำ
พี่ๆทำอะไรกัน
โดยคุณ : 555 - [ 15 ม.ค. 2004 , 21:02:21 น.]


คำแนะนำ
ไม่บอก ไม่พูด ไม่กล่าว แล้วเขาจะรู้หรือป่าว
อาจจะไม่แน่ใจ
โดยคุณ : เรื่องจริงนะ - [ 12 มี.ค. 2004 , 20:10:10 น.]


คำแนะนำ
เห็นด้วย เป็นโปรแกรมเกี่ยวกับอะไรหรอคะ -_-" ...ช่วยอธิบาย อธิบาย ให้ฉันเข้าใจหน่อย...
โดยคุณ : -_-" - [ 16 ก.ย. 2005 , 21:35:24 น.]


คำแนะนำ
เห็นด้วย เป็นโปรแกรมเกี่ยวกับอะไรหรอคะ -_-" ...ช่วยอธิบาย อธิบาย ให้ฉันเข้าใจหน่อย...
โดยคุณ : -_-" - [ 16 ก.ย. 2005 , 21:36:12 น.]


ขอเชิญร่วมเสนอแนะความคิดเห็นครับ
จาก :
email :
icq :
รายละเอียด



กรุณาคลิ๊ก Post message เพียงครั้งเดียวครับ....