I can't see the OP in my newsreader, only quoted in Jon's reply.
Anyway, assuming the border is not 0 as Jon suggest, may well need to do a
Me.Repaint after changing the border colour. Personally I avoid both Repaint
and DoEvents unless absolutely necessary.
A better overall solution IMO is to use a label as the border which also
gives the option to resize the 'effective' border.
Add a Label to the form named Label1
Sub PicLabel(bFlag As Boolean)
Dim bdr As Single
Dim clr As Long
Me.Label1.ZOrder 1
If bFlag Then
bdr = 3
clr = RGB(255, 0, 0)
Else
bdr = 0.75
clr = 0
End If
With Me.Image1
Me.Label1.Move .Left - bdr, .Top - bdr, _
.Width + bdr * 2, .Height + bdr * 2
End With
Me.Label1.BackColor = clr
End Sub
Call PicLabel before showing the form, say in the Initialize event, with
bFlag True or False as required.
In Image1_Click() -
PicLabel (Me.Label1.BackColor = 0)
Regards,
Peter T
"Jon Peltier" wrote in message
...
What's Image1.BorderStyle? If it's 0 (fmBorderStyleNone), it doesn't
matter
what color you set, there's no border.
- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______
"Dave D-C" wrote in message
...
Hello,
I have an Image on a Userform that I want to flag/unflag
by changing the border color red/black. (Word97/WIN98)
Private Sub Image1_Click()
If Image1.BorderColor = RGB(0, 0, 0) Then
Image1.BorderColor = RGB(255, 0, 0)
TextBox1.Value = "red"
Else
Image1.BorderColor = RGB(0, 0, 0)
TextBox1.Value = "blk"
End If
DoEvents ' doesn't fix it
End Sub
The text "red"/"blk" works, but the color doesn't change.
"DoEvents" was a feeble try.
TIA, Dave
----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet
News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+
Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption
=----