摘要载入中…    请稍等…












内容载入中…    请稍等…

如长时间看不到内容,请关闭浏览器,重新打开此页!

芯友首页 应用软件 编程开发 网络硬件 资源下载 动漫音乐 精美图库 芯友论坛 视频教程 电脑技术QQ群:72845454
 ★★photoshop学友-史上最强播放器★★
 位置:编程开发>VB>VB窗体文章
◎→ 本类最新
用VB6实现动态增减控件
VB实现窗口的弹出式菜单
VB6制作Win98风格的工具栏
用VB做个漂亮的进度条
用VB设计聚焦框程序
◎→相关资源
C语言入门视频教程
C#编程WinForm入门视频
Asp.net入门视频教程下载
VC++编程视频教程下载
VB窗体文章
HTML入门教程
VB基础视频教程
VB窗体文章
VB文件文章
VB数据库文章
VB-API文章
VB控制文章
◎→ 热门资源
Visual Basic 的数据库编程
VB自定义数据结构的传输转换
VB中远程数据库的访问
VB中将数据转换为数据库文件
VB中调用带参数存储过程的实现(数
VB中超长OLE数据库字段的操纵方法
VB应用程序访问SQL Server方法探

Cool 3D 浮動按鈕的模擬作法


日期:2008-10-20 18:12:06    来源:
   
 ·Flash,Dreamweaver实例视频教程软件下载

Cool 3D 浮動按鈕的模擬作法 VERSION 5.00 Begin VB.Form frmSimu3d Caption = "浮動按鈕模擬" ClientHeight = 1824 ClientLeft = 3108 ClientTop = 2472 ClientWidth = 2292 LinkTopic = "Form1" ScaleHeight = 1824 ScaleWidth = 2292 Begin VB.PictureBox picPaintBoard Height = 660 Left = 600 ScaleHeight = 612 ScaleWidth = 612 TabIndex = 0 Top = 600 Width = 660 End Begin VB.Image imgButton Height = 492 Left = 840 Top = 600 Width = 612 End End Attribute VB_Name = "frmSimu3d" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit '宣告儲存按鈕圖形的變數 Private ImageStore As StdPicture '宣告決定按鈕邊緣寬度的變數 Private BorderWidth As Single '宣告決定按鈕浮起程度的變數 Private PaintWidth As Integer Private Sub Form_Load() '載入圖形到圖形儲存變數內 Set ImageStore = LoadPicture(App.Path + "\midpic.bmp") 'imgButton 是用來做為替代按鈕顯示的一個 'ImageBox,這裏同時把按鈕圖設定給它 imgButton.Picture = ImageStore 'picPaintBoard 是一個 PictureBox,是用來作為圖形 '畫邊框的繪圖板 '因為 picPaintBoard 只是繪圖板,不須顯示 picPaintBoard.Visible = False 'AutoRedraw = True 才能作出 Image 的效果,供 'imgButton 顯示使用 picPaintBoard.AutoRedraw = True 'AutoSize = True 可以配合圖形改變大小 picPaintBoard.AutoSize = True 'ScaleMode 設為 Pixel ,有利於繪圖定位 picPaintBoard.ScaleMode = 3 '設定 imgButton 的邊緣寬度,數字愈大,邊緣寬度愈窄, '數字愈小,邊緣寬度愈厚。寬度愈窄,漏失 Mouse_Out 的可能 '愈大,寬度愈厚,要愈往中心才收得到 Mouse_In。所以要依按 '鈕圖大小做調整,圖愈小 BorderWidth 也要愈小,但不得小於 '2,小於 2 將不會產生 Mouse_In 的狀況 BorderWidth = 5 '浮起邊緣線的寬度,一般來說數字愈大浮起狀況愈明顯,但也要 '配合圖形大小,凸出太離譜就很醜了。 PaintWidth = 2 '設定imgButton的四個座標值 Me.ScaleMode = 3 imgRect.Top = imgButton.Top imgRect.Left = imgButton.Left imgRect.Right = imgRect.Left + imgButton.Width imgRect.Bottom = imgRect.Top + imgButton.Height Set theForm = Me 'Debug.Print imgRect.Left; imgRect.Top; imgRect.Right; imgRect.Bottom Me.ScaleMode = 1 End Sub '這是為按鈕圖浮凸邊框線的自訂方法,基本原理是就是用 'PictureBox 的 Line 在按鈕圖的四周畫明暗不同的線,達成立體的效果。 '1.浮凸:左邊、上邊用淺色,右邊、下邊用深色 '2.凹陷:左邊、上邊用深色,右邊、下邊用淺色 Public Sub SimuCool3D(ByVal Mode As Integer, Optional ByVal LineWidth As Integer) '參數說明: ' Mode 決定圖的凸起或凹陷 ' LineWidth 決定浮凸線寬度 '規定浮凸線寬度最小為 1 If LineWidth < 1 Then LineWidth = 1 End If '把繪線寬度及須繪製的邊框圖形指定給繪圖板 'picPaintBoard picPaintBoard.DrawWidth = LineWidth picPaintBoard.Picture = ImageStore '依 Mode 參數來決定繪浮凸圖或凹陷圖, 'Case 1 是畫浮凸圖 'Case 2 是畫凹陷圖 'Mode 0 則啥事也不做,維持原圖形 Select Case Mode Case 1 With picPaintBoard picPaintBoard.Line (.ScaleLeft + LineWidth, .ScaleTop + LineWidth)- _ (.ScaleWidth - LineWidth, .ScaleTop + LineWidth), &H80000005 picPaintBoard.Line -(.ScaleWidth - LineWidth, .ScaleHeight - LineWidth), &H8000000C picPaintBoard.Line -(.ScaleLeft + LineWidth, .ScaleHeight - LineWidth), &H8  [1]
Tags: 

芯友网版权所有 1999-2006 | 著作权与商标声明 | 法律声明 | 服务条款 | 隐私声明 | 联系我们