Autor Beitrag
Baumunk
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 50

WinXP
Delphi 2005
BeitragVerfasst: Mo 28.08.06 11:58 
Hallo,

In Windows API und In Delphi class TCanvas gibts function RundRect, der gerundete Rechteck zeichnet. In .NET Class Graphics habe ich den nicht gefunden. Gibts zu diese Function eqivalent in .NET oder heißt function blöß da anders?

Danke


Moderiert von user profile iconChristian S.: Topic aus WinForms verschoben am Mo 28.08.2006 um 12:03
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mo 28.08.06 12:03 
Beim Überfliegen der Methoden der Graphics-Klasse habe ich nichts gefunden, was danach aussieht. Es scheint so, als müsstest Du Dir das aus einer Kombination von DrawLine und DrawArc selber basteln.

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
Baumunk Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 50

WinXP
Delphi 2005
BeitragVerfasst: Mi 30.08.06 08:53 
Hallo,

Wenn es braucht habe ich ersatz zu RoundRect in .NET gebastelt:

ausblenden 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:
Procedure DrawRoundRect (G : System.Drawing.Graphics;
    Color, BorderColor : Color; R : Rectangle; X, Y : Integer);
  Var FSelectColor,
      FSelectBorderColor : System.Drawing.Color;
      Pen   : System.Drawing.Pen;
      Brush : System.Drawing.Brush;
      GPath : System.Drawing.Drawing2D.GraphicsPath;
  Begin
    GPath := System.Drawing.Drawing2D.GraphicsPath.Create;
    GPath.AddArc(Rectangle.Create(R.Left, R.Top, X * 2, Y * 2),18090);
    GPath.AddLine(r.Left + X, r.Top, R.Right - X, r.Top);

    GPath.AddArc(Rectangle.Create(r.Right - 2 * X - 1, R.Top, 2 * X,  2 * Y),27090);
    GPath.AddLine(r.Right - 1, r.Top + Y, r.Right - 1, r.Bottom - Y);

    GPath.AddArc(r.Right - 2 * X - 1, r.Bottom - 2 * Y - 12 * X, 2 * Y, 090);
    GPath.AddLine(r.Right - X - 1, r.Bottom - 1, r.Left + X, r.Bottom - 1);

    GPath.AddArc(r.Left, r.Bottom - 1 - 2 * Y, 2 * X, 2 * Y, 90,90);
    GPath.AddLine(r.Left, r.bottom - Y - 1, R.Left, r.Top + Y);

    Pen   := System.Drawing.Pen.Create (BorderColor, 1);
    Brush := System.Drawing.SolidBrush.Create(Color);
    G.FillPath(Brush, GPath);
    G.DrawPath(Pen, GPath);
  End;