Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Userform problem, bordercolor not changing around images

I've set up a userform with 56 image controls on it, yes, it is a color
selector. I used a class to set up a routine for a "mouseover" type of
event, like when you're selecting a color in Excel's built-in color palette.
The problem is, after you've clicked on a color, and then click on a new
color, when you go back to the first color, the mouseover effect no longer
works. If I add a .repaint to the end of the mousemove event, it fixes the
problem, but that, of course, causes the userform to flash constantly.
Adding a .repaint to the just the click event had no effect. Here's the
code. I also have a mousemove event on the userform, which clears the
bordercolor around the images when the mouse is not over one. Commenting
that out had no effect. Any ideas what could be causing this? Maybe it
would be easier to use 56 toggle switches, but I would like to get the image
code working properly.

Option Explicit

Public WithEvents ImageEvents As MSForms.Image

Private Sub ImageEvents_Click()
Dim aCtrl As Control
Dim lngR As Long
Dim lngG As Long
Dim lngB As Long

GetRGB ImageEvents.BackColor, lngR, lngG, lngB

frmColors.txtRed.Value = lngR
frmColors.txtGreen.Value = lngG
frmColors.txtBlue.Value = lngB

For Each aCtrl In frmColors.Controls
If Left(aCtrl.Name, 5) = "Image" Then
If aCtrl.SpecialEffect = fmSpecialEffectSunken Then
aCtrl.SpecialEffect = fmSpecialEffectFlat
aCtrl.BorderStyle = fmBorderStyleSingle
aCtrl.BorderColor = 12632256
Exit For
End If
End If
Next aCtrl

ImageEvents.BorderStyle = fmBorderStyleNone
ImageEvents.SpecialEffect = fmSpecialEffectSunken

Set aCtrl = Nothing
End Sub

Private Sub ImageEvents_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
Dim aCtrl As Control

'default border color = 12632256
For Each aCtrl In frmColors.Controls
If Left(aCtrl.Name, 5) = "Image" Then
If aCtrl.BorderColor = 0 Then
aCtrl.BorderColor = 12632256
End If
End If
Next aCtrl

ImageEvents.BorderColor = 0

es:
Set aCtrl = Nothing
End Sub
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Userform Image Control and embedded images tim Excel Programming 13 April 5th 05 01:32 PM
Cycle through images on UserForm cdb Excel Discussion (Misc queries) 1 January 28th 05 12:46 AM
Images in Userform? RPIJG[_35_] Excel Programming 2 June 9th 04 05:55 PM
Userform Images nath Excel Programming 1 May 27th 04 12:39 PM
Hide all images on userform Jason Morin[_3_] Excel Programming 3 April 26th 04 09:20 PM


All times are GMT +1. The time now is 04:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"