Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Userform Image Control and embedded images | Excel Programming | |||
Cycle through images on UserForm | Excel Discussion (Misc queries) | |||
Images in Userform? | Excel Programming | |||
Userform Images | Excel Programming | |||
Hide all images on userform | Excel Programming |