Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 =---- |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 =---- |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 =---- |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to fix my spreadsheet from showing formula to showing answer | Excel Discussion (Misc queries) | |||
Insert image by clicking on Usreform Image1 | Excel Programming | |||
Remove Picture from Image1 on a Userform | Excel Programming | |||
Userform problem, bordercolor not changing around images | Excel Programming | |||
Picture show in image1 | Excel Programming |