|
-
Jul 27th, 2006, 03:38 PM
#1
Thread Starter
PowerPoster
[RESOLVED] Select case problem
I have added a color chooser to my app, when there is text in a label caption, it should then change its color when its been selected. However, the text is disappearing on me.
The label is set to transparent but that should not matter at all. This is the select case I am using. Please advise as to what could be missing, and if the select case could be improved... thanks in advance.
VB Code:
Option Explicit
Private Sub Form_Load()
FormBackColor Me
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub pbColor_Click(Index As Integer)
With frmMain.lblText(m_intControlIndex)
Select Case pbColor(Index)
Case 0
.ForeColor = &HFFFFFF
Unload Me
Case 1
.ForeColor = &HC0C0FF
Unload Me
Case 2
.ForeColor = &HC0E0FF
Unload Me
Case 3
.ForeColor = &HC0FFFF
Unload Me
Case 4
.ForeColor = &HC0FFC0
Unload Me
Case 5
.ForeColor = &HFFFFC0
Unload Me
Case 6
.ForeColor = &HFFC0C0
Unload Me
Case 7
.ForeColor = &HFFC0FF
Unload Me
Case 8
.ForeColor = &HE0E0E0
Unload Me
Case 9
.ForeColor = &H8080FF
Unload Me
Case 10
.ForeColor = &H80C0FF
Unload Me
Case 11
.ForeColor = &H80FFFF
Unload Me
Case 12
.ForeColor = &H80FF80
Unload Me
Case 13
.ForeColor = &HFFFF80
Unload Me
Case 14
.ForeColor = &HFF8080
Unload Me
Case 15
.ForeColor = &HFF80FF
Unload Me
Case 16
.ForeColor = &HC0C0C0
Unload Me
Case 17
.ForeColor = &HFF&
Unload Me
Case 18
.ForeColor = &H80FF&
Unload Me
Case 19
.ForeColor = &HFFFF&
Unload Me
Case 20
.ForeColor = &HFF00&
Unload Me
Case 21
.ForeColor = &HFFFF00
Unload Me
Case 22
.ForeColor = &HFF0000
Unload Me
Case 23
.ForeColor = &HFF00FF
Unload Me
Case 24
.ForeColor = &H808080
Unload Me
Case 25
.ForeColor = &HC0&
Unload Me
Case 26
.ForeColor = &H40C0&
Unload Me
Case 27
.ForeColor = &HC0C0&
Unload Me
Case 28
.ForeColor = &HC000&
Unload Me
Case 29
.ForeColor = &HC0C000
Unload Me
Case 30
.ForeColor = &HC00000
Unload Me
Case 31
.ForeColor = &HC000C0
Unload Me
Case 32
.ForeColor = &H404040
Case 33
.ForeColor = &H80&
Unload Me
Case 34
.ForeColor = &H4080&
Unload Me
Case 35
.ForeColor = &H8080&
Unload Me
Case 36
.ForeColor = &H8000&
Unload Me
Case 37
.ForeColor = &H808000
Unload Me
Case 38
.ForeColor = &H800000
Unload Me
Case 39
.ForeColor = &H800080
Unload Me
Case 40
.ForeColor = &H0&
Unload Me
Case 41
.ForeColor = &H40&
Unload Me
Case 42
.ForeColor = &H404080
Unload Me
Case 43
.ForeColor = &H4040&
Unload Me
Case 44
.ForeColor = &H4000&
Unload Me
Case 45
.ForeColor = &H404000
Unload Me
Case 46
.ForeColor = &H400000
Unload Me
Case 47
.ForeColor = &H400040
Unload Me
End Select
End With
End Sub
-
Jul 27th, 2006, 03:44 PM
#2
Re: Select case problem
what are u using to pick the color? pictureboxes??
im hoping so... cause if u have 47 pictureboxes in an array and each has the backcolor set to the "color"
This will save u a lot of coding
VB Code:
Private Sub Picture1_Click(Index As Integer)
Label1.ForeColor = Picture1(Index).BackColor
End Sub
or in your case
VB Code:
Private Sub pbColor_Click(Index As Integer)
frmMain.lblText(m_intControlIndex).ForeColor = pbColor(Index).BackColor
End Sub
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Jul 27th, 2006, 04:02 PM
#3
Thread Starter
PowerPoster
Re: Select case problem
thanks static, that will definately sort out how to cut down the code (which i am never very good at) and its sorted out the problem of disappearing text. thanks !!
 Originally Posted by Static
what are u using to pick the color? pictureboxes??
im hoping so... cause if u have 47 pictureboxes in an array and each has the backcolor set to the "color"
This will save u a lot of coding
VB Code:
Private Sub Picture1_Click(Index As Integer)
Label1.ForeColor = Picture1(Index).BackColor
End Sub
or in your case
VB Code:
Private Sub pbColor_Click(Index As Integer)
frmMain.lblText(m_intControlIndex).ForeColor = pbColor(Index).BackColor
End Sub
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
|