Autor Beitrag
Grolle
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 95

Win XP, Win 7
Delphi 2010 Pro
BeitragVerfasst: So 13.02.05 21:43 
Ich brauche mal nen Lösungsansatz:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
procedure TForm1.ToolButton20Click(Sender: TObject);
var
  farbe: TColor;
  ergebnis: String;
begin
    if ColorDialog1.Execute then
    farbe := ColorDialog1.Color;

  ergebnis :=   IntToHex(GetRValue(farbe),2)


              + IntToHex(GetGValue(farbe),2)
              + IntToHex(GetBValue(farbe),2);

  SynEdit1.SelText := '#'+(ergebnis);
end;

Die Prozedur übernimmt die Werte auch wenn man im Dialog
auf Abbrechen klickt. Warum ist mir klar, aber wie ändere
ich das?
:gruebel:
Danke: Grolle
Spaceguide
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 552


(D3/D7/D8) Prof.
BeitragVerfasst: So 13.02.05 21:55 
Die Variable farbe ist nicht initialisert, wenn du auf Abbrechen klickst, du solltest dann auch nicht das SynEdit ändern.
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: So 13.02.05 21:59 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
procedure TForm1.ToolButton20Click(Sender: TObject);
var
  farbe: TColor;
  ergebnis: String;
begin
  if ColorDialog1.Execute then begin
    farbe := ColorDialog1.Color;

    ergebnis :=   IntToHex(GetRValue(farbe),2)
                + IntToHex(GetGValue(farbe),2)
                + IntToHex(GetBValue(farbe),2);

    SynEdit1.SelText := '#'+(ergebnis);
    end;
end;


So. AXMD
Grolle Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 95

Win XP, Win 7
Delphi 2010 Pro
BeitragVerfasst: So 13.02.05 21:59 
Aber wie ändere ich das entsprechend ab?
wulfskin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1349
Erhaltene Danke: 1

Win XP
D5 Pers (SSL), D2005 Pro, C, C#
BeitragVerfasst: So 13.02.05 22:00 
Mach um das ganze einfach einen
ausblenden Delphi-Quelltext
1:
2:
3:
then begin

end;
Block herum!

_________________
Manche antworten um ihren Beitragszähler zu erhöhen, andere um zu Helfen.
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: So 13.02.05 22:01 
Ich war schneller :mrgreen:

AXMD
Grolle Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 95

Win XP, Win 7
Delphi 2010 Pro
BeitragVerfasst: So 13.02.05 22:05 
:D Besten Dank!