Results 1 to 8 of 8

Thread: frmMain.Font = (How i Can Load a Font From Resource) ?

  1. #1

    Thread Starter
    Member BladeM's Avatar
    Join Date
    Jul 2007
    Location
    Greece
    Posts
    47

    frmMain.Font = (How i Can Load a Font From Resource) ?

    Is it possible to load a font in my form from a resource file...?
    I made a search in the vb-forums but i only found that you can load a font from a file...
    Can anybody help me out...?

    This is the link to load a font from file:
    http://www.vb-forums.com/showthread....=font+resource

  2. #2
    PowerPoster Radjesh Klauke's Avatar
    Join Date
    Dec 2005
    Location
    Sexbierum (Netherlands)
    Posts
    2,244

    Re: frmMain.Font = (How i Can Load a Font From Resource) ?

    Hi BladeM. What's the point of doing that? I share the opinion of James Stanich.


    If you found my post helpful, please rate it.

    Codebank Submission: FireFox Browser (Gecko) in VB.NET, Load files, (sub)folders treeview with Windows icons

  3. #3

    Thread Starter
    Member BladeM's Avatar
    Join Date
    Jul 2007
    Location
    Greece
    Posts
    47

    Re: frmMain.Font = (How i Can Load a Font From Resource) ?

    Hi there too...
    The point is that i want to use a font in text boxes for better interface...but the problem is that if someone else gonna use it he must have installed that specified font in i used,otherwise the font will change auto to windows default like "Times New Roman"
    Also i don't want to share the font file with the exe.

    That is why i want the font in the resource...

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: frmMain.Font = (How i Can Load a Font From Resource) ?

    you just need to check the fonts collection to see if your font is installed, then if installed set that font, if not use some other, no need to use a resource file for this
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  5. #5

    Thread Starter
    Member BladeM's Avatar
    Join Date
    Jul 2007
    Location
    Greece
    Posts
    47

    Re: frmMain.Font = (How i Can Load a Font From Resource) ?

    westconn1 i think you didn't understand exactly...
    I have a project...
    I set the frmMain.font = "(one font i have downloaded from the internet)"...
    Now i compile the project i run the executable to my pc and all ok the text box preview the font i used(because the font is installed into Windows/Fonts directory),but if i send to my brother's pc he can't see the text box with the "(The Font From Internet)" because he don't have the font installed into Windows/Fonts directory...

    The problem is that if i publish the project the third person who is gonna use it he must have installed the font in case to view the text box with the font i have used in my project

    Note: I Don't want to share the font with my executable...

  6. #6
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: frmMain.Font = (How i Can Load a Font From Resource) ?

    that is exactly what i suggested in form load you put code to check if that font is installed, if it is set the textbox to use it, if not set the textbox to use some base font
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  7. #7
    PowerPoster Radjesh Klauke's Avatar
    Join Date
    Dec 2005
    Location
    Sexbierum (Netherlands)
    Posts
    2,244

    Re: frmMain.Font = (How i Can Load a Font From Resource) ?

    Yep... same here.
    You compile only the .exe. Within the distribution.exe you should add the font. When installing your app, install the font, in the Windows-Font folder and Register.


    If you found my post helpful, please rate it.

    Codebank Submission: FireFox Browser (Gecko) in VB.NET, Load files, (sub)folders treeview with Windows icons

  8. #8

    Thread Starter
    Member BladeM's Avatar
    Join Date
    Jul 2007
    Location
    Greece
    Posts
    47

    Re: frmMain.Font = (How i Can Load a Font From Resource) ?

    Quote Originally Posted by westconn1
    that is exactly what i suggested in form load you put code to check if that font is installed, if it is set the textbox to use it, if not set the textbox to use some base font
    Yes but i want the 3rd person who gonna use the proggie to view the textbox with the font i have downloaded from internet (with or without having the font installed in his fonts directory)...
    Thats why i am asking:
    Is There Any Possible Way to Use A font From A Resource File...?

    Quote Originally Posted by Radjesh Klauke
    Yep... same here.
    You compile only the .exe. Within the distribution.exe you should add the font. When installing your app, install the font, in the Windows-Font folder and Register.
    I don't want to share/give the font to the 3rd person...

    I think u have understand what i am trying to do...

Posting Permissions

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



Click Here to Expand Forum to Full Width