Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Krool
Due to the fact that the default FaceName in vb6.exe is limited to 13 chars there seems to be no way to define "Microsoft Sans Serif", right?
So we could define "Segoi UI" but would need to life with FontSize of 8 instead of 9?
To be consistent with newer versions of Windows, Segoe UI 9pt would be better.
Originally Posted by VBNetMatrix
I did tutorial in a Vb6 project and I started a blog about all thing I want to share about Vb6...
The blog is "under construction" but project is available...
Does your VB6 'hack' change the font used in a VB6 app's menu ?
Re: CommonControls (Replacement of the MS common controls)
Krool,
In the Toolbar control you can change the font and this works fine. But the font used in the dropdown 'ButtonMenus' doesn't change. Is there any way to set this font ?
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by VB6 Programming
To be consistent with newer versions of Windows, Segoe UI 9pt would be better
Probably not a bad choice. That font appears to be available since Vista. If an app, using that font were shipped to XP (for sake of argument), the font would be changed to something else unless font is also shipped.
I created a test app in Vista with a font I know wasn't installed on Win10. When opened in Win10, that font was changed to Arial. I don't know how VB (or system) selected Arial other than some system font-fallback algo. The plus side to this is that Arial is at least an Open/True type font which would scale better with DPI awareness.
If hacking the vb6.exe, suggest considering how far back one wants to support backward compatibility with fonts. Other options for fonts that do not use hacking vb6.exe are:
1) Whenever a form is added to your project, first thing to do is change the font on the form. Then, with most controls, the added control can inherit the form's font.
2) Create a form with the desired font and save it to VB's \Template\Forms folder and name it something like "Default.frm". Now you can replace the base form VB gave you with that one (via the selection window) and can select that new default whenever you want to add additional forms to the project. Similar solution for MDI forms: \Template\MDIForms folder.
In any case, font-fallback will be in play if the font you chose is not installed on the systems the app is run on. It's a shame VB didn't buffer the embedded font name within vb6.exe with full 32 characters.
My only concern for hacking VB6.exe would be that it would fail to open if an uninstalled font was hacked into the exe. Maybe it would just default to Arial or something else? Maybe it will crash? Probably should verify that by hacking a completely bogus font name: BogusFont (suffixing null chars or spaces to fill it out to 13 chars)
Edited & FYI: using NotePad to enter a bogus font in an existing .frm file did NOT prevent the form from loading. The font, however, was changed to Arial (Win10). Maybe Arial would be a more consistent choice instead of Segoe UI?
One more edit... Hacked vb6.exe myself and provided a bogus font and VB defaulted to Arial. I then re-hacked it and provided a valid font and all went well. There are two locations in the exe where "MS Sans Serif" is listed, I replaced both instances, filling out the 13 characters with null chars as needed. I chose Arial over Segoe UI, but Segoe UI worked also. I personally prefer Arial as the default. Always hack a copy of the exe. And be pretty sure of the font you want. If you revisit this in a year, you may forget that the space allocated for the font is 13 characters. The font displayed in the exe won't show as 13 characters any longer if you selected a font with a shorter name.
Last edited by LaVolpe; Aug 20th, 2017 at 01:35 PM.
Insomnia is just a byproduct of, "It can't be done"
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by LaVolpe
Probably not a bad choice. That font appears to be available since Vista. If an app, using that font were shipped to XP (for sake of argument), the font would be changed to something else unless font is also shipped.
Segoe UI has been the default Windows font since Vista, and has shipped with Office since Office2007 (so is often found on XP PCs too). The Microsoft logo uses the Segoe font.
I personally prefer Arial as the default.
I like Arial too. It was just that Microsoft chose Segoe for Windows that made me choose it.
Create a form with the desired font and save it to VB's \Template\Forms folder and name it something like "Default.frm". Now you can replace the base form VB gave you with that one (via the selection window) and can select that new default whenever you want to add additional forms to the project. Similar solution for MDI forms: \Template\MDIForms folder.
That's how I do it. And I also save a Project (and Form) into the \Template\Projects folder, so I don't need to replace the base form each time.
But the Menu font remains as MS Sans Serif 8pt.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Hosam AL Dein
I have 2 issues here with listview
1 - when setting the property "usecolumnchevron" to true and autosizing the last column to header , these bugs occur
a - the header caption disappears
b - the width of the column gets too wide and the arrows "chevron" appear
a: If the column headers are wider than the client area and can't be displayed all together the chevron button is shown.
It is normal behavior that that caption where the chevron button currently is will not be shown.
b: I already explained, but again: When doing autosize to the last columnheader it is sized to right side of client edge.
Originally Posted by Hosam AL Dein
when you set a splitbutton to a column and you manually re-position it , it loses the property and it is set to the other column which replaces it
Seems to be an MS bug as other column properties (e.g. CheckBox) is shifting properly. The splitbutton though will stick to current column order and thus shifts to another column.
It seems worth to make some internal extra effort to address that bug. Bug is noted.
Originally Posted by Hosam AL Dein
also in linklabel , the font is not affected in design time . run the project once , now it will be drawn in both run time and design time
Fixed. Thanks. It was not an bug per definition, but linklabel did not refresh after WM_SETFONT so a RedrawWindow was necessary afterwards.
Originally Posted by Hosam AL Dein
it is in linklabel , when set to transparent this bug happens
Fixed. Thanks. It was not an bug per definition, but linklabel needed the dummy WM_PAINT after creation before the intial caching transparent brush.
Info: On all controls the caching of the transparent brush can be renewed with '.Refresh'. So keep in mind whenever background changes and you want to update the transparency make an .Refresh.
Originally Posted by VB6 Programming
In the Toolbar control you can change the font and this works fine. But the font used in the dropdown 'ButtonMenus' doesn't change. Is there any way to set this font ?
The dropdown 'ButtonMenus' uses the system font.
Again, the .ButtonMenus property is meant for simple and rapidstart use. If you want to have custom font do as following:
Don't set any ButtonMenu in .ButtonMenus, instead handle the event 'ButtonDropDown' and create your own menu there. (e.g. custom drawn PopupMenu)
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Krool
Due to the fact that the default FaceName in vb6.exe is limited to 13 chars there seems to be no way to define "Microsoft Sans Serif", right?
So we could define "Segoi UI" but would need to life with FontSize of 8 instead of 9?
Well... yes that's an issue for Microsoft Sans Serif... the other solution would be to rename a font to a smaller name, this can be achieve with a tools... problem is you'll need to distribute that font with your EXE because I doubt the destination computer would "recognized" it as the original font...
However, on my machine, the program give me 126 other fonts to choose from, including SegoUI and Arial... wich are both "acceptable"
as for the size, I didn't find a place in the vb6.exe where they store it. I assume, 8 is the minimal font size of ms sans serif and that might be why that size was selected. something like MinSizeOfFont("Ms Sans Serif") worth exploring since I noticed the font "Ms Sans Serif" was also stored at another adress in the exe, I'll make some test to validate that theory.
Did you tried the Vb6.exe font changer from my blog yet ?
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by VB6 Programming
To be consistent with newer versions of Windows, Segoe UI 9pt would be better.
Agree but it doesn'T seem to be possible for the moment. I'm exploring something to allow it... I'll keep you informed.
Originally Posted by VB6 Programming
Does your VB6 'hack' change the font used in a VB6 app's menu ?
No but I have achieved this by modifying ressource inside the program.
This would be the topic of another program since it's really 2 differents things... When I'll get time I'll make the documentation on how to achieve that and post it on my blog.
Re: CommonControls (Replacement of the MS common controls)
Thanks Lavolpe, you have pertinent observation.
Originally Posted by LaVolpe
Probably not a bad choice. That font appears to be available since Vista. If an app, using that font were shipped to XP (for sake of argument), the font would be changed to something else unless font is also shipped.
SegoUI is the Microsoft Choice as "default" font for many thing including Visual Studio 2010 and up.
Originally Posted by LaVolpe
I created a test app in Vista with a font I know wasn't installed on Win10. When opened in Win10, that font was changed to Arial. I don't know how VB (or system) selected Arial other than some system font-fallback algo. The plus side to this is that Arial is at least an Open/True type font which would scale better with DPI awareness.
You are right. It's a System behavior (herited from Win95). Microsoft made it a System behavior with the arrival of Web (WWW). Some web page made for MacOS user wasn't showed properly because of font difference. First, the family font is analyze, then the font attribute like "Serif", "StrikeThrough", etc... then the closest font available is selected. Arial will be selected more then 85% of the time but sometime Helvetica got elected.
Originally Posted by LaVolpe
It's a shame VB didn't buffer the embedded font name within vb6.exe with full 32 characters.
Yeah, they simply did: OurVarDefaultFontName = "Ms Sans Serif" and the terminated Null
Originally Posted by LaVolpe
My only concern for hacking VB6.exe would be that it would fail to open if an uninstalled font was hacked into the exe. Maybe it would just default to Arial or something else? Maybe it will crash?
Won't crash... I tested it first. I would not have offered this solution without knowing it was safe. However since this is only for the IDE and since nobody will "share" their vb6.exe because it contain your serial number encrypted (install Vb6 fresh on a machine, save the vb6.exe, uninstall and install back, you'll get a different vb6.exe binary each time)
Originally Posted by LaVolpe
Always hack a copy of the exe.
pretty sure you meant BACK (up) instead of HACK
Originally Posted by LaVolpe
If you revisit this in a year, you may forget that the space allocated for the font is 13 characters. The font displayed in the exe won't show as 13 characters any longer if you selected a font with a shorter name.
That's why it is safer with the program I made. I save the font as Left(strFontName & String(13,0)), 13)
Re: CommonControls (Replacement of the MS common controls)
about: \Template\Forms folder
Originally Posted by VB6 Programming
That's how I do it. And I also save a Project (and Form) into the \Template\Projects folder, so I don't need to replace the base form each time.
But the Menu font remains as MS Sans Serif 8pt.
But you need to select "new project" and your template right?
My Vb6 is set to open a new project everytime instead of the select menu
Did you find a way to open your selected template by default ?
I'm looking for a way achieve this. Sadly the design of the IDE in itself was poorly think. There is limited option of personalisation
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by VbNetMatrix
That's why it is safer with the program I made. I save the font as Left(strFontName & String(13,0)), 13)
I just overwrote the 13 bytes. Nothing fancy. Think you should warn user if a font name is > 13 characters. You don't want to truncate the font name. If you do, the hacked font won't be what they expected. Just a suggestion.
Regarding my concerns about crashing, etc. If you noticed my edited comments in my reply, already confirmed that it won't crash and it will select another font if a the hacked font isn't installed. I added those comments after I hacked my copy of vb6.exe to test it.
P.S. I tried searching the exe to see if I can find where the font size of 8 is set. Didn't spend a ton of time on it, but if there's a LOGFONT structure in there somewhere, I didn't see it. It is possible that there is no value set. LOGFONT.lfHeight can be set to 0, meaning: default height.
Insomnia is just a byproduct of, "It can't be done"
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by LaVolpe
P.S. I tried searching the exe to see if I can find where the font size of 8 is set. Didn't spend a ton of time on it, but if there's a LOGFONT structure in there somewhere, I didn't see it. It is possible that there is no value set. LOGFONT.lfHeight can be set to 0, meaning: default height.
Sorry I had missed your edited comment... I started to answer and I had to leave, when I came back, I just finished my answer and posted it.
as for the font size... you're probably right...
what we need is a NEW IDE !!!
We need to learn how to "load an OCX at run time" to emulate the IDE behavior... and to run in memory for debugging like the IDE... The rest is simply an editor
loool.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by VbNetMatrix
p.s. did you found a new dizzy yet ?
Yep, custom made for my engine specs. Will take about another 2 weeks to finish and get here. Can't wait, cold weather is not that far out and the Mustang is just sitting in the garage, collecting dust, while waiting for it. 50 year old cars are money pits, but its worth it to some of us.
Krool, sorry. Won't hijack your thread talking about muscle cars.
Last edited by LaVolpe; Aug 20th, 2017 at 11:38 PM.
Insomnia is just a byproduct of, "It can't be done"
Re: CommonControls (Replacement of the MS common controls)
@Krool, VbNetMatrix and others that may be hacking vb6.exe to replace the default font...
Don't do it yet without more testing. See this post where I responded to a similar scenario that failed and it can be replicated. This font hack is not perfect as it is.
Insomnia is just a byproduct of, "It can't be done"
Re: CommonControls (Replacement of the MS common controls)
The ideal solution is an IDE add-in that "intercept" add new form and at that point change the font name and size according to one's preference. Can even do more than this - add new control (or anything) and change bla bla bla.
Re: CommonControls (Replacement of the MS common controls)
Hi Krool,
There may be a problem with FrameW font. I created all the FrameW and all controls in all the forms with Arial. Now, I manually go into them and change the font to Tahoma. With the FrameW, visually and in the properties it reflected the change. Save to make the changes permanent. Close and open the forms, the FrameW font physically revert back to Arial but the properties still show Tahoma.
Update:
I just replaced the FrameW.ctl and .ctx with that from 20170627 and without doing anything else, all FrameW now correctly show the Tahoma font.
Re: CommonControls (Replacement of the MS common controls)
I would like to deploy the ActiveX Control version 1.5 "soon", though there are still some points open todo before that..
However, please let me know if you have some other points to consider which I might not know yet.
Thanks
Re: CommonControls (Replacement of the MS common controls)
You set up the FlexGrid replacement control as a different project even though it shares a lot with this project. The thread traffic is relatively slow so I wonder if it is time to merge this project with that. It would make use a bit easier only having to mess with one set of files, whether as controls or an OCX.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by chosk
The ideal solution is an IDE add-in that "intercept" add new form and at that point change the font name and size according to one's preference. Can even do more than this - add new control (or anything) and change bla bla bla.
I had a project in past... I didn't finished it... it would do exactly like that... for me it was to calculate time I pass on programming on each project... maybe it's time to revive that project and add more functionality
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by chosk
Hi Krool,
There may be a problem with FrameW font. I created all the FrameW and all controls in all the forms with Arial. Now, I manually go into them and change the font to Tahoma. With the FrameW, visually and in the properties it reflected the change. Save to make the changes permanent. Close and open the forms, the FrameW font physically revert back to Arial but the properties still show Tahoma.
Update:
I just replaced the FrameW.ctl and .ctx with that from 20170627 and without doing anything else, all FrameW now correctly show the Tahoma font.
To correct my mistake. The FrameW was created with Arial font with earlier version of Std-exe controls and displayed correctly as Arial. But now when used with current version, it is actually showing MS San Serif and I did not realize it still thinking it is Arial because it is not Tahoma. The current version seems to ignore what font is set (although reflecting the chosen font in properties) but actually display MS San Serif.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by chosk
To correct my mistake. The FrameW was created with Arial font with earlier version of Std-exe controls and displayed correctly as Arial. But now when used with current version, it is actually showing MS San Serif and I did not realize it still thinking it is Arial because it is not Tahoma. The current version seems to ignore what font is set (although reflecting the chosen font in properties) but actually display MS San Serif.
This is a side effect error when modified the FrameW on 03-Jul-2017 from MS control window to direct rendering. Fix will follow very soon.
PS: OCX is not affected as it still uses the "old" FrameW.
Re: CommonControls (Replacement of the MS common controls)
The new Frame control doesn't support using an icon instead of text (I haven't updated in a while so I don't know what specific version this change was made in, I was using the one dated 11/18/2016)... it doesn't seem to be a real control, just drawn using theme API. For now I can drop the old version in as it's compatible with the newer subclassing/tlb, but would definitely like to see it continue to be supported in new versions.
It was done by setting the imagelist via BCM_SETIMAGELIST (and its margins via BCM_GETIMAGELIST after its first set) with the .hWndGroupBox handle, which was the hWnd from the CreateWindowEx call, which the new control doesn't have, and sending it to the only hWnd I see, UserControl.hWnd, obviously doesn't work.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by fafalone
The new Frame control doesn't support using an icon instead of text (I haven't updated in a while so I don't know what specific version this change was made in, I was using the one dated 11/18/2016)... it doesn't seem to be a real control, just drawn using theme API. For now I can drop the old version in as it's compatible with the newer subclassing/tlb, but would definitely like to see it continue to be supported in new versions.
It was done by setting the imagelist via BCM_SETIMAGELIST (and its margins via BCM_GETIMAGELIST after its first set) with the .hWndGroupBox handle, which was the hWnd from the CreateWindowEx call, which the new control doesn't have, and sending it to the only hWnd I see, UserControl.hWnd, obviously doesn't work.
True. Only way is to simulate such thing..
I could implement a 'Picture' property and render likewise. (Instead of ImageList; less overhead)
Question: Display image along caption or both? A 'PictureAndCaption' bool property could control such question. (Just like in CommandButtonW, CheckBoxW, OptionButtonW etc.)
EDIT: Question in the room: Is there a need for a property page for the LabelW control? This would allow to make multiple lines of text in the caption property in design time.
Re: CommonControls (Replacement of the MS common controls)
Image along caption would be wonderful actually, as that doesn't seem possible with the current frame control; you wouldn't need two properties, it would be picture-only when caption="", and text only when there's no picture; just adjust the start point of the text.
But if I may ask... what advantage is offered by creating a control exclusively with theme API instead of CreateWindowEx? Because this probably won't be the only rare customization that doesn't work, especially if other controls do this too.
Last edited by fafalone; Aug 25th, 2017 at 12:15 AM.
Re: CommonControls (Replacement of the MS common controls)
It would be awesome if Toolbar ButtonMenus offered the ability to have images, change backcolor, set font so that Explorer style interfaces could be created, like this:
I know that this can be done by creating my own menu (or form) and showing it in the ButtonMenu click event but it would be wonderful if these enhancements were added to the ButtonMenus.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by AAraya
It would be awesome if Toolbar ButtonMenus offered the ability to have images, change backcolor, set font so that Explorer style interfaces could be created, like this:
I know that this can be done by creating my own menu (or form) and showing it in the ButtonMenu click event but it would be wonderful if these enhancements were added to the ButtonMenus.
Use the 'ButtonDropDown' instead for showing your own menu. If there is so much demand for a better rapidstart menu I will consider making the ButtonMenus OwnerDrawn.
Originally Posted by fafalone
Image along caption would be wonderful actually, as that doesn't seem possible with the current frame control; you wouldn't need two properties, it would be picture-only when caption="", and text only when there's no picture; just adjust the start point of the text.
But if I may ask... what advantage is offered by creating a control exclusively with theme API instead of CreateWindowEx? Because this probably won't be the only rare customization that doesn't work, especially if other controls do this too.
FrameW is the only control which is done without CreateWindowEx. Reasons are more compact and understandable code. Also it allows to have a themed text color (ForeColor) via DrawThemeTextEx.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by fafalone
Image along caption would be wonderful actually, as that doesn't seem possible with the current frame control; you wouldn't need two properties, it would be picture-only when caption="", and text only when there's no picture; just adjust the start point of the text.
Update released.
Included Picture property in FrameW control.
Not only the start point, but also the height needed to be adjusted in case the picture height is larger than the font height.
Re: CommonControls (Replacement of the MS common controls)
In FrameW the image is not rendering correctly for 32bpp images.
I use DrawIconEx here and have external Manifest for Vb6.exe so I can see correct 32bpp in IDE.
Vb6.exe External Manifest works for me in Windows 10 if you add this Registry item:
Also noticed similar issue with ImageList not rendering Alpha channel for 32bpp in the PropertyPage.
Even though the images don't display correctly, the ImageList does in fact have the correct 32bpp images and work correctly when attached to your controls.
Using ImageList_Draw with ILD_TRANSPARENT fixes this.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by DrUnicode
In FrameW the image is not rendering correctly for 32bpp images.
Thanks, and not only the FrameW. Also the StatusBar for the Panel.Picture was affected.
And of course the Images Property Page in the ImageList control. (cosmetic issue at design-time)
Re: CommonControls (Replacement of the MS common controls)
Further tweak for the Picture property in the FrameW control. The new included PictureAlignment property controls now if the picture is displayed left or right of the caption.
This might be useful especially when using right-to-left reading.
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by Karl77
Code:
Private Sub ToolBar1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Debug.Print "Button", Button
End Sub
Button is always 1.
In MouseMove it is always 0.
What can be wrong?
I cannot replicate that issue. MouseMove is of course 0 when no mouse button is hold down.
MouseDown is working correctly.. it gives me 1, 2 and 4 etc..
Re: CommonControls (Replacement of the MS common controls)
I tested your Form with VBCCR14.OCX and get again 1, 2 and 4..
Hmm, now I'm out of ideas.
---
I must confess I'm too stupid for programming.
I mixed the MOUSE button with the TOOLBAR button.
Shame on me.
Forget the below...
---
I tried:
Quit all VB IDE's.
Reload project.
Compile to exe, with MsgBox on MouseDown.
Reboot of the PC.
Same procedure.
And I never get other Button values than 1.
Info:
VB6 has SP6B.
VB6.EXE has edited resources in order to show styles and DPI effects. *
Windows is 10/64, up to date.
Current DPI setting is 100%.
VBCCR14 is 1.4.044.
Side-by-side manifest is used in the project.
*I tried all the above with the original VB6.EXE as well.
What can I do/try/test/prepare/whatever?
Last edited by Karl77; Aug 29th, 2017 at 04:03 PM.
Reason: To stupid
Re: CommonControls (Replacement of the MS common controls)
Originally Posted by MountainMan
You set up the FlexGrid replacement control as a different project even though it shares a lot with this project. The thread traffic is relatively slow so I wonder if it is time to merge this project with that. It would make use a bit easier only having to mess with one set of files, whether as controls or an OCX.
I agree with the above, this is a busy thread with active members, so the grid would have a proper discussion here