+ Reply to Thread
Results 1 to 4 of 4

Change label border color at runtime

  1. #1
    Registered User
    Join Date
    03-02-2006
    Posts
    17

    Change label border color at runtime

    Is there any way to change a label's border color at runtime? I use the following code to create two labels, one horizontal and the other vertical. They are designed to make a cross symbol wherever I click on an image control. This works great, but I need them to be red instead of the default grey.

    Set Lbl = Controls.Add("Forms.Label.1", "lblLabel" & NumAnnuli, True)
    With Lbl
    .Top = Y
    .Left = X - 6
    .Height = 1
    .Width = 12
    End With

    Set Lbl = Controls.Add("Forms.Label.1", "lblLabel" & NumAnnuli, True)
    With Lbl
    .Top = Y - 6
    .Left = X
    .Height = 12
    .Width = 1
    End With

  2. #2
    MrScience
    Guest

    Re: Change label border color at runtime

    try . . .

    With Lbl
    ..Top = Y
    ..Left = X - 6
    ..Height = 1
    ..Width = 12
    ..BackColor = vbRed


  3. #3
    MrScience
    Guest

    Re: Change label border color at runtime

    I can't believe it. This is the second time this evening I didn't read
    the question carefully enough. You wanted to change the border color,
    not the back color.

    Here you go . . .
    With Lbl
    ..Top = Y
    ..Left = X - 6
    ..Height = 1
    ..Width = 12
    ..BorderStyle = 1
    ..BorderColor = vbRed


    Sorry for the confusion.


  4. #4
    Registered User
    Join Date
    03-02-2006
    Posts
    17

    Thanks!

    Thanks a bunch! Both methods worked great!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1