Wiki-KopieMirror

Dies ist ein Mirror des Wikis von pascal.chat. Bearbeiten, Verlauf und Anmeldung finden dort statt.

TRadioGroup/de

Deutsch · English · Français · Suomi · Русский · 日本語

Diese Seite erklärt, wie man die TRadioGroup Komponente verwendet. Auf etwas klicken bedeutet immer ein Linksklick, ein Rechtsklick wird explizit erwähnt.

Beschreibung

Eine Gruppe RadioButtons, aus dieser der Benutzer eine Auswahl treffen kann. Die Komponente ist wie eine TGroupBox mit integrierten TRadioButtons.

Verwendung

Um eine TRadioGroup auf einem Formular zu nutzen, kann man sie einfach auf der Komponentenpalette Standard auswählen und, mit einem Klick auf das Formular, platzieren.\

Kleines Beispiel

Es sollen geometrische Figuren zufällig und in Abhängigkeit der TRadioGroups auf das Formular gezeichnet werden. RadioGroup1 bestimmt die Form, RadioGroup2 die Anzahl.

pascal
procedure TForm1.rgShapeClick(Sender: TObject);
begin
  Repaint;
end;
pascal
procedure TForm1.FormPaint(Sender: TObject);
var
  i: Integer;
begin
  if TryStrToInt(rgCount.Items[rgCount.ItemIndex], i) then
    for i := 1 to i do begin
      Canvas.Pen.Color   := Random($1000000);
      Canvas.Brush.Color := Random($1000000);
      case rgShape.Items[rgShape.ItemIndex] of
        'Lines':      Canvas.Line(     Random(ClientWidth), Random(ClientHeight), Random(ClientWidth), Random(ClientHeight));
        'Rectangles': Canvas.Rectangle(Random(ClientWidth), Random(ClientHeight), Random(ClientWidth), Random(ClientHeight));
        'Ellipses':   Canvas.Ellipse(  Random(ClientWidth), Random(ClientHeight), Random(ClientWidth), Random(ClientHeight));
      end;
    end;
end;

Siehe auch


From the Free Pascal wiki, page "TRadioGroup/de", as it stood on 2020-03-01 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Version 2, zuletzt geändert von WikiArchive .