Results 1 to 3 of 3

Thread: [VB6] - property reciving a strange values, when is used

  1. #1

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,966

    [VB6] - property reciving a strange values, when is used

    i have 1 property:
    Code:
    Public Property Get BorderSelectionColor() As OLE_COLOR
        BorderSelectionColor = lngBorderSelectionColor
    End Property
    
    Public Property Let BorderSelectionColor(ByVal vNewValue As OLE_COLOR)
        lngBorderSelectionColor = vNewValue
        Call ShowImage
        PropertyChanged "BorderSelectionColor"
    End Property
    
    Private Sub UserControl_ReadProperties(PropBag As PropertyBag)    
        BorderSelectionColor = PropBag.ReadProperty("BorderSelectionColor", 0)
    End Sub
    
    Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
       PropBag.WriteProperty "BorderSelectionColor", BorderSelectionColor, 0
    End Sub
    i change the property value in project mode and is saved. the problem is that, when i use it, the value is negative. can anyone advice me?
    VB6 2D Sprite control

    To live is difficult, but we do it.

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: [VB6] - property reciving a strange values, when is used

    Negative values are usually VB system colors (i.e., vbButtonFace for example).
    To convert a VB system color to a valid RGB color, you can use the GetSystColor API. The color code to pass to that api are stored in the 1st byte of the VB system color:
    Code:
    RGBcolor = GetSysColor(lngBorderSelectionColor And &HFF&)
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,966

    Re: [VB6] - property reciving a strange values, when is used

    Quote Originally Posted by LaVolpe View Post
    Negative values are usually VB system colors (i.e., vbButtonFace for example).
    To convert a VB system color to a valid RGB color, you can use the GetSystColor API. The color code to pass to that api are stored in the 1st byte of the VB system color:
    Code:
    RGBcolor = GetSysColor(lngBorderSelectionColor And &HFF&)
    yes.. that's true.. thanks for the information. but for see working i delete the manifestment file(that file for give XP style in VB 6 IDE). then i can use the pallete colors and works fine
    thanks for everything
    VB6 2D Sprite control

    To live is difficult, but we do it.

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