English
Source / code snippets

Choosefont dialog

 

Uwe
''Pascal''
Niemeier
Hi people!

here one Snippet a actually proposition: One dialog to selection of/ one type.
CompileMarkSeparation
window 400,400
 $H Windows.ph
 $H Messages.ph
usermessages 16
var Ini$="X:Test.ini"************************* Pfad bitte anpassen!

subproc rtf.SetColor------------------------------------rtf.SetColor

    parameters Edit&,Color&
    declare rtf#:dim rtf#,60--CHARFORMAT
    long rtf#,0=60,$40000000,0,0,0,Color&
    sendmessage(Edit&,1092,0,rtf#)-EM_SETCHARFORMAT
    dispose rtf#
    endproc-------------------------------------------------------------

    proc ChooseFont-------------------------------------------ChooseFont

        parameters Log#
        declare a#:dim a#,60--CHOOSEFONT
        long a#,0=60,%hwnd,0,Log#,0,$541,long(Log#,60)
        var Size%=long(Log#,0)
        long b#,0=Size%*~GetDeviceCaps(%hdc,~LOGPIXELSY)/108
        var Ok&=external("comdlg32","ChooseFontA",a#)
        long Log#,0=if(Ok&,long(a#,16)*0.15,Size%)
        long Log#,60=long(a#,24)
        dispose a#
        return Ok&
        endproc-------------------------------------------------------------
        declare b#:dim b#,60+4--LOGFONT + Textfarbe
        var Edit&=create("RichEdit",%hwnd,"RichEdit
        LaberLaber",10,50,300,100)
        var Result&=~GetPrivateProfileStruct("Config","Font",b#,64,addr(Ini$))

        ifnot Result&------------Vorgaben, falls Ini noch nicht vorhanden

            long b#,0=18----------Height (im Dialog angezeigte Größe * 1.5)
            long b#,16=0----------Bold (gesetzt: 700)
            byte b#,20=1,1,0------Italic, Underline, Strikeout
            string b#,28="Arial"--FontName (max. 32 Bytes)
            long b#,60=128--------Farbe

        endif

        var Font&=~CreateFontIndirect(b#)
        setfont Edit&,Font&
        var Color&=long(b#,60)
        rtf("SetColor",Edit&,Color&)

        while 1

            waitinput
            case %umessage=16:break
            Result&=ChooseFont(b#)

            if Result&

                deleteobject Font&
                Font&=~CreateFontIndirect(b#)
                setfont Edit&,Font&
                Color&=long(b#,60)
                rtf("SetColor",Edit&,Color&)

            endif

        endwhile

        deleteobject Font&
        ~WritePrivateProfileStruct("Config","Font",b#,64,addrs2>(Ini$))

After verify the Dialoges becomes The on it übergebene LOGFONT-structure aktualisiert;
from it becomes then by API directly the Font generiert and over a SubProc The colour in the
RichEdit staid.
with terminate becomes these structure velvet angehängter colour directly into a Ini written
and at next Start again read, sodaß Font and colour immediate again to
Disposal stand.

Happy solid you all!
Pascal
 
12/23/09  
 



Hehe very nice!
 
12/23/09  
 




Frank
Abbing
functions.

I bastle straight what Own, because I immediate a Text-Input moreover need: [...] 
 
12/23/09  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

2.351 Views

Untitledvor 0 min.
E.T.06/25/23
RudiB.04/11/22
rquindt05/01/18
Andre Rohland12/28/14

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie