Update released.
Included the TextIndent/PictureIndent property of a Panel in the StatusBar control.
This allows to fine-tune the placement or to give some extra space in-between for a child control on a panel.
Printable View
Update released.
Included the TextIndent/PictureIndent property of a Panel in the StatusBar control.
This allows to fine-tune the placement or to give some extra space in-between for a child control on a panel.
Any suggestion how to rapidly fill a treeview?
E.g. in the procedure _Expand() add 100000 children takes quite some time.
Thanky you, Chris
VBCCR 1.8.83
hi Krool,
the header of the calendar is truncated when setting VisualStyles=false
Attachment 195921
Side question : how do you get the calendar in dark mode ?
Good catch. That only happens from comctl 6.1 onwards. (Vista+)
In fact it is a MS bug as the dropdown does not resize when unthemed. For the default font it is just luck that it fits somewhat. (but not perfect)
Also found another bug that CalendarFont is only read from property bag but not written properly to it. Means it can't be set at design time.
Will fix both issues soon.
Check this thread for VB6 & DarkMode: https://www.vbforums.com/showthread.php?t=900444
VBCCR v1.8.86
Its fixed:
Attachment 195928
Thx Krool!
VBCCR 1.8.86
Hi Krool,
i guess i maybe found another bug in the DTPicker-Control:
I set AllowUserInput=FALSE but the user still can modify the date in the editbox.
DTPicker1_CalendarGetDayBold -> SetDayState function has bold state setting bug, when trying to set bold state other than sunday ie. midweek/public holidays.
fex. Good Friday and if New Years's Day is in mid week.
Bold state seems to be shifted by one day earlier. Sundays work ok.Attachment 195931
Attached is screenshot see that Good Friday is shifted, likewise May Day. OS has Finnish calendar settings.
AllowUserInput = FALSE does not mean it is locked. It's just that when you press F2 or click on it there is no custom user input possible via ParseUserInput event.
Can't replicate. See my code below works.. it would be maybe less confusing if the State() array would be zero-based and not one-based. But that is now impossible to change..
Code:Private Sub DTPicker1_CalendarGetDayBold(ByVal StartDate As Date, ByVal Count As Long, State() As Boolean)
Dim i As Long
For i = 1 To Count
Select Case DateAdd("d", i - 1, StartDate)
Case #4/3/2026#, #5/1/2026#
State(i) = True
End Select
Next i
End Sub
When using 'i-1' computation. midweek/public holidays are ok, but weekends not, as shifted by one day.
Attachment 195934Code:Private Sub dtDeliverydate_CalendarGetDayBold(ByVal StartDate As Date, ByVal Count As Long, State() As Boolean)
Dim i As Long
Dim dtDate As Date
For i = 1 To Count
'dtDate = DateAdd("d", i, StartDate)
dtDate = DateAdd("d", i - 1, StartDate)
If Weekday(dtDate, vbMonday) = vbSunday Then State(i) = True
If Weekday(dtDate, vbMonday) = vbSaturday Then State(i) = True
If IsArkiPyha(dtDate) Then
'State(i) = True 'Bug...
'If i < Count Then State(i + 1) = True 'Bug correction. 'Bold state setting seems to be shifted by one day earlier. Weekends (Saturdays and Sundays) work ok.>
If i < Count Then State(i) = True
End If
Next i
End Sub
Expand/show MonthView over one month and close it to display just one month, selected date range shifts.
Code:Dim mStartDate As Date
Dim mEndDate As Date
Private Sub MonthView1_MouseEnter()
Debug.Print "MonthView1_MouseEnter"
MonthView1.MonthColumns = 3
If IsDate(mStartDate) And IsDate(mEndDate) Then
Debug.Print "mStartDate = " & mStartDate
Debug.Print "mEndDate = " & mEndDate
Call MonthView1_SelChange(mStartDate, mEndDate)
MonthView1.Refresh 'Refresh, does not work correctly, when selected multiple months or month other than leftmost.
End If
End Sub
Private Sub MonthView1_MouseLeave()
Debug.Print "MonthView1_MouseLeave"
MonthView1.MonthColumns = 1
End Sub
Private Sub MonthView1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Debug.Print "MonthView1_MouseUp"
End Sub
Private Sub MonthView1_SelChange(ByVal StartDate As Date, ByVal EndDate As Date)
Debug.Print "MonthView1_SelChange - StartDate = " & StartDate & " EndDate = " & EndDate
mStartDate = StartDate
mEndDate = EndDate
lblOhje.Caption = "Selected date range = " & mStartDate & " - " & mEndDate
End Sub
VBCCR 1.8.86
Hi Krool,
when using the MonthView control with .VisualStyles=FALSE and changing .TitleBackColor the color of the font of the short weekday names under the Title is changed to .TitleBackColor too!
The weekday names are nearly invisible:
Attachment 195936
Both MonthViews have .VisualStyles=FALSE and i changed only the colors of the left control:
Is this a bug or why does the font under the Title uses the color of .TitleBackColor?Code:MonthView2.BackColor = gDarkMode_BackColor
MonthView2.ForeColor = vbYellow
MonthView2.TitleBackColor = gDarkMode_BackColor2
MonthView2.TitleForeColor = vbGreen
MonthView2.TrailingForeColor = vbWhite
It should use .TitleForeColor or have its one FontColor.
StartOfWeek in properties is 0.
I had presumed, that this means use system start of the week?
System start of the week is monday (Finnish regional settings).Code:Private Sub dtDeliverydate_CalendarGetDayBold(ByVal StartDate As Date, ByVal Count As Long, State() As Boolean)
Dim i As Long
Dim dtDate As Date
For i = 1 To Count
dtDate = DateAdd("d", i, StartDate)
If Weekday(dtDate, vbUseSystem) = vbSunday Then State(i) = True
If Weekday(dtDate, vbUseSystem) = vbSaturday Then State(i) = True
If IsArkiPyha(dtDate) Then
'State(i) = True 'Bug...
If i < Count Then State(i + 1) = True 'Bug correction. 'Bold state setting seems to be shifted by one day earlier. Weekends (Saturdays and Sundays) work ok.
End If
Next i
End Sub
Still needs one day adjustment in midweek/public holidays.
No worky...
Code:Dim i As Long
Dim dtDate As Date
For i = 1 To Count
dtDate = DateAdd("d", i - 1, StartDate)
If Weekday(dtDate, vbUseSystem) = vbSunday Then State(i) = True
If Weekday(dtDate, vbUseSystem) = vbSaturday Then State(i) = True
If IsArkiPyha(dtDate) Then State(i) = True ' = Arkipyhä / Mid woeekday/Public holiday
Next i
Thats the reason i switched to .VisualStyles=false because afaik there is no SetWindowTheme-call that changes the CalendarView to DarkMode.
See https://www.vbforums.com/showthread....=1#post5690100
ok, that works! no more user input:
Code:Public Declare Function SendMessageW Lib "user32" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Sub dtp1_BeforeUserInput(ByVal hWndEdit As Long)
Call SendMessageW(hWndEdit, &HCF, 1, ByVal 0&) 'EM_SETREADONLY
End Sub
Ok, understood. Thanks.
Code:dtDate = DateAdd("d", i - 1, StartDate)
If Weekday(dtDate) = vbSunday Then State(i) = True
If Weekday(dtDate) = vbSaturday Then State(i) = True
If IsArkiPyha(dtDate) Then State(i) = True ' = Arkipyhä / Mid weekday/Public holiday
When I try to apply Dark Mode to a MonthView object, I get grey lines/bars and ‘Today’s date’ is cropped. Here is the code I use:
Attachment 195944Code:With MonthView1
.VisualStyles = False
SetWindowTheme .hWnd, 0&, StrPtr("DarkMode::FileExplorerBannerContainer")
.BackColor = FRMBACKCOLOR
.ForeColor = FRMFORECOLOR
.TitleBackColor = FRMBACKCOLOR
.TitleForeColor = FRMFORECOLOR
End With
VBCCR 1.8.89
DTPicker-Control
Hi Krool,
any chance to get a .hwnd for the up/down-arrow-block when setting .UpDown=True to change this to DarkMode too?
Attachment 195955
:ehh:
Will we get this hWndUpDown-property when you release a new OCX because of a bug fix?
btw, i used this code:
and the result is:Code:SetWindowTheme DTPicker4.Hwnd, 0&, StrPtr("DarkMode::FileExplorerBannerContainer")
UpDownHandle = FindWindowEx(DTPicker4.Hwnd, 0&, "msctls_updown32", "")
SetWindowTheme UpDownHandle , 0&, StrPtr("DarkMode::FileExplorerBannerContainer")
Attachment 195962
looks not perfect because of the missing up/down arrows but better than before.
Hi Karl77, is this still relevant ?
You want the images to be drawn without selected state for the combo box and the dropdown list ?
I tested with the API-Hooking-basic-working-example (x86 and x64 [twinBASIC]) and it works. For example to temporarily hook ImageList_Draw on WM_PAINT and restore afterwards. In the hooked function we remove ILD_BLEND25 and ILD_BLEND50.
I could offer an in-built property to do the task. Just let me know. I can imagine that it may be a common problem when you have "color images" which you do not want distorted when selected. Like yours.
Use "DarkMode_Explorer" for the updown for better results.
Attachment 195966
Due to compatibility I cannot add all the time new features to OCX 1.8. Sometimes it is even impossible. The implemented hWndUpDown looks like this:
Code:#If VBA7 Then
Public Property Get hWndUpDown() As LongPtr
#Else
Public Property Get hWndUpDown() As Long
#End If
If DTPickerHandle <> NULL_PTR Then
If ComCtlsSupportLevel() >= 2 Then
Dim DTPI As DATETIMEPICKERINFO
DTPI.cbSize = LenB(DTPI)
SendMessage DTPickerHandle, DTM_GETDATETIMEPICKERINFO, 0, ByVal VarPtr(DTPI)
hWndUpDown = DTPI.hWndUD
Else
hWndUpDown = FindWindowEx(DTPickerHandle, NULL_PTR, StrPtr("msctls_updown32"), NULL_PTR)
End If
End If
End Property