  | 
				VFP 愛用者社區 本討論區為 Visual Foxpro 愛用者經驗交流的地方, 請多多利用"搜尋"的功能, 先查看看有無前例可循, 如果還有不懂的再發問. 部份主題有附加檔案, 須先註冊成為社區居民才可以下載.   
				 | 
			 
		 
		 
	
		| 上一篇主題 :: 下一篇主題   | 
	 
	
	
		| 發表人 | 
		內容 | 
	 
	
		guku1101
 
 
  註冊時間: 2006-07-03 文章: 84 來自: 高雄
  第 1 樓
  | 
		
			
				 發表於: 星期二 九月 09, 2008 6:54 pm    文章主題: 請問LISTBOX 可以加入check 嗎 | 
				     | 
			 
			
				
  | 
			 
			
				如題~請各位知道前輩們不吝賜教~感恩 _________________ BB | 
			 
		  | 
	 
	
		| 回頂端 | 
		 | 
	 
	
		  | 
	 
	
		garfield Site Admin
  
  註冊時間: 2003-01-30 文章: 2160
 
  第 2 樓
  | 
		
			
				 發表於: 星期三 九月 10, 2008 11:20 am    文章主題:  | 
				     | 
			 
			
				
  | 
			 
			
				可以的...
 
請參考  http://support.microsoft.com/kb/157048
 
測試的程式碼
 
 	  | 代碼: | 	 		  
 
PUBLIC ofrm1
 
 
ofrm1=NEWOBJECT("frm1")
 
ofrm1.Show
 
RETURN
 
 
 
   **************************************************
 
DEFINE CLASS frm1 AS form
 
 
 
   DoCreate = .T.
 
   numlstitm = 5
 
   Name = "Frm1"
 
   DIMENSION itemsel[1]
 
 
 
   ADD OBJECT list1 AS listbox WITH ;
 
      RowSourceType = 1, ;
 
      RowSource = "One,Twe,Three,Four,Five", ;
 
      Height = 160, ;
 
      Left = 0, ;
 
      Top = 0, ;
 
      Width = 200, ;
 
      Name = "List1"
 
 
 
   ADD OBJECT command1 AS commandbutton WITH ;
 
      Top = 50, ;
 
      Left = 220, ;
 
      Height = 27, ;
 
      Width = 84, ;
 
      Caption = "Command1", ;
 
      Name = "Command1"
 
 
 
   PROCEDURE Init
 
      DIMENSION ThisForm.ItemSel(ThisForm.NumLstItm)
 
            FOR i= 1 to ThisForm.NumLstItm
 
               ThisForm.ItemSel(i)=0
 
            endfor
 
   ENDPROC
 
 
 
   PROCEDURE list1.KeyPress
 
      lparameters nKeyCode, nShiftAltCtrl
 
      if nKeyCode=32
 
         if thisform.ItemSel(this.listitemid)=0
 
            this.picture(this.listitemid)=home()+ ;
 
               "samples\tastrade\bitmaps\checkbx.bmp"
 
            thisform.ItemSel(this.listitemid)=1
 
         else
 
            if thisform.ItemSel(this.listitemid)=1
 
 
               this.picture(this.listitemid)=home()+"samples\tastrade\bitmaps\box.bmp"
 
               thisform.ItemSel(this.listitemid)=0
 
            endif
 
         endif
 
      endif
 
   ENDPROC
 
 
 
   PROCEDURE list1.Click
 
      lparameters nButton, nShift, nXCoord, nYCoord
 
      if lastkey()!= 5 and lastkey() != 24
 
         if thisform.ItemSel(this.listitemid)=0
 
            this.picture(this.listitemid)=home()+ ;
 
               "samples\tastrade\bitmaps\checkbx.bmp"
 
            thisform.ItemSel(this.listitemid)=1
 
         else
 
            if thisform.ItemSel(this.listitemid)=1
 
 
               this.picture(this.listitemid)=home()+"samples\tastrade\bitmaps\box.bmp"
 
               thisform.ItemSel(this.listitemid)=0
 
            endif
 
         endif
 
      endif
 
   ENDPROC
 
 
 
   PROCEDURE list1.Init
 
      This.Picture=HOME()+"samples\tastrade\bitmaps\box.bmp"
 
   ENDPROC
 
 
 
   PROCEDURE command1.Click
 
      isel=""
 
      for i = 1 to thisform.NumLstItm
 
         if thisform.ItemSel(i)=1
 
            if i = 1
 
               isel = isel + thisform.List1.listitem(i)
 
            else
 
               isel = isel + ";  " + thisform.List1.listitem(i)
 
            endif
 
         endif
 
      endfor
 
      wait window isel
 
   ENDPROC
 
 
 
ENDDEFINE
 
*
 
*-- EndDefine: frm1
 
**************************************************
 
 
 | 	 
  _________________ 利用>>搜尋<<的功能會比問的還要快得到答案. | 
			 
		  | 
	 
	
		| 回頂端 | 
		 | 
	 
	
		  | 
	 
	
		guku1101
 
 
  註冊時間: 2006-07-03 文章: 84 來自: 高雄
  第 3 樓
  | 
		
			
				 發表於: 星期四 九月 11, 2008 3:34 am    文章主題:  | 
				     | 
			 
			
				
  | 
			 
			
				真的可以用~謝謝前輩的指導 _________________ BB | 
			 
		  | 
	 
	
		| 回頂端 | 
		 | 
	 
	
		  | 
	 
	
		 | 
	 
 
  
  	 
	    
  	   | 
 	
您 無法 在這個版面發表文章 您 無法 在這個版面回覆文章 您 無法 在這個版面編輯文章 您 無法 在這個版面刪除文章 您 無法 在這個版面進行投票 您 無法 在這個版面附加檔案 您 無法 在這個版面下載檔案
  | 
   
  
		 |