Solved

raised and sunken effect of icon

Posted on 1998-12-23
5
222 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
Comment Utility
try to change the icon to another raised one , when mouse over

0
 
LVL 13

Expert Comment

by:Mirkwood
Comment Utility
Make the picture 3d iso flat.
0
 
LVL 4

Accepted Solution

by:
CraigLazar earned 70 total points
Comment Utility
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
Comment Utility
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
Comment Utility
to mirkwood

my email account is tanyujin@usa.net
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

771 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

12 Experts available now in Live!

Get 1:1 Help Now