Autor Beitrag
seoman
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 24



BeitragVerfasst: Sa 22.05.04 19:13 
Hallo,
ist es irgendwie möglich
meine Eigenschaft Font.Style in einen String
zu schreiben bzw. andersrum?? :roll:

thanx
-seoman
MartinPb
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 698



BeitragVerfasst: Sa 22.05.04 19:29 
Ja. Du mußt die Bits auslesen oder gleich den ganzen Wert.

Möglich wäre z.B. das:

ausblenden Delphi-Quelltext
1:
2:
3:
ShowMessage(
  IntToStr(Byte(Form1.Font.Style))
  );


Für den Fall, daß irgendwann Stryle mehr als ein Byte verbraucht, sollte man es vorher mit SizeOf(Form1.Font.Style) prüfen.

_________________
Gruß
Martin
seoman Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 24



BeitragVerfasst: Sa 22.05.04 19:40 
Komisch,
ich kann Funktion Byte in der Delphi Hilfe gar nicht finden.
Wie ist denn die Umkehrfunktion davon?

-seoman
MartinPb
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 698



BeitragVerfasst: Sa 22.05.04 19:45 
seoman hat folgendes geschrieben:
ich kann Funktion Byte in der Delphi Hilfe gar nicht finden.


Du weißt aber was Byte ist, oder?

_________________
Gruß
Martin
seoman Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 24



BeitragVerfasst: Sa 22.05.04 19:47 
:x Klar!

... und weiter? :roll:
MartinPb
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 698



BeitragVerfasst: Sa 22.05.04 19:58 
Was erwartest du jetzt? Soll ich dir die Lösung schreiben?

_________________
Gruß
Martin
seoman Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 24



BeitragVerfasst: Sa 22.05.04 20:05 
:?!?:
Ja, aber wie soll ich denn auf die Lösung kommen,
so völlig ohne Hilfe.
Was Byte macht, kann ich mir ja vorstellen,
den Parameter Integer-Typ Byte umwandeln,
aber es existiert halt irgendwie keine Funktion
TFontStyles() mit dem Ergebnistyp Byte.
:nixweiss: Du siehst, eine kleine Hilfe wäre nicht schlecht...

-seoman
MartinPb
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 698



BeitragVerfasst: Sa 22.05.04 20:49 
Das kannst du mit Move machen. Allerdings akzeptiert Move nur eine Zielvariable. Deshalb kannst du nicht direkt in den Font schreiben, sondern muß einen Umweg machen:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
var
  Wert: Byte;
  FontStyle: TFontStyles;
begin
  Wert := StrToInt('5');  // Übergabe des Strings an Byte

  Move(Wert, FontStyle, SizeOf(FontStyle));
  Font.Style := FontStyle;
end;


Den Wert sichern geht fast genauso:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
var
  Wert: Byte;
  FontStyle: TFontStyles;
begin
  FontStyle := Font.Style;
  Move(FontStyle, Wert, SizeOf(Wert));

  ShowMessage(IntToStr(Wert));  // Übergabe des Bytes an Strings
end;

_________________
Gruß
Martin
mirage228
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 338

Win 7 Prof.
Delphi 2005 Prof., Delphi 2010 Prof.
BeitragVerfasst: Sa 22.05.04 21:35 
Hi,

schau dir mal GetEnumName und GetEnumValue aus der Unit TypInfo an.

Vielleicht hilft es dir ja.

mfG
mirage228

_________________
May the source be with you, stranger.
seoman Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 24



BeitragVerfasst: So 23.05.04 06:24 
Für das von mirage finde ich eigentlich weniger Verwendung. thanx trotzdem

@martinpb: thanxx das war genau das was ich wollte.
:dance:


Jetzt noch eine Frage:
Ist es nun überhaupt noch nötig,
die Eigenschaft einzeln auszulesen,
wo ich doch theoretisch gleich
die Font Eigenschaft mittels Move auslesen könnte
und 5 Schritte in einem Täte.

-seoman
seoman Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 24



BeitragVerfasst: So 23.05.04 06:43 
Um genau zu sein,
ich habe es gerade ausprobiert und
diese Zeile

ausblenden Delphi-Quelltext
1:
2:
...
DBGrid.Font := FontSettings;


verursacht eine AcessViolation.?

-seoman
seoman Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 24



BeitragVerfasst: So 23.05.04 07:16 
Okay, das nehm ich zurück.
Ich habe gerade entdeckt,
dass die Eigenschaft Font
gar nicht wie vermutet
alle Einstellungen (Name, Style, Size, ...)
schön kompakt enthält,
sondern LEER ist.

Naja,
muss ich halt jede einzeln abfragen. :?

-seoman