-
Mar 20th, 2025, 03:39 PM
#1
Thread Starter
Addicted Member
[RESOLVED] Correct values to use to change form forcolor
Hi. I have the code below where I'm trying to change the forcolor of text but the compiler is telling me that integer cannot be converted to color. I tried RGB(xxx,xxx,xxx) but got the same results.
What is the correct answer to change the text forcolor? This code is being ported from VBA. I have both and ENUM version and a Hex version, and neither seem to work. Please advise.
Code:
If (InStr(szResult, "Yes") <> 0) Then
RISK_REPORTABLE_TXT.ForeColor = ENUM_CTRL_COLOR.eCOLOR_TXT_RED
FRM_RISK.ForeColor = RGB(255, 0, 0) '&HFF&
FRM_RISK.Enabled = True
RISK_REPORTABLE_TXT.Enabled = True
Else
RISK_REPORTABLE_TXT.ForeColor = ENUM_CTRL_COLOR.eCOLOR_TXT_BLACK
FRM_RISK.ForeColor = RGB(255, 255, 255) '&H80000012
FRM_RISK.Enabled = False
RISK_REPORTABLE_TXT.Enabled = False
End If
-
Mar 20th, 2025, 03:56 PM
#2
Re: Correct values to use to change form forcolor
To set forecolor to yellow:
FRM_RISK.ForeColor = Color.FromArgb(255, 255, 255, 0)
The first value is the "alpha" channel. 255 is fully opaque.
You can also use:
FRM_RISK.ForeColor = Color.Yellow
Intellisense will show you the large number of "preset" colors available.
Last edited by paulg4ije; Mar 20th, 2025 at 04:02 PM.
-
Mar 20th, 2025, 05:21 PM
#3
Thread Starter
Addicted Member
Re: Correct values to use to change form forcolor
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|