Results 1 to 40 of 4215

Thread: CommonControls (Replacement of the MS common controls)

Hybrid View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,742

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Karl77 View Post
    The border is not wanted, it makes problems when the control is nested in another control (statusbar in this case).

    I'll try to change it myself, now as I know where to look.
    Otherwise we would need a Border property...
    It's difficult to have no border as it's back always when the control size has been changed.

  2. #2
    Fanatic Member
    Join Date
    Apr 2015
    Posts
    536

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    It's difficult to have no border as it's back always when the control size has been changed.
    Yes, I experienced this too.
    Solution seems to be simple:

    Code:
    Public Property Let VisualStyles(ByVal Value As Boolean)
    PropVisualStyles = Value
    If ProgressBarHandle <> 0 And EnabledVisualStyles() = True Then
        Dim dwExStyle As Long, dwExStyleOld As Long
        dwExStyle = GetWindowLong(hWnd, GWL_EXSTYLE)
        dwExStyleOld = dwExStyle
        If PropVisualStyles = True Then
            ActivateVisualStyles ProgressBarHandle
            If (dwExStyle And WS_EX_STATICEDGE) = WS_EX_STATICEDGE Then dwExStyle = dwExStyle And Not WS_EX_STATICEDGE
        Else
            RemoveVisualStyles ProgressBarHandle
            If Not (dwExStyle And WS_EX_STATICEDGE) = WS_EX_STATICEDGE Then
                dwExStyle = dwExStyle And Not WS_EX_STATICEDGE
            End If
        End If
        'If dwExStyle <> dwExStyleOld Then
        SetWindowLong ProgressBarHandle, GWL_EXSTYLE, dwExStyle
        Call ComCtlsFrameChanged(ProgressBarHandle)
        'End If
        Me.Refresh
    End If
    UserControl.PropertyChanged "VisualStyles"
    End Property
    EDIT:
    This is also the place where a Border property could snap to.
    Last edited by Karl77; Dec 2nd, 2016 at 12:46 PM.

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,742

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Karl77 View Post
    Yes, I experienced this too.
    Solution seems to be simple:

    Code:
    Public Property Let VisualStyles(ByVal Value As Boolean)
    PropVisualStyles = Value
    If ProgressBarHandle <> 0 And EnabledVisualStyles() = True Then
        Dim dwExStyle As Long, dwExStyleOld As Long
        dwExStyle = GetWindowLong(hWnd, GWL_EXSTYLE)
        dwExStyleOld = dwExStyle
        If PropVisualStyles = True Then
            ActivateVisualStyles ProgressBarHandle
            If (dwExStyle And WS_EX_STATICEDGE) = WS_EX_STATICEDGE Then dwExStyle = dwExStyle And Not WS_EX_STATICEDGE
        Else
            RemoveVisualStyles ProgressBarHandle
            If Not (dwExStyle And WS_EX_STATICEDGE) = WS_EX_STATICEDGE Then
                dwExStyle = dwExStyle And Not WS_EX_STATICEDGE
            End If
        End If
        'If dwExStyle <> dwExStyleOld Then
        SetWindowLong ProgressBarHandle, GWL_EXSTYLE, dwExStyle
        Call ComCtlsFrameChanged(ProgressBarHandle)
        'End If
        Me.Refresh
    End If
    UserControl.PropertyChanged "VisualStyles"
    End Property
    EDIT:
    This is also the place where a Border property could snap to.
    What does that solve when resizing?
    You changed the part on RemoveVisualStyles, but there is an error on your change.

    Code:
            RemoveVisualStyles ProgressBarHandle
            If Not (dwExStyle And WS_EX_STATICEDGE) = WS_EX_STATICEDGE Then
                dwExStyle = dwExStyle And Not WS_EX_STATICEDGE
            End If
    Should be:
    Code:
            RemoveVisualStyles ProgressBarHandle
            If (dwExStyle And WS_EX_STATICEDGE) = WS_EX_STATICEDGE Then
                dwExStyle = dwExStyle And Not WS_EX_STATICEDGE
            End If
    As you want no border in both cases.
    Last edited by Krool; Dec 2nd, 2016 at 01:00 PM.

  4. #4
    Fanatic Member
    Join Date
    Apr 2015
    Posts
    536

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    What does that solve when resizing?
    Apparently it works, no border comes back on resize.
    Try it...

    As you want no border in both cases.
    Not exactly, I don't want the border in classic style only.

    Karl
    Last edited by Karl77; Dec 3rd, 2016 at 10:51 AM.

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