To be consistent with newer versions of Windows, Segoe UI 9pt would be better.
Does your VB6 'hack' change the font used in a VB6 app's menu ?Quote:
Originally Posted by VBNetMatrix
Printable View
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 ?
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.
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 like Arial too. It was just that Microsoft chose Segoe for Windows that made me choose it.Quote:
I personally prefer Arial as the default.
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.Quote:
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.
But the Menu font remains as MS Sans Serif 8pt.
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.
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.
Fixed. Thanks. It was not an bug per definition, but linklabel did not refresh after WM_SETFONT so a RedrawWindow was necessary afterwards.
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.
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)
-
Edit: OCX was also updated conerning LinkLabel.
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 ?
Agree but it doesn'T seem to be possible for the moment. I'm exploring something to allow it... I'll keep you informed.
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.
Thanks Lavolpe, you have pertinent observation.
SegoUI is the Microsoft Choice as "default" font for many thing including Visual Studio 2010 and up.
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.
Yeah, they simply did: OurVarDefaultFontName = "Ms Sans Serif" and the terminated Null
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)
pretty sure you meant BACK (up) instead of HACK
That's why it is safer with the program I made. I save the font as Left(strFontName & String(13,0)), 13)
:)
about: \Template\Forms folder
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
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.
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.
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.
@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.
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.
Here is link to MS documenatation that may help but I am not up to the standard. Maybe maybe one day I may try.
https://msdn.microsoft.com/en-us/lib...60(VS.60).aspx
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.
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
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.
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.
Hi Krool,
Thanks for the fix.
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.
http://i.imgur.com/L5of0Uc.jpg
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.
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.
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:
Attachment 151095
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.
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.
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.
Attachment 151101
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:
Key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide
Value: PreferExternalManifest
Data: 1 = prefer, 0 = don't prefer
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.
Attachment 151105
Attachment 151103
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.
Hello Krool,
Button is always 1.Code:Private Sub ToolBar1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Debug.Print "Button", Button
End Sub
In MouseMove it is always 0.
What can be wrong?
Not for me.Quote:
MouseDown is working correctly.. it gives me 1, 2 and 4 etc..
Regardless of the orientation of the toolbar.
(Had it vertical in the beginning).
Here's a form to play with.
Hmm, now I'm out of ideas.Quote:
I tested your Form with VBCCR14.OCX and get again 1, 2 and 4..
---
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?
I was slow.
Version: 1.4.46
Control: ListView
The search function "FindItem" doesnt work here.
I tried different combination of the parameters but i never get back any ListItem.
Can anybody check this please?
BTW: Why does the function "FindItem" doesnt support the value-parameter (lvwText,lvwSubitem,lvwTag) ?
See FindItem Method (ListView Control)