Results 1 to 6 of 6

Thread: RGB saved colours thing ?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2001
    Posts
    364

    RGB saved colours thing ?

    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
    Richard <><

  2. #2
    Software Eng. Megatron's Avatar
    Join Date
    Mar 1999
    Location
    Canada
    Posts
    11,286
    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

  3. #3
    Software Eng. Megatron's Avatar
    Join Date
    Mar 1999
    Location
    Canada
    Posts
    11,286
    See this link for information on saving to the registry.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2001
    Posts
    364
    ok, but how can they give the colour a name then, in a menu the colour names appear ?
    Richard <><

  5. #5
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246
    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
    Last edited by «°°phReAk°°»; Oct 11th, 2002 at 07:25 AM.

    Visual Studio 6, Visual Studio.NET 2005, MASM

  6. #6
    Software Eng. Megatron's Avatar
    Join Date
    Mar 1999
    Location
    Canada
    Posts
    11,286
    Originally posted by richsmith
    ok, but how can they give the colour a name then, in a menu the colour names appear ?
    Shouldn't be too hard. You can even create a UDT for it e.g.
    Code:
    Private Type tColor
        sName As String
        Red As Integer
        Green As Integer
        Blue As Integer
    End Type

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width