The problem is solved with v1.8.69! thanks :thumb:
Printable View
This is AWESOME. Time to get rid of the COMCTL32.OCX dependency!
Manifests didn't work in XP, CommonControl manifests are stricter there, Fixing manifest solves the issue, ResourceHacker template works.
Hello Krool!
Thank you so much for your great dedication. I've been using your controls for years.
Bug Reports:
An error occurs if the value of ImageCombo1.FindItem(100) is greater than 99 (3 digits or more in length). Normal within 2 digits.
Attachment 194948
Code:
Private Sub Form_Load()
Dim i As Long
For i = 99 To 110
ImageCombo1.ComboItems.Add , CStr(i), CStr(i)
Next
'OK
Debug.Print ImageCombo1.FindItem(99).Text
Debug.Print ImageCombo1.FindItem(99).Key
'Error
Debug.Print ImageCombo1.FindItem(100).Text
Debug.Print ImageCombo1.FindItem(100).Key
ImageCombo1.ComboItems.Clear
'OK
ImageCombo1.ComboItems.Add , "AB", "AB"
Debug.Print ImageCombo1.FindItem("AB").Text
''Error
ImageCombo1.ComboItems.Add , "ABC", "ABC"
Debug.Print ImageCombo1.FindItem("ABC").Key
End Sub
Private Sub ImageCombo1_Click()
MsgBox ImageCombo1.Text
End Sub
smileyoufu,
Thanks for reporting this. Update released.
It looks like some CB_ message are now suddenly not working properly anymore when sending directly to the inner combo handle. For example CB_GETLBTEXT stops after the 2nd char while CB_GETLBTEXTLEN returns the correct length.
I checked those messages and are now sent to the superclass window (ComboBoxEx) which handles the result correctly. They also work then on comctl version 5.8x and 6.0 [XP] even though the bug appears to happen only as of comctl version 6.1 [Vista+].
Update released.
MultiSelect property does not enforce anymore possible selection change in the ListView control. (like MS ListView)
This means that when having 5 items selected and turning off the MultiSelect property then those 5 items stay selected instead of immediately reducing it to 1 item.
Hi, Krool!
Does your Font Common Dialog provide a way to change the sample text? The default "AaBbYyZz" is Ok but if a way to change it is already implemented it would be nice to have it exposed. If it's not implemented then never mind, it isn't important.
Hi Krol,
I have the follwoing problem when loading VBCCR controls at runtime
1. Show a standard Form
3. Then add a VBBCR17 control at runtime,
either an control array:
or withCode:Load Labels(i)
Labels(i).Visible = True
In the IDE this works fine, but on runtime error 13 (type mismatch) occurs.Code:Dim NewLabel as LabelW
...
Set NewLabel = Me.controls.Add("LabelW", "NewLabel", Me
MyLabel.Visible = True
This is related to my manifest. Without that manifest / res file it works fine
Any idea what might cause this?
Example project:
Attachment 195066
(
When I change the definition of NewLabel to
it works as well.Code:Dim NewLabel As Control
but e.g.
causes an compile errorCode:Dim WithEvents NewTextBox As Control
)
Hello Krool!
Thank you so much for helping me!
ListBoxW,Error reports:
In the IDE properties, if you manually set ListBoxW2.Height = 290, the Height result will change to 280.
Set ListBoxW2.Height = 260, and the Height result will change to 256.
The same problem exists with the way you use the drag and drop control.
Thanks again.
Attachment 195113
Attachment 195114
Attachment 195115
Attachment 195116
Question for Krool or any other users of Krool's checkbox/option box replacements. I am fairly sure I know the answer already but it is worth asking.
re: this request on the TwinBasic issues list: https://github.com/twinbasic/twinbasic/issues/2174
I am looking for a checkbox control that can be resized, not just the width/height of the overall control including the caption field but the check box itself.
When rescaling a form for large monitor sizes, the current VB6 checkboxes and optionboxes remain the same size tiny efforts, looking rather puny on an up-scaled form.
There seem to be very few 3rd party alternatives to the standard VB6/Windows checkbox so I am digging for a replacement that can do the job I require. Krool's checkbox seems to be a good place to start.
So, can the checkbox graphic be made to scale in size in ratio to the form itself?
This image shows the problem, see the tiny option and check boxes?
https://www.vbforums.com/images/ieimages/2025/07/3.jpeg
If you could take this as the first stage of a feature request to allow additional such resizing of the checkbox and option buttons, the only VB6 controls that do not rescale correctly in my experience.
FYI TwinBasic offers a scalable checkbox without a caption. We are almost there.
Your thoughts.
Is your app marked as DpiAware ? Normally the checkbox size is fixed (13×13) but will scale to your dpi factor.
So I am wondering why it doesn't in your app.
Yes, DPI aware. Desktop scaling is disabled. All forms appear at a normal 100%.
The scaling performed above is being performed in code to allow a form to be scaled dynamically by dragging the corner up or down to resize. All controls are anchored and during a resize event are sized by proportion to the scaling of the whole form.
This means you can scale a form independently of the desktop and have a form at any chosen size you require.
The following image shows very similar forms scaled to size manually using the above method.
https://www.vbforums.com/images/ieimages/2025/07/4.jpeg
The only control that does not size 'correctly' are the check and option buttons.
First set the DrawMode property to OwnerDraw. Now you can draw your own control in the OwnerDraw event of the control:
With the provided hDC and the control sizes you can use APIs to draw anything inside the the control.Code:Private Sub CheckBox_OwnerDraw(ByVal Action As Long, ByVal State As Long, ByVal hDC As Long, ByVal Left As Long, ByVal Top As Long, ByVal Right As Long, ByVal Bottom As Long)
End Sub
Yup, I've been doing some research myself. I'm not going to proceed down this path as it is a workaround at best. What I am looking for is for the two controls, the option buttons and checkboxes to scale by default. Reason I am saying this is that it would be, in my opinion, a very useful default property to allow VB6 forms to be scaled dynamically without Windows desktop scaling being enabled.
The images above show all the controls successfully scaled except for these two failing controls.
We are now in the time of large 4K+ monitors that make VB6 apps look puny in size. A simple rescale of the form means that VB6 apps can now suit any size monitor without affecting desktop default scaling settings, that can have an adverse effect on other apps.
You only can archive this goal if you draw your own control using OwnerDraw....
check the VBCCR source code, there is plenty of code how to draw your own controls.
See CheckBoxW.ctl -> WindowProcUserControl -> DrawThemeBackground (this api draws for example the checkbox)
Hi Krool,
i have a problem with the "RightToLeft" property of your controls. For example:
when i set RightToLeft=TRUE only the caption text moves to the right but the checkbox or optionbutton not.
Normally the checkbox or optionbutton should be displayed on the right side of the caption text.
Is this bug or how can i solve this?
Attachment 195148
As I said, this is at best a workaround, so I will wait until this is achieved in the base controls, if it isn't then I won't use the control. I do have another workaround in any case.
The issue is that VB6 programs running on 4K+monitors look increasingly puny, you cannot rely on desktop scaling as it has a potential effect on other programs and in any case, I never trust any feature provided by Microsoft to survive very long, deprecation or change...
Also, factor in that running VB6 programs on emulators or via Wine on non-Windows systems means that desktop scaling of controls may simply not be available.
VB6 programs have the possibility to stand on their own using manual scaling but only if the core controls can scale in ratio to the form. Only these tow fail to do so. I am sure that it will be incorporated into the Krool's controls sometime in the future, scaling is a benefit. I just see it as a matter of time - and as I said, I have a workaround.
FrameW will not let you edit controls within the frame in design mode if it's disabled
Hi Krool,
i have a strange problem with the RichTextBox control:
Normally i can start editing the text after loading a text file into the RichTextBox but with some text files "Editing" is like locked:
1. I click with the mouse somewhere random in the RichTextBox and start typing but nothing happen.
2. I ONLY can select some amount of chars of some random text and after that i can exactly type this amount of chars anywhere in the Richtextbox!
It is like that the normal Edit-Mode is internally locked and only some kind of text-replace-mode is available!
All text files are stored with UTF-16 BOM and have the same access rights and attributes.Code:RichTextBox1.LoadFile sTextFile, RtfLoadSaveFormatUnicodeText
RichTextBox1.Enabled=True
RichTextBox1.Locked=False
RichTextBox1.AllowOverType=False
RichTextBox1.OverTypeMode=False
RichTextBox1.TextMode=1
Any ideas how to fix this strange editing problem?
I found a solution to fix this problem:
i had to set the property "MaxLength" from 0 to 200.000 to enter more text.
The amount of characters in the loaded text files is always below 200.000 chars.
Can you explain how "0" limits the amount of chars you can enter?
OK, i think i got it now! I found this info:
"When this property is set to 0, the maximum length of the text that can be entered in the control is 64 KB of characters. You can use this property to restrict the length of text entered in the control."
I thought 0 means unlimited or the maximum available amount...
VBCCR 1.8.77 VB6SP6
GetLineCount returns 5 using the following text in a Richtextbox and using .ScrollBars = vbBoth:
GetLineCount returns 12 after setting rtfLang.ScrollBars = vbVertical to word wrap the text.Code:Whereas recognition of the inherent dignity and of the equal and inalienable rights of all members of the human family is the foundation of freedom, justice and peace in the world,
Whereas disregard and contempt for human rights have resulted in barbarous acts which have outraged the conscience of mankind, and the advent of a world in which human beings shall enjoy freedom of speech and belief and freedom from fear and want has been proclaimed as the highest aspiration of the common people,
Whereas it is essential, if man is not to be compelled to have recourse, as a last resort, to rebellion against tyranny and oppression, that human rights should be protected by the rule of law,
Whereas the peoples of the United Nations have in the Charter reaffirmed their faith in fundamental human rights, in the dignity and worth of the human person and in the equal rights of men and women and have determined to promote social progress and better standards of life in larger freedom,
Whereas Member States have pledged themselves to achieve, in cooperation with the United Nations, the promotion of universal respect for and observance of human rights and fundamental freedoms,
Is this a bug?
How can i get the "real" LineCount of 5 to use .GetLine(i) to get the 5 lines without the word wrap?
Then you want the number of hard line breaks?
Don’t know whether there’s a method fir that.
You can always check it yourself by examining the .TextRtf or .Text
Hello,
I'm trying to replace the MSCOMCTL library in MS Access. I've added a TreeView component and I'm attempting to handle an event with the following code:
However, when I open the form, I receive an error.Code:Private Sub TreeView_Expand(ByVal Node As VBCCR18.TvwNode)
Debug.Print "Key is" & Node.Key
End Sub
The expression [key up| mouse move|Node click|Mouse up|Click (any of this option)] you entered as the event property setting produced the following error: Procedure declaration does not match description of event or procedure having the same name.
The next events are processed correctly as long as I remove the event Expand.
and there is no other code.Code:Private Sub TreeView_DblClick()
Debug.Print "abcd"
End Sub
Private Sub TreeView_Click()
Debug.Print "abcd"
End Sub
Did you just change the existing Event handlers from the original Treeview?
You should use the events from the CommonControls TreeView and then add/copy the code from the original TreeView events.
First, I took my existing forms and replaced components from MSCOMCTL with those from VBCCR, but that approach didn't work.
Now, I created a new form, added a VBCCR18.TreeView component to it, and am trying to adapt old code to these new controls.
But I ran into an issue where the needed event doesn't fire properly. It doesn’t work even on a clean new form without other code or components.
To be honest, VB is not my language, I worked with it over 20 years ago when I was just starting to learn programming from a book, and since then I haven't had any experience with VBA.
So I might’ve missed something important here. Could you please provide me with a minimal example showing how to handle the node expansion event (for instance, display the node's text)?
thx
looks like, I've figured it out, thank you for guiding me.
I've noticed an issue with the CommandButtonW control. I have them on a panel on an MDI form as the main toolbar. If the focus goes off the form (to another window/application), and the button is then clicked without the MDI form becoming active first, the click event does not fire. The button responds to the visual styles still (hover effect). If I instead click a regular button, the click event is performed, even if the form doesn't have the focus.
Hi Krool,
i have a feature request for the CheckboxW and the OptionButtonW:
Can you add the existing AutoSize property from the LabelW control to the CheckboxW and the OptionButtonW control?
This can be very useful when having a GUI that is translated into other languages.
The length of the displayed text can be so different in every language and it is a pain in the ass to check all forms with all languages to check no text is truncated.
I think the exisiting core functionality of the AutoSize property from the LabelW control only needs to adapted to the other controls.
What do u think?
It's certainly possible but not trivial, because there is no message or anything which does it for you. So, I would need to code it and check for each style combination do make the best fit. (if MS introduces new styles, the property would get outdated)
So, I would recommend to make a hidden Label and set the Caption and let it autosize and then apply the width of that hidden label plus the "extra width" to your CheckBoxW/OptionButtonW.
According to reactOS the "extra width" would be the checkBoxWidth + text_offset: (for a normal CheckBoxW/OptionButtonW without fancy styles, imagelist etc.)
Code:checkBoxWidth = 12 * GetDeviceCaps( hDC, LOGPIXELSX ) / 96 + 1;
What is that "panel" for a control ? I can't reproduce it with a simple UserControl control container placed on the MDI form..Code:GetCharWidthW( hDC, '0', '0', &text_offset );
text_offset /= 2;
Hello.
I have a question regarding how to use this component with the x64 version of Office. When trying to connect the component, VBA shows that the reference is missing, but that's not true, as the file is in place.
When opening the document, I receive an error:
The expression On open you entered as event property setting produced the following error: A problem occured while <docname> was communication with the OLE server or ActiveX Control.
Does a version of the component for x64 exist?
Perhaps, this document can also be referred to :wave:
VBCCR (VB6 ActiveX Universal Control Alternative Library) supports native unicode characters
https://doc.vb6.pro/vbccr/
But what you want isn't normal form/windowscontrols behaviour. When I resize a window I expect to get more room, not controls to resize with it. I made a few controls myself and I never even considered what you want as that isn't normal Windows behaviour. Resizing a window does not scale controls, with regular window forms. That kind of thing is mostly done on windows with external applications making only scale the specified window, as if you had set scaling in windows itself.
Maybe Twinbasic supports it, but that's because they wrote their own controls for their window form behaviour, they're not using standard window controls for that.
TREEVIEW BUG:
The item with INDEX=10 is selected and in focus state
But when I check other options, the focus will switch, and after checking, it will return to the original focus, causing visual flickering
Can a new attribute be added to label w and textw: vertical centering.
For example, if the font height is 12 pixels and the control height is 30 pixels, let the font start displaying at the top=9 position
how to add images when run exe?
ImageList1.ListImages.Add(?
how to set iamges size(24bit? 128*128)?
treeeview can set iamges without ImageList1 control?
hello,Krool, can LISTVIEW enhance the modification function? For example, can it be set whether a certain column and a certain row are allowed be modified? You provide the modification call in LISTVIEW, and I can write a two-dimensional array to store the modification flag of each cell in the entire LISTVIEW When I need to modify a certain cell, I can directly call your modification, such as modifying the table header data: LISTVIEW1.LvwColumnHeader.fixrow, column, modification flag)
Modify sub-item: LISTVIEW1.LvwListSubItem.fix(row, column, modification flag). Although are some table controls that can be used, my data is not much, at most a few rows and columns, and the use of listview is also very intuitive. I am forward to your reply.
VBCCR 1.8.77
VB6SP6, Win10
Hi Krool,
a ToolTipText isnt shown when hovering the mouse over a listview header (View:Report):
Bug or do i something wrong?Code:Dim xHeader As LvwColumnHeader
Set xHeader = lvwFolder.ColumnHeaders.Add(, , "Name")
xHeader.ToolTipText = "test123"
LISTVIEW , how to select a cell like excel?
or when CELL SELECT CHANGE (ROW=2,COL=2)
CELL BACK BOLOR=YELLOW?
when CELL SELECT CHANGE (ROW=3,COL=3)
CELL BACK BOLOR=YELLOW?
last cell(2,2).back color=whilte?
How to set the thickness, pixel size, and color of grid lines
How to click on a cell with the mouse and modify the content like a text box
set/get cell value:
Code:Public Property Get Cell(ByVal Row As Long, Col As Integer) As String
Cell = ListView1.ListItems(Row).SubItems(Col - 1)
End Property
Public Property Let Cell(ByVal Row As Long, Col As Integer, ByVal vNewValue As String)
ListView1.ListItems(Row).SubItems(Col - 1) = vNewValue
Exit Property
If Col = 1 Then 'MSCOMCTL_ListView
ListView1.ListItems(Row).Text = vNewValue '?1??????N?????????
Else
ListView1.ListItems(Row).SubItems(Col - 1) = vNewValue
End If
End Property
i only want have a way to read txt(line=30,col=5) ,or edit value
set cell back color,Set CellPicture
set cell draw text start at 31px (1-30px draw picture or progress bar)
In this case you should use a grid instead of a list view...see VBFlexGrid Control
Often in this thread there was a request of how to apply unicode text to an intrinsic .ToolTipText property.
This module is a lightweight solution that comes without hooks and is IDE safe even without thunks.
It also allows multi-line tool tip texts.
Ensure that InitVBBubbleW is called once. Any valid Form object is enough. It is just needed to ensure that VBBubble class is loaded and the handle is retrieved.
You can unload it manually by calling ReleaseVBBubbleW. However, this is optional as it will be called automatically.Code:Private Sub Form_Load()
Call InitVBBubbleW(Me)
End Sub
Example of setting a unicode text with optional draw flags and with an optional max width of 400 pixels. (if ommited, defaults to -1 which means no limit)Code:Call ReleaseVBBubbleW
Example of retrieving the unicode text.Code:Const DT_RTLREADING As Long = &H20000
Call SetToolTipTextW(MonthView1, "test" & vbLf & ChrW(5000) & ".", DT_RTLREADING, 400)
Setting the .ToolTipText directly is still supported and cause no harm. It will be displayed as ANSI then and is limited to 255 characters, but multi-line still being supported.Code:Debug.Print GetToolTipTextW(MonthView1)
To note is that this module is standalone and does not have any dependency.
VBBubbleW not limited to 255 characters anymore.
SetToolTipTextW/GetToolTipTextW changed as it is necessary to pass now the control holding the .ToolTipText property.
Excellent - thanks for that tooltip module!