Autor Beitrag
kachel81
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 63



BeitragVerfasst: Mi 29.09.04 12:15 
Es gibt einen Windows-API-Befehl mit dem man Strings abkürzen kann, wenn der String nicht komplett in den darzustellenden Bereich passt. Im einfachsten Falle wird der String gecuttet und hinten "..." angehängt, so daß es passt.

Wie heißt der API-Call, kennt den jemand und weiß jemeand wie man Ihn benutzt?

Mfg Kachel
iKilledKenny
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 394
Erhaltene Danke: 8

Win XP
D5 Prof, C# Express 2005
BeitragVerfasst: Mi 29.09.04 12:39 
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
int DrawText(
    HDC hDC,           // handle to device context 
    LPCTSTR lpString,  // pointer to string to draw 
    int nCount,           // string length, in characters 
    LPRECT lpRect,           // pointer to structure with formatting dimensions  
    UINT uFormat            // text-drawing flags 
   );

ausblenden Delphi-Quelltext
1:
DrawText (MeinCanvas.Handle, PChar ('Mein Text'), -1, MeinRect, DT_LEFT or DT_TOP or DT_SINGLELINE or DT_END_ELLIPSIS);					


oben die definition aus der windows hilfe, dann ein beispiel, entsprechend anzupassen. das was die punkte anzeigt, ist das DT_END_ELLIPSIS.



Moderiert von user profile iconChristian S.: Code-Tags hinzugefügt.
kachel81 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 63



BeitragVerfasst: Mi 29.09.04 13:00 
Perfekt, funktioniert super.

Ich danke Dir!
kachel81 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 63



BeitragVerfasst: Do 30.09.04 17:03 
Ich mach den Thread nochmal auf, weil mir noch eine Klitzekleinigkeit nicht so gefällt:

Mit dem flag DT_PATH_ELLIPSIS kann ich Pfad-Variablen abkürzen, die Logik dafür bezieht sich aber nur auf einen Backslash. Ich hätte gern gewußt, wie ich das für URL's hinbekomme, z.B. so wie das in diesem Forum auch funktioniert ...

www.lala.de/kachel/g...funky/byte/index.htm

...

mit den "..." in der Mitte, so daß man das wesentliche (Anfang und Ende der URL) sehen kann.
GSE
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 740

Win 2k, Win XP Pro
D5 Prof, D6 Ent, D2k5 PE
BeitragVerfasst: Do 30.09.04 18:01 
mit StringReplace erst alle Slashes in Backslashes und danach wieder "rückwandeln"

nicht besonders elegant, aber was solls? :wink:

mfg
GSE

_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)
kachel81 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 63



BeitragVerfasst: Do 30.09.04 18:05 
Das funktioniert nicht, weil mir die Methode den String nicht zurückgibt, sondern Ihn sofort direkt draufzeichnet.
GSE
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 740

Win 2k, Win XP Pro
D5 Prof, D6 Ent, D2k5 PE
BeitragVerfasst: Do 30.09.04 18:18 
wenn du die jcl hast, da gibts die Funktion PathCompactPath
sonst, kannst du's vielleicht auch selber schreiben
oder gehts doch noch anders?

mfg
GSE

_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)
kachel81 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 63



BeitragVerfasst: Do 30.09.04 19:18 
Das funzt, dank Dir vielmals!!!
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Sa 02.10.04 06:55 
Es gibt von MS auch eine URL-API. Mit dieser kannst du das machen. Such im Forum mal danach. Komplette Header wurden gepostet.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Gast
Gast
Erhaltene Danke: 1



BeitragVerfasst: Mi 13.10.04 19:33 
Bitte den Thread auf beantwortet setzen :-\ ...