  | 
				VFP 愛用者社區 本討論區為 Visual Foxpro 愛用者經驗交流的地方, 請多多利用"搜尋"的功能, 先查看看有無前例可循, 如果還有不懂的再發問. 部份主題有附加檔案, 須先註冊成為社區居民才可以下載.   
				 | 
			 
		 
		 
	
		| 上一篇主題 :: 下一篇主題   | 
	 
	
	
		| 發表人 | 
		內容 | 
	 
	
		Ruey
 
 
  註冊時間: 2003-03-12 文章: 1698 來自: tunglo
  第 1 樓
  | 
		
			
				 發表於: 星期日 三月 14, 2004 12:57 am    文章主題: Toolbar ActiveX 控件來生成 Coolbar 界面(轉貼) | 
				     | 
			 
			
				
  | 
			 
			
				來源:梅子 wwen_2003 
 
http://www.meizibbs.3322.org/bbs/dispbbs.asp?boardID=2&ID=13513
 
 
概述
 
本文描述如何用 Microsoft Toolbar Version 6.0 ActiveX 控件創建一個類似於 Coolbar 的界面.
 
 
更多信息
 
Coolbar 界面是一種僅當用戶移動動它上面才突起的的按鈕, 就像 IE 4.0 那樣.
 
 
主要的生成 Coolbar 按鈕的屬性是 Toolbar Active 控件的 Style 屬性. Style 屬性的默認值是 "0 [ASCII 150] Standard" 按鈕. 改變該屬性為 "1 [ASCII 150] Transparent" 可提供類似於 Coolbar 按飯的效果. 
 
 
示例
 
用以下代碼創建一個程序文件: 
 
PUBLIC x
 
x=CREATEOBJECT("myform")
 
x.SHOW
 
 
**************************************************
 
* myform - Class Definition
 
**************************************************
 
DEFINE CLASS myform as Form
 
ADD OBJECT myclass1 AS myclass
 
ADD OBJECT check1 AS checkbox WITH;
 
Top = 150,;
 
Left = 50,;
 
Height = 50,;
 
Caption = "CoolBar"
 
 
PROCEDURE check1.Click
 
DO CASE
 
CASE This.value = 0
 
&& Changing the Toolbar to look like Coolbar.
 
Thisform.myclass1.OBJECT.Style = 0
 
CASE This.value = 1
 
&& Changeing the Toolbar to Standard Toolbar.
 
Thisform.myclass1.OBJECT.Style = 1
 
ENDCASE
 
ENDPROC
 
 
PROCEDURE myclass1.ButtonClick
 
*** ActiveX Control Event ***
 
LPARAMETERS button
 
DO CASE
 
CASE Button.key = "One"
 
WAIT WINDOW "Test1"
 
CASE Button.key = "Two"
 
WAIT WINDOW "Test2"
 
CASE Button.key = "Three"
 
WAIT WINDOW "Test3"
 
ENDCASE
 
ENDPROC
 
 
PROCEDURE myclass1.ButtonMenuClick
 
*** ActiveX Control Event ***
 
LPARAMETERS buttonmenu
 
DO CASE
 
CASE buttonmenu.key = "One"
 
WAIT WINDOW "SubOne"
 
CASE buttonmenu.key = "Two"
 
WAIT WINDOW "SubTwo"
 
ENDCASE
 
ENDPROC
 
 
ENDDEFINE
 
 
*-- EndDefine: myform
 
**************************************************
 
 
**************************************************
 
* myclass - Class Definition
 
**************************************************
 
DEFINE CLASS myclass AS olecontrol
 
 
#DEFINE tbrDEFAULT 0 && (默認) 按鈕
 
#DEFINE tbrCHECK 1 && 復選框
 
#DEFINE tbrBUTTONGROUP 2 && 按鈕組
 
#DEFINE tbrSEPARATOR 3 && 分隔器
 
#DEFINE tbrPLACEHOLDER 4 && 佔位器
 
#DEFINE tbrDROPDOWN 5 && 菜單按鈕下拉
 
 
Top = 0
 
Left = 0
 
Height = 38
 
Width = 375
 
Align = 1
 
Name = "Olecontrol1"
 
OleClass = "MSComCtlLib.Toolbar.2"
 
 
PROCEDURE Init
 
This.Buttons.Add(,"One","Test1",,)
 
This.Buttons.Add(,"Two","Test2",,)
 
This.Buttons.Add(,"Spr",,tbrSEPARATOR,)
 
This.Buttons.Add(,"Three","Test3",tbrDROPDOWN,)
 
This.Buttons(4).ButtonMenus.Add(1,"One","SubOne")
 
This.Buttons(4).ButtonMenus.Add(2,"Two","SubTwo")
 
ENDPROC
 
 
ENDDEFINE _________________ #############################
 
快樂媽咪系列幸福宅配,喝十全雞湯~原來幸福那麼簡單!!
 
 
學會VFP使用者社區的搜尋,Code才會更有趣~
 
############################# | 
			 
		  | 
	 
	
		| 回頂端 | 
		 | 
	 
	
		  | 
	 
	
		ylong
 
 
  註冊時間: 2003-07-30 文章: 118
 
  第 2 樓
  | 
		
			
				 發表於: 星期四 四月 01, 2004 2:36 pm    文章主題:  | 
				     | 
			 
			
				
  | 
			 
			
				可否請問Ruey幾個Toolbar ActiveX上的問題,因為我有把這篇文章上的程式段
 
應用到程式段上,但發現了幾個問題如下:
 
一、因為上面的Button顯示的都是文字,如何把圖型加如其中,使button上可   以顯示文字,也可以顯示圖型
 
二、文字要如何定義字的大小
 
三、測試結果,Toolbar都是在最上面,是否可以指定Toolbar在想要出現的位置
 
第一次使用Toolbar,有很多不懂得地方,還請Ruey不吝賜教,謝謝! | 
			 
		  | 
	 
	
		| 回頂端 | 
		 | 
	 
	
		  | 
	 
	
		Ruey
 
 
  註冊時間: 2003-03-12 文章: 1698 來自: tunglo
  第 3 樓
  | 
		
			
				 發表於: 星期五 四月 02, 2004 1:16 am    文章主題:  | 
				     | 
			 
			
				
  | 
			 
			
				這各我沒有在使用.你可以先嘗試!! _________________ #############################
 
快樂媽咪系列幸福宅配,喝十全雞湯~原來幸福那麼簡單!!
 
 
學會VFP使用者社區的搜尋,Code才會更有趣~
 
############################# | 
			 
		  | 
	 
	
		| 回頂端 | 
		 | 
	 
	
		  | 
	 
	
		syntech
 
 
  註冊時間: 2003-05-16 文章: 4252 來自: Taipei,Taiwan
  第 4 樓
  | 
		
			
				 發表於: 星期一 四月 12, 2004 11:09 am    文章主題:  | 
				     | 
			 
			
				
  | 
			 
			
				原來是這篇的中譯版
 
 
==============
 
Knowledge Base  
 
 
HOWTO: Making Coolbar Interface Using Toolbar ActiveX ControlPSS ID Number: 192075
 
 
Article Last Modified on 7/29/1999
 
 
 
--------------------------------------------------------------------------------
 
The information in this article applies to:
 
 
 
Microsoft Visual FoxPro for Windows 5.0
 
Microsoft Visual FoxPro for Windows 5.0a
 
Microsoft Visual FoxPro for Windows 6.0
 
 
--------------------------------------------------------------------------------
 
 
This article was previously published under Q192075
 
SUMMARY
 
This article describes how to create a Coolbar like interface using the Microsoft Toolbar Version 6.0 ActiveX control. 
 
MORE INFORMATION
 
The Coolbar interface is an interface where the buttons highlight only when the user moves the mouse over them, like the behavior in Internet Explorer version 4.0. 
 
 
The main property to make a Coolbar like button is the Style property of the Toolbar active control. The default value of the Style property is "0 [ASCII 150] Standard" button. Changing this property to "1 [ASCII 150] Transparent" provides Coolbar like button behavior. 
 
Example
 
Create a program file and place the following code in the file: 
 
 
      PUBLIC x
 
      x=CREATEOBJECT("myform")
 
      x.SHOW
 
 
 
      **************************************************
 
      * myform - Class Definition
 
      **************************************************
 
      DEFINE CLASS myform as Form
 
         ADD OBJECT myclass1 AS myclass
 
         ADD OBJECT check1 AS checkbox WITH;
 
            Top = 150,;
 
            Left = 50,;
 
            Height = 50,;
 
            Caption = "CoolBar"
 
 
         PROCEDURE check1.Click
 
            DO CASE
 
               CASE This.value = 0
 
                  && Changing the Toolbar to look like Coolbar.
 
                  Thisform.myclass1.OBJECT.Style = 0
 
               CASE This.value = 1
 
                  && Changeing the Toolbar to Standard Toolbar.
 
                  Thisform.myclass1.OBJECT.Style = 1
 
            ENDCASE
 
         ENDPROC
 
 
         PROCEDURE myclass1.ButtonClick
 
         *** ActiveX Control Event ***
 
         LPARAMETERS button
 
            DO CASE
 
               CASE Button.key = "One"
 
                  WAIT WINDOW "Test1"
 
               CASE Button.key = "Two"
 
                  WAIT WINDOW "Test2"
 
               CASE Button.key = "Three"
 
                  WAIT WINDOW "Test3"
 
            ENDCASE
 
         ENDPROC
 
 
         PROCEDURE myclass1.ButtonMenuClick
 
         *** ActiveX Control Event ***
 
         LPARAMETERS buttonmenu
 
            DO CASE
 
               CASE buttonmenu.key = "One"
 
                  WAIT WINDOW "SubOne"
 
               CASE buttonmenu.key = "Two"
 
                  WAIT WINDOW "SubTwo"
 
            ENDCASE
 
         ENDPROC
 
 
      ENDDEFINE
 
 
      *-- EndDefine: myform
 
      **************************************************
 
 
      **************************************************
 
      * myclass - Class Definition
 
      **************************************************
 
      DEFINE CLASS myclass AS olecontrol
 
 
         #DEFINE tbrDEFAULT 0      && (Defaul) Button
 
         #DEFINE tbrCHECK   1      && CheckBox
 
         #DEFINE tbrBUTTONGROUP 2  && ButtonGroup
 
         #DEFINE tbrSEPARATOR 3    && Separator
 
         #DEFINE tbrPLACEHOLDER 4  && Placeholder
 
         #DEFINE tbrDROPDOWN 5     && MenuButton DropDown
 
 
         Top = 0
 
         Left = 0
 
         Height = 38
 
         Width = 375
 
         Align = 1
 
         Name = "Olecontrol1"
 
         OleClass = "MSComCtlLib.Toolbar.2"
 
 
         PROCEDURE Init
 
           This.Buttons.Add(,"One","Test1",,)
 
           This.Buttons.Add(,"Two","Test2",,)
 
           This.Buttons.Add(,"Spr",,tbrSEPARATOR,)
 
           This.Buttons.Add(,"Three","Test3",tbrDROPDOWN,)
 
           This.Buttons(4).ButtonMenus.Add(1,"One","SubOne")
 
           This.Buttons(4).ButtonMenus.Add(2,"Two","SubTwo")
 
         ENDPROC
 
 
      ENDDEFINE
 
 
      *-- EndDefine: myclass
 
      **************************************************
 
								
 
 
REFERENCES
 
Refer to Toolbar Active Control help in Cmctl198.chm for additional information about Toolbar Active Control. 
 
 
 
Additional query words: kbVFp500a kbVFp500 kbVFp600 kbActiveX
 
 
Keywords: kbhowto KB192075 
 
Technology: kbAudDeveloper kbVFP500 kbVFP500a kbVFP600 kbVFPsearch 
 
 
 
 
--------------------------------------------------------------------------------
 
 
Send feedback to Microsoft
 
 
© 2004 Microsoft Corporation. All rights reserved. _________________ 如果公司有下列困擾:
 
1. 找不到便宜,快速,簡易的 生產排程軟體
 
2. 不知道如何快速排定 採購計劃
 
3. 成本抓不準,自己算比軟體算有用
 
4. 想學習系統規劃,想找系統架構的顧問
 
 
請聯絡我們,也許我們幫得上忙 | 
			 
		  | 
	 
	
		| 回頂端 | 
		 | 
	 
	
		  | 
	 
	
		syntech
 
 
  註冊時間: 2003-05-16 文章: 4252 來自: Taipei,Taiwan
  第 5 樓
  | 
		
			
				 發表於: 星期一 四月 12, 2004 11:23 am    文章主題:  | 
				     | 
			 
			
				
  | 
			 
			
				變成vfp ole controls 方式:
 
開啟 [options][controls]選[ActiveX controls],
 
選擇 Microsoft Toolbar Controls , Version 6.0 
 
(我的系統另外有 5.0 sp2,差異處請自行找尋)
 
 
當你加上form上時,
 
就會出現多一個 toolbar properties 可以調整內容,
 
ylong 兄,您要的東東就在上面 _________________ 如果公司有下列困擾:
 
1. 找不到便宜,快速,簡易的 生產排程軟體
 
2. 不知道如何快速排定 採購計劃
 
3. 成本抓不準,自己算比軟體算有用
 
4. 想學習系統規劃,想找系統架構的顧問
 
 
請聯絡我們,也許我們幫得上忙 | 
			 
		  | 
	 
	
		| 回頂端 | 
		 | 
	 
	
		  | 
	 
	
		ylong
 
 
  註冊時間: 2003-07-30 文章: 118
 
  第 6 樓
  | 
		
			
				 發表於: 星期二 四月 13, 2004 11:40 am    文章主題:  | 
				     | 
			 
			
				
  | 
			 
			
				| 謝謝指教 | 
			 
		  | 
	 
	
		| 回頂端 | 
		 | 
	 
	
		  | 
	 
	
		 | 
	 
 
  
  	 
	    
  	   | 
 	
您 無法 在這個版面發表文章 您 無法 在這個版面回覆文章 您 無法 在這個版面編輯文章 您 無法 在這個版面刪除文章 您 無法 在這個版面進行投票 您 無法 在這個版面附加檔案 您 無法 在這個版面下載檔案
  | 
   
  
		 |