Solved

raised and sunken effect of icon

Posted on 1998-12-23
5
225 Views
Last Modified: 2012-08-14
I have an image loaded with an icon. How do i make the effect so that the icon will have raised effect when the cursor is on it and will have the sunken effect if it is clicked?
0
Comment
Question by:eug
5 Comments
 
LVL 7

Expert Comment

by:Inteqam
ID: 1452125
try to change the icon to another raised one , when mouse over

0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1452126
Make the picture 3d iso flat.
0
 
LVL 4

Accepted Solution

by:
CraigLazar earned 70 total points
ID: 1452127
Hi
why don't you place the icon on a sherridan control button .
when the user presses the button , change the border thickness and style of the button . when the user presses another button change the firt button properties back to normal

good luck
Craig
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1452128
Here is a piece of code:
Save this code as a form. It will give some error since the frx file does not exist. I can send you the project if you give me your email or ICQ number.

VERSION 4.00
Begin VB.Form CoolbarForm
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Cool Bar"
   ClientHeight    =   1665
   ClientLeft      =   615
   ClientTop       =   1560
   ClientWidth     =   11040
   Height          =   2070
   Icon            =   "Cool Bar.frx":0000
   Left            =   555
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1665
   ScaleWidth      =   11040
   Top             =   1215
   Width           =   11160
   Begin VB.Frame CoolBarFrame
      Height          =   1350
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   10815
      Begin VB.Label CooLBarLabel
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "Cool Bar"
         Height          =   255
         Index           =   10
         Left            =   9840
         TabIndex        =   11
         Top             =   840
         Width           =   735
      End
      Begin VB.Image CoolBarImageBw
         Height          =   480
         Index           =   10
         Left            =   9960
         Picture         =   "Cool Bar.frx":030A
         Top             =   360
         Width           =   480
      End
      Begin VB.Image CoolBarImageColor
         Height          =   480
         Index           =   10
         Left            =   9960
         Picture         =   "Cool Bar.frx":0614
         Top             =   360
         Visible         =   0   'False
         Width           =   480
      End
      Begin VB.Image CoolBar
         Height          =   975
         Index           =   10
         Left            =   9720
         Top             =   240
         Width           =   975
      End
      Begin VB.Image CoolBarImageColor
         Height          =   480
         Index           =   9
         Left            =   9000
         Picture         =   "Cool Bar.frx":091E
         Top             =   360
         Visible         =   0   'False
         Width           =   480
      End
      Begin VB.Image CoolBarImageColor
         Height          =   480
         Index           =   8
         Left            =   8040
         Picture         =   "Cool Bar.frx":0C28
         Top             =   360
         Visible         =   0   'False
         Width           =   480
      End
      Begin VB.Image CoolBarImageColor
         Height          =   480
         Index           =   7
         Left            =   7080
         Picture         =   "Cool Bar.frx":0F32
         Top             =   360
         Visible         =   0   'False
         Width           =   480
      End
      Begin VB.Image CoolBarImageColor
         Height          =   480
         Index           =   6
         Left            =   6120
         Picture         =   "Cool Bar.frx":123C
         Top             =   360
         Visible         =   0   'False
         Width           =   480
      End
      Begin VB.Image CoolBarImageColor
         Height          =   480
         Index           =   5
         Left            =   5160
         Picture         =   "Cool Bar.frx":1546
         Top             =   360
         Visible         =   0   'False
         Width           =   480
      End
      Begin VB.Image CoolBarImageColor
         Height          =   480
         Index           =   4
         Left            =   4200
         Picture         =   "Cool Bar.frx":1850
         Top             =   360
         Visible         =   0   'False
         Width           =   480
      End
      Begin VB.Image CoolBarImageColor
         Height          =   480
         Index           =   3
         Left            =   3240
         Picture         =   "Cool Bar.frx":1B5A
         Top             =   360
         Visible         =   0   'False
         Width           =   480
      End
      Begin VB.Image CoolBarImageColor
         Height          =   480
         Index           =   2
         Left            =   2280
         Picture         =   "Cool Bar.frx":1E64
         Top             =   360
         Visible         =   0   'False
         Width           =   480
      End
      Begin VB.Image CoolBarImageColor
         Height          =   480
         Index           =   1
         Left            =   1320
         Picture         =   "Cool Bar.frx":216E
         Top             =   360
         Visible         =   0   'False
         Width           =   480
      End
      Begin VB.Image CoolBarImageColor
         Height          =   480
         Index           =   0
         Left            =   360
         Picture         =   "Cool Bar.frx":2478
         Top             =   360
         Visible         =   0   'False
         Width           =   480
      End
      Begin VB.Label CooLBarLabel
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "Mail"
         Height          =   255
         Index           =   9
         Left            =   8880
         TabIndex        =   10
         Top             =   840
         Width           =   735
      End
      Begin VB.Label CooLBarLabel
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "Font"
         Height          =   255
         Index           =   8
         Left            =   7920
         TabIndex        =   9
         Top             =   840
         Width           =   735
      End
      Begin VB.Label CooLBarLabel
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "Print"
         Height          =   255
         Index           =   7
         Left            =   6960
         TabIndex        =   8
         Top             =   840
         Width           =   735
      End
      Begin VB.Label CooLBarLabel
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "Favorites"
         Height          =   255
         Index           =   6
         Left            =   6000
         TabIndex        =   7
         Top             =   840
         Width           =   735
      End
      Begin VB.Label CooLBarLabel
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "Search"
         Height          =   255
         Index           =   5
         Left            =   5040
         TabIndex        =   6
         Top             =   840
         Width           =   735
      End
      Begin VB.Label CooLBarLabel
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "Home"
         Height          =   255
         Index           =   4
         Left            =   4080
         TabIndex        =   5
         Top             =   840
         Width           =   735
      End
      Begin VB.Label CooLBarLabel
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "Refresh"
         Height          =   255
         Index           =   3
         Left            =   3120
         TabIndex        =   4
         Top             =   840
         Width           =   735
      End
      Begin VB.Label CooLBarLabel
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "Stop"
         Height          =   255
         Index           =   2
         Left            =   2160
         TabIndex        =   3
         Top             =   840
         Width           =   735
      End
      Begin VB.Label CooLBarLabel
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "Forward"
         Height          =   255
         Index           =   1
         Left            =   1200
         TabIndex        =   2
         Top             =   840
         Width           =   735
      End
      Begin VB.Label CooLBarLabel
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "Back"
         Height          =   255
         Index           =   0
         Left            =   240
         TabIndex        =   1
         Top             =   840
         Width           =   735
      End
      Begin VB.Image CoolBarImageBw
         Height          =   480
         Index           =   9
         Left            =   9000
         Picture         =   "Cool Bar.frx":2782
         Top             =   360
         Width           =   480
      End
      Begin VB.Image CoolBarImageBw
         Height          =   480
         Index           =   8
         Left            =   8040
         Picture         =   "Cool Bar.frx":2A8C
         Top             =   360
         Width           =   480
      End
      Begin VB.Image CoolBarImageBw
         Height          =   480
         Index           =   7
         Left            =   7080
         Picture         =   "Cool Bar.frx":2D96
         Top             =   360
         Width           =   480
      End
      Begin VB.Image CoolBarImageBw
         Height          =   480
         Index           =   6
         Left            =   6120
         Picture         =   "Cool Bar.frx":30A0
         Top             =   360
         Width           =   480
      End
      Begin VB.Image CoolBarImageBw
         Height          =   480
         Index           =   5
         Left            =   5160
         Picture         =   "Cool Bar.frx":33AA
         Top             =   360
         Width           =   480
      End
      Begin VB.Image CoolBarImageBw
         Height          =   480
         Index           =   4
         Left            =   4200
         Picture         =   "Cool Bar.frx":36B4
         Top             =   360
         Width           =   480
      End
      Begin VB.Image CoolBarImageBw
         Height          =   480
         Index           =   3
         Left            =   3240
         Picture         =   "Cool Bar.frx":39BE
         Top             =   360
         Width           =   480
      End
      Begin VB.Image CoolBarImageBw
         Height          =   480
         Index           =   2
         Left            =   2280
         Picture         =   "Cool Bar.frx":3CC8
         Top             =   360
         Width           =   480
      End
      Begin VB.Image CoolBarImageBw
         Height          =   480
         Index           =   1
         Left            =   1320
         Picture         =   "Cool Bar.frx":3FD2
         Top             =   360
         Width           =   480
      End
      Begin VB.Image CoolBarImageBw
         Height          =   480
         Index           =   0
         Left            =   360
         Picture         =   "Cool Bar.frx":42DC
         Top             =   360
         Width           =   480
      End
      Begin VB.Image CoolBar
         Height          =   975
         Index           =   9
         Left            =   8760
         Top             =   240
         Width           =   975
      End
      Begin VB.Image CoolBar
         Height          =   975
         Index           =   8
         Left            =   7800
         Top             =   240
         Width           =   975
      End
      Begin VB.Image CoolBar
         Height          =   975
         Index           =   7
         Left            =   6840
         Top             =   240
         Width           =   975
      End
      Begin VB.Image CoolBar
         Height          =   975
         Index           =   6
         Left            =   5880
         Top             =   240
         Width           =   975
      End
      Begin VB.Image CoolBar
         Height          =   975
         Index           =   5
         Left            =   4920
         Top             =   240
         Width           =   975
      End
      Begin VB.Image CoolBar
         Height          =   975
         Index           =   4
         Left            =   3960
         Top             =   240
         Width           =   975
      End
      Begin VB.Image CoolBar
         Height          =   975
         Index           =   3
         Left            =   3000
         Top             =   240
         Width           =   975
      End
      Begin VB.Image CoolBar
         Height          =   975
         Index           =   2
         Left            =   2040
         Top             =   240
         Width           =   975
      End
      Begin VB.Image CoolBar
         Height          =   975
         Index           =   1
         Left            =   1080
         Top             =   240
         Width           =   975
      End
      Begin VB.Image CoolBar
         Height          =   975
         Index           =   0
         Left            =   120
         Top             =   240
         Width           =   975
      End
      Begin VB.Image ImgBackground
         Height          =   1200
         Left            =   60
         Picture         =   "Cool Bar.frx":45E6
         Top             =   120
         Width           =   10710
      End
   End
End
Attribute VB_Name = "CoolbarForm"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Private PrevButton

Sub ButtonDown(Index)

'* Make sure coolbar button doesn't resize again if user is repeatedly & quickly clicking
If CoolBar(Index).Height <> 975 Or CoolBar(Index).Width <> 975 Then
Exit Sub
End If

'* Shrink & move coolbar button to give impression of a button being pushed
CoolBarImageColor(Index).Left = CoolBarImageColor(Index).Left + 10
CoolBarImageColor(Index).Top = CoolBarImageColor(Index).Top + 10
CooLBarLabel(Index).Left = CooLBarLabel(Index).Left + 10
CooLBarLabel(Index).Top = CooLBarLabel(Index).Top + 10
CoolBar(Index).Left = CoolBar(Index).Left + 10
CoolBar(Index).Top = CoolBar(Index).Top + 10
CoolBar(Index).Height = CoolBar(Index).Height - 40
CoolBar(Index).Width = CoolBar(Index).Width - 40
   
End Sub

Sub ButtonUp(Index)

'* Make sure coolbar button doesn't resize again if user is repeatedly & quickly clicking
If CoolBar(Index).Height <> 935 Or CoolBar(Index).Width <> 935 Then
Exit Sub
End If

'* Expand & move coolbar button to give impression of a button being lifted
CoolBarImageColor(Index).Left = CoolBarImageColor(Index).Left - 10
CoolBarImageColor(Index).Top = CoolBarImageColor(Index).Top - 10
CooLBarLabel(Index).Left = CooLBarLabel(Index).Left - 10
CooLBarLabel(Index).Top = CooLBarLabel(Index).Top - 10
CoolBar(Index).Left = CoolBar(Index).Left - 10
CoolBar(Index).Top = CoolBar(Index).Top - 10
CoolBar(Index).Height = CoolBar(Index).Height + 40
CoolBar(Index).Width = CoolBar(Index).Width + 40
   
End Sub
Sub MoveMouse(Index)

'* If the mouse is no longer over the same button then make the previous buttons
'* grayscale icon visible and the color icon invisible and turn it's border off
If Index <> PrevButton Then
    On Error Resume Next
        CoolBar(PrevButton).BorderStyle = 0
        CoolBarImageBw(PrevButton).Visible = True
        CoolBarImageColor(PrevButton).Visible = False
End If
   
'* If mouse has moved to another button, update Prevbutton so that if mouse is
'* moved again program will know which button to change
    PrevButton = Index
   
'* If the mouse is on this button turn on the border for this button (image)
    CoolBar(Index).BorderStyle = 1
   
'* If mouse is on this button then make the grayscale icon invisible and make
'* the color icon visible
    CoolBarImageBw(Index).Visible = False
    CoolBarImageColor(Index).Visible = True

End Sub




Private Sub CoolBar_Click(Index As Integer)

' Do something here, placing function in title bar as example
CoolbarForm.Caption = "Cool Bar " + CooLBarLabel(Index).Caption

End Sub

Private Sub CoolBar_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)

'* User pressed a mouse button
ButtonDown (Index)

End Sub

Private Sub CoolBar_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
   
'* User moved the mouse pointer
MoveMouse (Index)

End Sub

Private Sub CoolBar_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
   
'* User released the mouse button
ButtonUp (Index)

End Sub

Private Sub CoolBarImageBw_Click(Index As Integer)

' Do something here, placing function in title bar as example
CoolbarForm.Caption = "Cool Bar " + CooLBarLabel(Index).Caption

End Sub

Private Sub CoolBarImageBw_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)

'* User pressed a mouse button
ButtonDown (Index)

End Sub

Private Sub CoolBarImageBw_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)

'* User moved the mouse pointer
MoveMouse (Index)

End Sub


Private Sub CoolBarImageBw_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)

'* User released the mouse button
ButtonUp (Index)

End Sub

Private Sub CoolBarImageColor_Click(Index As Integer)

' Do something here, placing function in title bar as example
CoolbarForm.Caption = "Cool Bar " + CooLBarLabel(Index).Caption

End Sub

Private Sub CoolBarImageColor_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)

'* User pressed a mouse button
ButtonDown (Index)

End Sub

Private Sub CoolBarImageColor_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
   
'* User moved the mouse pointer
MoveMouse (Index)

End Sub


Private Sub CoolBarImageColor_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)

'* User released the mouse button
ButtonUp (Index)

End Sub


Private Sub CooLBarLabel_Click(Index As Integer)

' Do something here, placing function in title bar as example
CoolbarForm.Caption = "Cool Bar " + CooLBarLabel(Index).Caption

End Sub

Private Sub CooLBarLabel_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)

'* User pressed a mouse button
ButtonDown (Index)

End Sub

Private Sub CooLBarLabel_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)

'* User moved the mouse pointer
MoveMouse (Index)

End Sub


Private Sub CooLBarLabel_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)

'* User released the mouse button
ButtonUp (Index)

End Sub


Private Sub Form_Load()
'**********************************************************
'* SUBJECT:     Coolbar                                   *
'* AUTHOR:      Mike Raymer                               *
'* DESCRIPTION: An example of how to creat a coolbar such *
'*              as the one in Internet Explorer without   *
'*              using a 3rd party control                 *
'**********************************************************

    CoolbarForm.Top = (Screen.Height - CoolbarForm.Height) \ 2
    CoolbarForm.Left = (Screen.Width - CoolbarForm.Width) \ 2

End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
   
'* If the mouse is on the form and not on a button, then turn off the border on the previous
'* button and make the grayscale icon visible and the color icon invisible
    On Error Resume Next
    CoolBar(PrevButton).BorderStyle = 0
    CoolBarImageBw(PrevButton).Visible = True
    CoolBarImageColor(PrevButton).Visible = False
    PrevButton = -1

End Sub




Private Sub ImgBackground_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

'* If the mouse is on the background and not on a button, then turn off the border on the previous
'* button and make the grayscale icon visible and the color icon invisible
    On Error Resume Next
    CoolBar(PrevButton).BorderStyle = 0
    CoolBarImageBw(PrevButton).Visible = True
    CoolBarImageColor(PrevButton).Visible = False
    PrevButton = -1

End Sub




0
 

Author Comment

by:eug
ID: 1452129
to mirkwood

my email account is tanyujin@usa.net
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Run code from text file in vb 1 64
Add and format columns in vb6 7 56
fso.FolderExists("\\server\HiddenFolder$") 4 64
Send outlook email from VBS Script 2 28
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now