dcsimg
Results 1 to 2 of 2
  1. #1

    Thread Starter
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    4,386

    Add-In to Replace Fonts

    Here's a little Add-In I wrote, primarily for replacing all the MS Sans Serif fonts in large projects I've got, and I thought I'd share. It does allow you to replace any screen-available font with any other screen-available font. It's been something I've wanted/needed to do for some time.

    Here's a screenshot:

    Name:  ReplaceFont.png
Views: 302
Size:  7.9 KB

    Let me give some caveats to start:

    • I haven't tested it for any MDI-type projects, and I'm not sure what it'll do in those situations.
    • I always use my IDE in a SDI mode, but I don't think that should make any difference.
    • I didn't do the work to make an IDE Toolbar button for it. However, once it's loaded, it'll appear as a menu sub-item on the Add-Ins menu. If you click the "Hide Me" button on the interface, just click the "Replace Font" sub-menu item, and it'll re-appear.


    Also, let me talk a bit about Add-Ins for the uninitiated. There are a couple of different ways to execute this Add-In: One, you can just load it in the IDE and execute it. When you do this, it'll execute but nothing much will happen. However, if you load a second copy of the IDE and then call up your Add-In Manager, you'll see this Add-In. If you Load it, you'll then see the Add-In. However, all of this is more-or-less a mode for debugging the Add-In.

    The second way to use it is to compile it. It'll make an Add-In-type ActiveX DLL. And, the mere act of compiling it will also register it. Just because I'm a nice guy, I've also included two little DLLReg.vbs & DLLUnreg.vbs scripts. If you drag the compiled DLL onto either of those scripts, it'll register/unregister it. If you compiled it, but didn't compile it where you want it to permanently reside, this will allow you a way to move it (unregister, move the DLL, re-register). Personally, I have a VB6_Addins folder in my Microsoft Visual Studio folder, and that's where I keep these DLLs. Also, the act of compiling will create a couple of other files (ReplaceFont.exp & ReplaceFont.lib), but those aren't needed and can be deleted. Just don't delete the source files (ReplaceFont.vbp, ReplaceFont.frm/x, ReplaceFont.Dsr).

    Let me say a bit about the features too:

    • If you specify controls (in addition to forms), it will go through all controls of the form, regardless of whether or not they're nested in containers.
    • The "List w Font" button doesn't actually do anything to your project. However, it goes through all the forms and controls, and makes a list of the forms that have the "From" font somewhere on them. It's just a way to get an idea of what the "Do The Font Replacement(s)" button will do if you click it.
    • The "Segoe" and "Microsoft Sans Serif" buttons are just a couple of quick options for filling in the "To" font.


    UPDATE (July 1, 2018, version 1.01): Fixed the tab order, alphabetized (sorted) the ComboBoxes, added an option to cover CTL & PAG files in addition to FRM files.

    Enjoy,
    Elroy
    Attached Files Attached Files
    Last edited by Elroy; Jul 1st, 2018 at 09:59 AM.
    Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  2. #2

    Thread Starter
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    4,386

    Re: Add-In to Replace Fonts

    As a further note, this could rather trivially be turned into an Add-In that could stay loaded and instantly change the MS Sans Serif font of any new form to whatever you wanted.

    I thought about that, but I don't really mind the "manual" approach that I took with this Add-In, not wanting to do things behind-the-scenes too much.
    Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width