Results 1 to 5 of 5

Thread: How can I specify one of my custom colors in code?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2002
    Location
    WISCONSIN
    Posts
    115

    How can I specify one of my custom colors in code?

    I would like to be able to change the color of a certain line on my form when an option button is clicked. The color is a custom color that I created. (you know, one of those that goes down in the extra white spaces in the pallette) Well anyway how can i make the line change to one of those colors when i click the option button.
    Thanks!
    Eric

  2. #2
    hellswraith
    Guest
    Are you talking about a "line" or are you talking about a line of text (Label).

    It's the same both ways, just use the .backcolor, .forecolor properties for the label and the .bordercolor for the line.

  3. #3
    Hyperactive Member
    Join Date
    Sep 2000
    Posts
    257
    use the RGB function....eg

    object.line (125,521)-(521,125),RGB(123,321,213)

    obviously you have to susbtitute the "(123,321,213)" with you custom colours(if you're american, then 'colors' )
    When I write my code, only God and I know what it means. But a week later, only God knows.

  4. #4
    hellswraith
    Guest
    forgot to include example:

    VB Code:
    1. Line.BorderColor = &H8080FF

    That's how you assign the color with Hex

  5. #5
    Frenzied Member
    Join Date
    Aug 2001
    Posts
    1,075
    If you are using the Line Control and the CommonDialog Control you set the BorderColor of the Line Control to the Color property of the CommonDialog control...

    VB Code:
    1. Private Sub Form_Load()
    2.     On Error Resume Next
    3.     CommonDialog1.CancelError = True
    4.     CommonDialog1.ShowColor
    5.     If Err.Number = cdlCancel Then Exit Sub
    6.     Line1.BorderColor = CommonDialog1.Color
    7. End Sub

    Greg
    Free VB Add-In - The Reference Librarian
    Click Here for screen shot and download link.

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