hi, i have a RGB colour thing with 3 slider bars and you can make different colours, is there a way to save a colour you like, give it a name then have a menu that has a submenu whith the saved colours in ?
please help
thanks
Printable View
hi, i have a RGB colour thing with 3 slider bars and you can make different colours, is there a way to save a colour you like, give it a name then have a menu that has a submenu whith the saved colours in ?
please help
thanks
You have 2 options.
1) Save it in the registry
2) Save it in a text file
To save a textfile.
Code:'r,g,b= the red, green, and blue values
Open "Myfile" for append as #1
print #1,r & "," & g & "," & b
close #1
See this link for information on saving to the registry.
ok, but how can they give the colour a name then, in a menu the colour names appear ?
Private Sub cmdSaveColor_Click()
Dim FileNum As Integer
FileNum = FreeFile
Open "C:\rgb.color" For Output As FileNum
Write #FileNum, HScroll1.Value
Write #FileNum, HScroll2.Value
Write #FileNum, HScroll3.Value
Close #FIleNum
End Sub
Private Sub cmdOpenColor_Click()
Open "C:\rgb.color" For Binary Access Read As #1
Input #1, r
Input #1, g
Input #1, b
Close #1
HScroll1.Value = r
HScroll2.Value = g
HScroll3.Value = b
Me.BackColor = RGB(r, g, b)
End Sub
That worked for me. It is also the same way i save line co-ordinates for drawings to make your own file types.
Hope that helped
Shouldn't be too hard. You can even create a UDT for it e.g.Quote:
Originally posted by richsmith
ok, but how can they give the colour a name then, in a menu the colour names appear ?
Code:Private Type tColor
sName As String
Red As Integer
Green As Integer
Blue As Integer
End Type