|
-
Nov 12th, 1999, 10:25 PM
#1
Thread Starter
New Member
MS Paint displays a pallet of solid colors where the user is able to point and click.
I have been trying to reproduce such in VB, but have had no success?
I have:
- Created a Box using the Line method and FillColor property.
- Used the Text control and its BackColor property to change colors.
When using a Text control and its BackColor property, I am able to view black, blue, green, cyan, red, magenta, yellow, white, gray, but when equating dark red (&H00008B), the text box isn't solid in looking rather 'pixelized'?
I have noticed when setting a Text box BackColor from its properties - the colors shown from its pallet isn't solid?
I would like to view colors as solid colors as MS pallet is shown.
Thank you,
deDogs
-
Nov 12th, 1999, 10:40 PM
#2
Hyperactive Member
Here, I made a 10 color palette for you:
Start with an empty form (you'll see why), with two labels: Label1(0) and Label2
Make sure that Label1 has an index of 0
Code:
Dim Colors(0 To 9)
Private Sub Form_Load()
Colors(0) = vbWhite
Colors(1) = vbRed
Colors(2) = vbBlue
Colors(3) = vbBlack
Colors(4) = vbGreen
Colors(5) = vbYellow
Colors(6) = vbCyan
Colors(7) = vbMagenta
Colors(8) = RGB(123, 123, 123)
Colors(9) = RGB(255, 123, 0)
Dim Num As Integer
Dim y As Long
With Label1(0)
.Width = 255
.BackColor = Colors(0)
y = .Width
.Left = 0
.Top = 0
End With
For Num = 1 To 9
Load Label1(Num)
With Label1(Num)
.BackColor = Colors(Num)
.Visible = True
.Width = 255
.Left = y
.Top = 1
End With
y = y + 255
Next Num
End Sub
Private Sub Label1_Click(Index As Integer)
Label2.BackColor = Colors(Index)
End Sub
When you click on a color, Label2's BackColor changes to the color selected.
------------------
Tom Young, 14 Year Old
[email protected]
ICQ: 15743470
AIM: TomY10
PERL, JavaScript and VB Programmer
-
Nov 13th, 1999, 01:26 AM
#3
Thread Starter
New Member
Thank you Compwiz, but Colors(8) = RGB(123, 123, 123) and Colors(9) = RGB(255, 123, 0) when they are displayed in Label1, colored dots are also seen. They are not presented as a solid color? Why the colored dots?
I thank you for the help.
Thank you,
deDogs
-
Nov 13th, 1999, 01:37 AM
#4
Hyperactive Member
Well, on my screen, every thing is solid.
Although, I am running at:
1280x1024
with 16 bit colors.
-
Nov 13th, 1999, 02:06 AM
#5
Thread Starter
New Member
Thank you Compwiz, but Colors(8) = RGB(123, 123, 123) and Colors(9) = RGB(255, 123, 0) when they are displayed in Label1, colored dots are also seen. They are not presented as a solid color? Why the colored dots?
I thank you for the help.
Thank you,
deDogs
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
|