Autor Beitrag
Gast
Gast
Erhaltene Danke: 1



BeitragVerfasst: Do 23.11.06 22:54 
ser jungs und au mädels,
also ich hab zurzeit vor eine art paint zu programmieren. hab da aber ein problem wenn ich Strecken zeichnen möchte. vll. erkennt ihr dat problem
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
if linie then
  begin
  canvas.moveto(x1,y1);
  canvas.LineTo(x,y);
  canvas.pen.width:=z;
 end;


und dabei hab ich folgendes problem wie ihr vll. sieht.
[img] fotoalbum.web.de/alb...&imageType=image [/img]

hier ist zu sehen, dass die strecken gespeichert werden und wie kann ich das problem lösen, das es nur noch eine Strecke gibt und nicht immer solche Objekte herauskommen.

also wenn das problem net klar ist sagt es einfach, dann probiere ich es ausführlicher aus zu formalieren.



danke im voraus scho mal.
dome
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 23.11.06 23:06 
Moin und :welcome: im Forum!

Schätze mal, du aktualisierst die Mauskoordinaten nicht. ;) Aber ohne mehr Code, wird das schwer, genaueres zu sagen. :?

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Dragonclaw
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 196

Windows Vista
Delphi 7 Prof.
BeitragVerfasst: Do 23.11.06 23:11 
Hallo!

Probier mal diese Zeile aus, einfach am Begin der Prozedur/Funktion einfügen.

ausblenden Delphi-Quelltext
1:
Image1.canvas.pen.mode:=pmNotXor;					


eventuell Musst du das Image1 abändern, jenach dem worauf du zeichnest.

Dann sollte das gehen. Ich versteh zwar nicht genau was passiert, bei meinem programm hats geholfen.
floppi-wd
Hält's aus hier
Beiträge: 2



BeitragVerfasst: Fr 24.11.06 14:31 
naja ok danke,
also das mit pmNotXor hab ich au scho probiert nur klappen tut es damit au net aufjedenfall net bei mir. verzweifelt bin ich.

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:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
  private
    { Private-Deklarationen }
    z,x1,y1,x2,y2,radius:integer;
    rechteck, kreis, zeichnen, punkt, radier,dreieck,linie :boolean;
    farbe:Tcolor;
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
 panel1.caption:=IntToStr(x)+' : '+IntToStr(y);
 if shift=[ssLeft] then
 begin
  if rechteck then
  begin
   canvas.Rectangle(x1,y1,x2,y2);
   x2:=x;y2:=y;
   canvas.rectangle(x1,y1,x2,y2);
  end;
  if kreis then
  begin
   radius:=round(sqrt(sqr(x2-x1)+sqr(y2-y1)));
   canvas.Ellipse(x1-radius,y1-radius,x1+radius,y1+radius);
   x2:=x;y2:=y;
   radius:=round(sqrt(sqr(x2-x1)+sqr(y2-y1)));
   canvas.Ellipse(x1-radius,y1-radius,x1+radius,y1+radius);
  end;
  if zeichnen then
  begin
   canvas.MoveTo(x1,y1);
   x1:=x;y1:=y;
   x2:=x;y2:=y;
   canvas.LineTo(x2,y2);
   z:=strtoint(edit1.text);
   canvas.pen.Width:=z;
   Canvas.Pen.Color := ColorGrid2.foregroundColor;

  end;
  if radier then
  begin
   //canvas.refresh;
   z:=StrToInt(edit1.Text);
   canvas.Pen.Width:=z;
   canvas.Pen.Mode:=pmcopy;
   canvas.Pen.Color:=Form1.color;
   canvas.MoveTo(x1,y1);
   x1:=x;y1:=y;
   x2:=x;y2:=y;
   canvas.LineTo(x2,y2);
   canvas.Pen.Width:=1;
   canvas.Pen.Mode:=pmNotXor;
  end;
  if linie then
  begin
  canvas.moveto(x1,y1);
  canvas.LineTo(x,y);
  canvas.pen.width:=z;
  end;
 end;
end;

procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
 if shift=[ssLeft] then
 begin
  x1:=x;y1:=y;x2:=x;y2:=y;
  if punkt then canvas.Pixels[x,y]:=clblack;
 end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
 canvas.Pen.Mode:=pmNotXor;
 canvas.Pen.style:=pssolid;//psDot;
 canvas.Brush.Style:=bsclear;
 canvas.Brush.Color:=farbe;
 rechteck:=false;
 kreis:=false;zeichnen:=false;punkt:=false;radier:=false;
end;


also ist ein teil meines quellcodes der relevant sein dürfte. hoffe ihr habt ne lösung für mein problem. danke

dome
Ist die Frage beantwortet? Das Problem gelöst?

Dann klicke hier, um das Thema entsprechend zu markieren!