Autor Beitrag
Müscha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 118



BeitragVerfasst: Mo 06.03.06 19:59 
Tach Leute,

ich programmiere grade ein quiz und überlege nun wie man die Antworten am besten darstellen kann. Ich hab bisher einfach die Antworten in Radiobuttons ausgegeben und mittels canvas einen rahmen drum gemalt, das sieht noch relativ einfach aus.

zu einfach.

hat jemand verbesserungsvorschläge wie man das grafisch besser machen kann?

dankeschön


Müscha
jomeier85
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 46



BeitragVerfasst: Mo 06.03.06 20:07 
Also ich würde das einfach komplett zeichnen, dann kannst du jede graphik verwenden, die du willst.

Den Text kannst du ja mit Canvas.Textout drüber schreiben.
Dann fragst du ab wo jemand hinklickt und wenn das in nem bestimmten bereich ist löst du das entsprechende ereigniss aus.

nur so ne idee aus dem stehgreif

mfg jomeier85
Müscha Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 118



BeitragVerfasst: Mo 06.03.06 20:16 
naja aber nur mit malen sieht das alles nich so aus wie ich das gern hätte, ich würde das gerne irgendwie besser haben wollen so ähnlich wie auf diesem bild.
Einloggen, um Attachments anzusehen!
adfontes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 82

Win7 (64bit), WinXP
Delphi 2010 Prof, Delphi XE2 (Trial)
BeitragVerfasst: Mo 06.03.06 20:24 
user profile iconMüscha hat folgendes geschrieben:
naja aber nur mit malen sieht das alles nich so aus wie ich das gern hätte, ich würde das gerne irgendwie besser haben wollen so ähnlich wie auf diesem bild.


Also sowas finde ich wesentlich einfacher in php machbar als in delphi (liegt wahrscheinlich daran, dass ich in Delphi noch nicht so weit bin, dass ich komplette Grafikoberflächen verwende anstelle des herkömlichen "trist-grau". Aber im php ist es relativ einfach machbar ^^
Müscha Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 118



BeitragVerfasst: Mo 06.03.06 20:37 
mhhh, also geht das nich so? wollte nur mal nachfragen ob man den delphi-style irgendwie verbessern kann, aber geht dann wahrscheinlich nich.

muss in der schule nen projekt in delphi machen und da is nix mit php, außerdem kann ich das auch nich=)
Kroko
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1284

W98 W2k WXP
Turbo D
BeitragVerfasst: Di 07.03.06 07:15 
na klar geht so etwas, aber Du wirst Dir eine eigene Komponente erstellen müssen, die die graphischen SPIELEREIEN auch verwirklicht.

_________________
Die F1-Taste steht nicht unter Naturschutz und darf somit regelmäßig und oft benutzt werden! oder Wer lesen kann, ist klar im Vorteil!
digi_c
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1905

W98, XP
D7 PE, Lazarus, WinAVR
BeitragVerfasst: Di 07.03.06 11:34 
Du könntest Skinkomponenten nehmen oder TBitButtons/TSpeedbuttons und noch ein Bild in den Hintergrund legen.
Tastaro
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 414
Erhaltene Danke: 23



BeitragVerfasst: Di 07.03.06 12:21 
Für einfachere Dinge braucht man weder Skins noch eine Komponente.
Da tut es auch ne Prozedur:

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
procedure TForm1.draw_label(ALabel: tlabel; iIndex: integer; strAnswer: string);
var
   strLetter: string;
begin
   case iIndex of
      1: strLetter := 'A';
      2: strLetter := 'B';
      3: strLetter := 'C';
      4: strLetter := 'D';
      else
         strLetter := '';
   end;
   ALabel.Canvas.Pen.Color := clLime;
   ALabel.Canvas.Pen.Width := 2;
   ALabel.Canvas.Brush.Color := clBlack;
   ALabel.Canvas.polygon([point(1, ALabel.Height div 2),
                          point(10, 0),
                          point(ALabel.Width - 10, 0),
                          point(ALabel.Width, ALabel.Height div 2),
                          point(ALabel.Width - 10, ALabel.Height - 1),
                          point(10, ALabel.Height - 1),
                          point(1, ALabel.Height div 2)]);

   ALabel.Canvas.Pen.Color := clRed;
   ALabel.Canvas.Pen.Width := 1;
   ALabel.Canvas.Font.Name := 'Arial';
   ALabel.Canvas.Font.Size := 12;
   ALabel.Canvas.Font.Style := [fsBold];

   ALabel.Canvas.Font.Color := clRed;
   ALabel.Canvas.textout(20, 4, strLetter + ':');
   ALabel.Canvas.Font.Color := clWhite;
   ALabel.Canvas.textout(60, 4, strAnswer);
end;


Beste Grüße
Tastaro
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Di 07.03.06 18:51 
Zusatz zu Tastaros Procedure, damit es gut aussieht:

Schriftart: Arial;
Schriftgröße: 18;
Caption: Viele Leerzeichen;

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Müscha Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 118



BeitragVerfasst: Di 07.03.06 19:07 
danke erstma, ich wolltes gleich mal ausprobieren, bin aber an dem hier

ausblenden Quelltext
1:
procedure TForm1.draw_label(ALabel: tlabel; iIndex: integer; strAnswer: string);					


gescheitert! Brauch ich da ne extra komponente? wo finde ich die?

müscha
Danniolo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 693



BeitragVerfasst: Di 07.03.06 19:10 
Nein, du brauchst dafür keine extra Komponente, sonern musst die Procedure ersteinmal deklarieren.
Am besten hier:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
type
  TForm1 = class(TForm)
  private
    { Private-Deklarationen }
    procedure draw_label(ALabel: tlabel; iIndex: integer; strAnswer: string);
  public
    { Public-Deklarationen }
  end;


Dann kannst muss die eigentliche Procedure in den "Codebreich", also hinter
ausblenden Delphi-Quelltext
1:
2:
implementation
{$R *.DFM}


Aufrufen tust du die Procedure dann so:

ausblenden Delphi-Quelltext
1:
  draw_label(BlubbLabel1, 2,'blubbb');					
Müscha Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 118



BeitragVerfasst: Di 07.03.06 19:21 
Ohoh, wie mach ich das denn, also ich zeig mal was ich so denke ob das so richtig ist? Hab sowas noch nie gemacht.

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Label1: ALabel;
    Label2: TLabel;

  private
    { Private-Deklarationen }
  procedure draw_label(ALabel: tlabel; iIndex: integer; strAnswer: string);

  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}


procedure TForm1.draw_label(ALabel: tlabel; iIndex: integer; strAnswer: string);

var
   strLetter: string;
begin
   case iIndex of
      1: strLetter := 'A';
      2: strLetter := 'B';
      3: strLetter := 'C';
      4: strLetter := 'D';
      else
         strLetter := '';
   end;
   ALabel.Canvas.Pen.Color := clLime;
   ALabel.Canvas.Pen.Width := 2;
   ALabel.Canvas.Brush.Color := clBlack;
   ALabel.Canvas.polygon([point(1, ALabel.Height div 2),
                          point(10, 0),
                          point(ALabel.Width - 10, 0),
                          point(ALabel.Width, ALabel.Height div 2),
                          point(ALabel.Width - 10, ALabel.Height - 1),
                          point(10, ALabel.Height - 1),
                          point(1, ALabel.Height div 2)]);

   ALabel.Canvas.Pen.Color := clRed;
   ALabel.Canvas.Pen.Width := 1;
   ALabel.Canvas.Font.Name := 'Arial';
   ALabel.Canvas.Font.Size := 12;
   ALabel.Canvas.Font.Style := [fsBold];

   ALabel.Canvas.Font.Color := clRed;
   ALabel.Canvas.textout(20, 4, strLetter + ':');
   ALabel.Canvas.Font.Color := clWhite;
   ALabel.Canvas.textout(60, 4, strAnswer);
end;



end.



könnt ihr mir das erklären oder wenigstens nen link schicken wo ich das lernen kann, wenn das zu aufwendig ist?

Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt
Danniolo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 693



BeitragVerfasst: Di 07.03.06 19:25 
so sollte das eigentlich funktionieren. Jetzt eigentlich nur noch der Aufruf *g*..
Zitat:
könnt ihr mir das erklären oder wenigstens nen link schicken wo ich das lernen kann, wenn das zu aufwendig ist?

was meinst du damit?
Müscha Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 118



BeitragVerfasst: Di 07.03.06 19:30 
geht leider trotzdem nich =(

zeigt nix an, also ich hab 2 Labels auf meiner Form, mit den Namen "TLabel" und "ALabel". Das wars! brauch ich nochwas?

was hat das mit dem "iIndex" und dem "strLetter" auf sich, brauch ich da noch was?
Müscha Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 118



BeitragVerfasst: Di 07.03.06 19:31 
naja keine ahnung, ich dachte das ist aufwendiger mit der eigenen Procedure...;)
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Di 07.03.06 19:42 
Du nennst das eine Label z.B. Label1 und das andere Label2. Bei OnCreate (doppelklick auf Form):
ausblenden Delphi-Quelltext
1:
2:
draw_label(Label1, 1, 'Die Antwort, die bei Label1 stehen soll.');
draw_label(Label2, 2, 'Die Antwort, die bei Label2 stehen soll.');

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Danniolo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 693



BeitragVerfasst: Di 07.03.06 19:44 
user profile iconMüscha hat folgendes geschrieben:
geht leider trotzdem nich =(

zeigt nix an, also ich hab 2 Labels auf meiner Form, mit den Namen "TLabel" und "ALabel". Das wars! brauch ich nochwas?

was hat das mit dem "iIndex" und dem "strLetter" auf sich, brauch ich da noch was?


Deine Labels müssen natürlich anders heißen!! z.B. Label1, Label2, etc.

Das hier sollte funktionieren:

Alabel ist in der Funktion dabei das Label, auf dem gezeichnet werden soll (eigentlich nimmt man für sowas ja ne PaintBox *g*), der Index gib an, welcher Antwortbuchstaben (also a, b, c, etc.) angezeigt wird und strAnswer ist die Antwort der Frage

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
    procedure draw_label(ALabel: tlabel; iIndex: integer; strAnswer: string);
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.draw_label(ALabel: tlabel; iIndex: integer; strAnswer: string);
var
   strLetter: string;
begin
   case iIndex of
      1: strLetter := 'A';
      2: strLetter := 'B';
      3: strLetter := 'C';
      4: strLetter := 'D';
      else
         strLetter := '';
   end;
   ALabel.Canvas.Pen.Color := clLime;
   ALabel.Canvas.Pen.Width := 2;
   ALabel.Canvas.Brush.Color := clBlack;
   ALabel.Canvas.polygon([point(1, ALabel.Height div 2),
                          point(10, 0),
                          point(ALabel.Width - 10, 0),
                          point(ALabel.Width, ALabel.Height div 2),
                          point(ALabel.Width - 10, ALabel.Height - 1),
                          point(10, ALabel.Height - 1),
                          point(1, ALabel.Height div 2)]);

   ALabel.Canvas.Pen.Color := clRed;
   ALabel.Canvas.Pen.Width := 1;
   ALabel.Canvas.Font.Name := 'Arial';
   ALabel.Canvas.Font.Size := 12;
   ALabel.Canvas.Font.Style := [fsBold];

   ALabel.Canvas.Font.Color := clRed;
   ALabel.Canvas.textout(20, 4, strLetter + ':');
   ALabel.Canvas.Font.Color := clWhite;
   ALabel.Canvas.textout(60, 4, strAnswer);
end;


procedure TForm1.Button1Click(Sender: TObject);
begin
  draw_label(Label1,1,'Antwort1');
  draw_label(Label2,2,'Antwort2');
  draw_label(Label3,3,'Antwort3');
  draw_label(Label4,4,'Antwort4');
end;

end.
Müscha Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 118



BeitragVerfasst: Di 07.03.06 19:51 
Ahhhhhhhh, ihr seid ja der Hammer, sieht echt genial aus, vielen vielen Dank!!!!!



Müscha