Håber du kan se problemmet og har en løsning!
Dit problem er afrunding. Istedet for at bruge Trunc, så prøv at bruge Round. Så vil du ved 6 f.eks. få:
17, 33, 50, 67, 83, 100 i stedet for
16, 32, 48, 64, 80, 96
Eller ved 3:
33, 67, 100 i stedet for
33, 66, 99
(Efter nærlæsning af problemet): Problemet er at det du vil ikke kan lade sig gøre med en TSpinEdit i og med den KUN arbejder med heltal. Du skal bruge en tilsvarende komponent som arbejder med float. Der kan du blive nødt til at skrive den selv.
MEGET simpelt eksempel:
unit FloatSpin;
uses
interface
Uses
Windows, SysUtils, Spin;
type
TFloatSpinEdit = Class(TSpinEdit)
private
FMinFloatValue: Double;
FMaxFloatValue: Double;
FFloatIncrement: Double;
function GetFloatValue: Double;
procedure SetFloatValue(const Value: Double);
function CheckFloatValue (NewValue: Double): Double;
protected
procedure UpClick (Sender: TObject); Override;
procedure DownClick (Sender: TObject); Override;
// Skjul heltals egenskaberne
property Increment;
property MaxValue;
property MinValue;
property Value;
public
published
property FloatIncrement: Double read FFloatIncrement write FFloatIncrement;
property MaxFloatValue: Double read FMaxFloatValue write FMaxFloatValue;
property MinFloatValue: Double read FMinFloatValue write FMinFloatValue;
property FloatValue: Double read GetFloatValue write SetFloatValue;
end;
implementation
procedure TFloatSpinEdit.UpClick(Sender: TObject);
begin
if ReadOnly then
MessageBeep(0)
else
FloatValue := FloatValue + FFloatIncrement;
end;
procedure TFloatSpinEdit.DownClick(Sender: TObject);
begin
if ReadOnly then
MessageBeep(0)
else
FloatValue := FloatValue - FFloatIncrement;
end;
function TFloatSpinEdit.GetFloatValue: Double;
begin
try
Result := StrToFloat(Text);
except
Result := FMinFloatValue;
end;
end;
procedure TFloatSpinEdit.SetFloatValue(const Value: Double);
begin
Text := FloatToStr (Round(CheckFloatValue (Value)));
end;
function TFloatSpinEdit.CheckFloatValue(NewValue: Double): Double;
begin
Result := NewValue;
if (FMaxFloatValue <> FMinFloatValue) then
begin
if NewValue < FMinFloatValue then
Result := FMinFloatValue
else if NewValue > FMaxFloatValue then
Result := FMaxFloatValue;
end;
end;
Du kan teste den ved at gøre følgende:
Opret en ny applikation,
Tilføj FloatSpin unitten til din Unit1,
dobbelt-klik på den tomme form,
Indsæt følgende i FormCreate:
procedure TForm1.FormCreate(Sender: TObject);
begin
with TFloatSpinEdit.Create(self) do
begin
Parent := Self;
Left := 100;
Top := 100;
FloatIncrement := (100.0 / 6.0);
MaxFloatValue := 100.0;
MinFloatValue := 0.0;
end;
end;
--
Thomas Due
Software developer
udvikleren.dk - ASP redaktør
tdue@mail.dk
[Redigeret d. 01/07-04 15:21:45 af Thomas Due]
Hej Thomas
Mange tak for dit forslag til løsning, af midt problem beskrevet i tråden her:
http://www.udvikleren.dk/thread.php?techid=2&f=2&t=1642 Problemformulering:
Betragt det som, at vi skal skære et stykke tømmer, vi skal havde det skåret op i 8 lige store stykker og
med en længde på 5000 mm.
Det skulle gerne give 8 stykker af 625 mm. Med TSpinEdit bliver der en rest!
Se her: www.sunwind.dk/profilvalg.jpg
Har forsøgt at integrer komponent FloatSpin, men det løkkes ikke!
Har du en ide om hvordan det så skal gøres?
Knap med title: Sæt antal sektionerFloatSpin
procedure TfmProfilValg.Button1Click(Sender: TObject);
var
AntalSek : integer;
begin
antalsek := StrToIntDef(Inputbox('Indskriv antal sektioner','Heltal','1'),-1);
serRadius.FloatIncrement:= trunc(100/AntalSek);
serRadius.MinFloatValue := 1; //25
serRadius.MaxFloatValue := 100;
serRadius.MinFloatValue := trunc((100 div AntalSek)+0.5);
end;
Hele Unit'en her:
unit Unit3;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Printers, Grids, ExtCtrls, DBCtrls,Math, Spin, Registry,
ShellAPI, MinUnits, Menus,FloatSpin;
type
TfmProfilValg = class(TForm)
btnExit: TButton;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
RadioButton3: TRadioButton;
RadioButton4: TRadioButton;
RadioButton5: TRadioButton;
RadioButton6: TRadioButton;
SaveDialog1: TSaveDialog;
Memo1: TMemo;
OpenDialog1: TOpenDialog;
PrintDialog1: TPrintDialog;
btnTegnProfil: TButton;
Panel1: TPanel;
serRadius: TSpinEdit;
Label1: TLabel;
PrinterSetupDialog1: TPrinterSetupDialog;
Label3: TLabel;
MainMenu1: TMainMenu;
File1: TMenuItem;
Open1: TMenuItem;
GemSom1: TMenuItem;
Print1: TMenuItem;
Button1: TButton;
Label2: TLabel;
Afslut1: TMenuItem;
Button2: TButton;
procedure btnExitClick(Sender: TObject);
procedure RadioButton1Click(Sender: TObject);
procedure RadioButton2Click(Sender: TObject);
procedure RadioButton3Click(Sender: TObject);
procedure RadioButton4Click(Sender: TObject);
procedure RadioButton5Click(Sender: TObject);
procedure RadioButton6Click(Sender: TObject);
procedure btnTegnProfilClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure StandartTekstNaca4415;
procedure StandartTekstFX72MS150B;
procedure StandartTekstNaca4412;
procedure StandartTekstNaca4418;
procedure StandartTekstNaca4421;
procedure StandartTekstNaca23012;
procedure serRadiusChange(Sender: TObject);
Procedure Linescroll_Op;
procedure GemSom1Click(Sender: TObject);
procedure Open1Click(Sender: TObject);
procedure Print1Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Afslut1Click(Sender: TObject);
procedure serRadiusKeyPress(Sender: TObject; var Key: Char);
procedure Memo1Change(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
sx,sYo,sYn:string;
end;
var
fmProfilValg: TfmProfilValg;
Naca4415X, Naca4415OP, Naca4415NED,X,Yop,Yned, Profilbredde : array [0..18] of Double;
ProfilXaksle,ProfilYOpAkse,ProfilYNedAkse,Sektion,SektionBredde : array [0..18] of Double;
Profilbreddemaal : String;
implementation
uses Unit1,Unit4,Unit5;
{$R *.dfm}
procedure TfmProfilValg.btnExitClick(Sender: TObject);
begin
fmProfilValg.Hide;
Form1.Show;
Form1.Update;
end;
procedure TfmProfilValg.RadioButton1Click(Sender: TObject);
var
n : Integer;
begin
if not (radius >1) or not (p >1) then begin
Showmessage('Der er ikke indtastet nogen talværdier for NACA 4415');
Form1.Profilvalg1Click(Sender);
end else begin
Memo1.Clear;
frmProfil.seZoom.Value:=0;
frmProfil.seVinkel.Value:=0;
Memo1.Font.Name:='courier new';
Memo1.Font.Size:=9;
for n:=1 to 18 do begin
Naca4415X[n]:= 0.00; Naca4415OP[n] := 0.00; Naca4415NED[n] := 0.00;
end;
for n:=1 to 18 do
Naca4415X[0] := 0.00; Naca4415OP[0] := 0.00; Naca4415NED[0] := 0.00;
Naca4415X[1] := 1.25; Naca4415OP[1] := 3.07; Naca4415NED[1] := -1.79;
Naca4415X[2] := 2.50; Naca4415OP[2] := 4.18; Naca4415NED[2] := -2.48;
Naca4415X[3] := 5.00; Naca4415OP[3] := 5.74; Naca4415NED[3] := -3.27;
Naca4415X[4] := 7.50; Naca4415OP[4] := 6.91; Naca4415NED[4] := -3.71;
Naca4415X[5] := 10.00; Naca4415OP[5] := 7.84; Naca4415NED[5] := -3.98;
Naca4415X[6] := 15.00; Naca4415OP[6] := 9.27; Naca4415NED[6] := -4.18;
Naca4415X[7] := 20.00; Naca4415OP[7] := 10.25; Naca4415NED[7] := -4.15;
Naca4415X[8] := 25.00; Naca4415OP[8] := 10.92; Naca4415NED[8] := -3.98;
Naca4415X[9] := 30.00; Naca4415OP[9] := 11.25; Naca4415NED[9] := -3.75;
Naca4415X[10] := 40.00; Naca4415OP[10] := 11.25; Naca4415NED[10] := -3.25;
Naca4415X[11] := 50.00; Naca4415OP[11] := 10.53; Naca4415NED[11] := -2.72;
Naca4415X[12] := 60.00; Naca4415OP[12] := 9.30; Naca4415NED[12] := -2.14;
Naca4415X[13] := 70.00; Naca4415OP[13] := 7.63; Naca4415NED[13] := -1.55;
Naca4415X[14] := 80.00; Naca4415OP[14] := 5.55; Naca4415NED[14] := -1.03;
Naca4415X[15] := 90.00; Naca4415OP[15] := 3.08; Naca4415NED[15] := -0.57;
Naca4415X[16] := 95.00; Naca4415OP[16] := 1.67; Naca4415NED[16] := -0.35;
Naca4415X[17] := 100.00; Naca4415OP[17] := 0.16; Naca4415NED[17] := -0.16;
Naca4415X[18] := 100.00; Naca4415OP[18] := 0.00; Naca4415NED[18] := -0.00;
Rkonstant:= serRadius.Value/100;
//Sektion[n]:= (Rkonstant/10)*radius;
//Memo1.Lines.Add('Rkonstant r/R: '+ FormatFloat('#0',Rkonstant));
Memo1.Lines.Add('VingeProfil Type NACA 4415 ');
Memo1.Lines.Add('VingeRadius '+ FormatFloat('#0',radius)+' mm');
Memo1.Lines.Add('Afstand fra vingerod '+ FormatFloat('#0',(Rkonstant)* radius)+' mm');
Memo1.Lines.Add('ProfilBredde '+
FormatFloat('#0.0',(5.6*radius)/(i*1.0*Rkonstant*(power(5,2))))+' mm');
Profilbredde[18]:= (5.6*radius)/(i*1.0*Rkonstant*(power(5,2)));
Profilbreddemaal:= FloatToStr(Profilbredde[18]);
//Showmessage(FloatToStr(Profilbredde[18]/10));
Memo1.Lines.Add(' ');
for n:=1 to 18 do
begin
//SektionBredde[n]:= (16*pi*power(5000,2))/(9*i*1.0*2500*(power(5,2)));
SektionBredde[n]:= (5.6*radius)/(i*1.0*Rkonstant*(power(5,2)));
X[n] := (SektionBredde[n] * Naca4415X[n]);
Yop[n] := (SektionBredde[n] * Naca4415OP[n]);
Yned[n]:= (SektionBredde[n] * Naca4415NED[n]);
sx:= Format('%8.1f',[X[n]/100]);
sYo:= Format('%8.1f',[Yop[n]/100]);
sYn:= Format('%8.1f',[Yned[n]/100]);
Memo1.Lines.Add('X[Hen]:'+sx+' Y[op]:'+sYo+' Y[Ned]:'+sYn);
Panel1.Caption:=(' Vingebredde: '+ FormatFloat('#,##0.00;;Zero', SektionBredde[n])+'
mm.');
// Afstanden fra rod til NACA-profilet beregnes
Label3.Caption:=('Afstand fra vingerod '+ FormatFloat('#0',(Rkonstant)* radius)+' mm');
//Får Memo1 til øverste linje
Linescroll_Op;
end;
end;
end;
procedure TfmProfilValg.RadioButton2Click(Sender: TObject);
var
n: Integer;
begin
if not (radius >1) or not (p >1) then begin
Showmessage('Der er ikke indtastet nogen talværdier for NACA FX 72-MS-150 B');
Form1.Profilvalg1Click(Sender);
end else begin
Memo1.Clear;
frmProfil.seZoom.Value:=0;
frmProfil.seVinkel.Value:=0;
Memo1.Font.Name:='courier new';
Memo1.Font.Size:=9;
for n:=1 to 18 do
begin
Naca4415X[n]:= 0.00; Naca4415OP[n] := 0.00; Naca4415NED[n] := 0.00;
end;
for n:=1 to 18 do
Naca4415X[0] := 0.00; Naca4415OP[0] := 0.00; Naca4415NED[0] := 0.00;
Naca4415X[1] := 1.70; Naca4415OP[1] := 3.07; Naca4415NED[1] := -1.23;
Naca4415X[2] := 2.65; Naca4415OP[2] := 4.10; Naca4415NED[2] := -1.24;
Naca4415X[3] := 5.16; Naca4415OP[3] := 6.15; Naca4415NED[3] := -1.14;
Naca4415X[4] := 6.69; Naca4415OP[4] := 7.26; Naca4415NED[4] := -1.03;
Naca4415X[5] := 10.33; Naca4415OP[5] := 9.43; Naca4415NED[5] := -0.72;
Naca4415X[6] := 19.56; Naca4415OP[6] := 13.32; Naca4415NED[6] := 0.13;
Naca4415X[7] := 30.86; Naca4415OP[7] := 16.05; Naca4415NED[7] := 1.16;
Naca4415X[8] := 40.24; Naca4415OP[8] := 16.86; Naca4415NED[8] := 2.09;
Naca4415X[9] := 50.00; Naca4415OP[9] := 16.16; Naca4415NED[9] := 3.27;
Naca4415X[10] := 59.75; Naca4415OP[10] := 14.21; Naca4415NED[10] := 4.25;
Naca4415X[11] := 69.13; Naca4415OP[11] := 11.55; Naca4415NED[11] := 4.64;
Naca4415X[12] := 80.43; Naca4415OP[12] := 7.50; Naca4415NED[12] := 4.07;
Naca4415X[13] := 91.57; Naca4415OP[13] := 3.23; Naca4415NED[13] := 2.21;
Naca4415X[14] := 100.00; Naca4415OP[14] := 0.00; Naca4415NED[14] := 0.00;
Naca4415X[15] := 100.00; Naca4415OP[14] := 0.00; Naca4415NED[14] := 0.00;
Naca4415X[16] := 100.00; Naca4415OP[14] := 0.00; Naca4415NED[14] := 0.00;
Naca4415X[17] := 100.00; Naca4415OP[14] := 0.00; Naca4415NED[14] := 0.00;
Naca4415X[18] := 100.00; Naca4415OP[14] := 0.00; Naca4415NED[14] := 0.00;
Rkonstant:= serRadius.Value/100;
//Sektion[n]:= (Rkonstant/10)*radius;
//Memo1.Lines.Add('Rkonstant r/R: '+ FormatFloat('#0',Rkonstant));
Memo1.Lines.Add('VingeProfil Type FX 72-MS-150 B');
Memo1.Lines.Add('VingeRadius '+ FormatFloat('#0',radius)+' mm');
Memo1.Lines.Add('Afstand fra vingerod '+ FormatFloat('#0',(Rkonstant)* radius)+' mm');
Memo1.Lines.Add('ProfilBredde '+
FormatFloat('#0.0',(5.6*radius)/(i*1.0*Rkonstant*(power(5,2))))+' mm');
Profilbredde[18]:= (5.6*radius)/(i*1.0*Rkonstant*(power(5,2)));
Profilbreddemaal:= FloatToStr(Profilbredde[18]);
Memo1.Lines.Add(' ');
for n:=1 to 18 do
begin
//SektionBredde[n]:= (16*pi*power(5000,2))/(9*i*1.0*2500*(power(5,2)));
SektionBredde[n]:= (5.6*radius)/(i*1.0*Rkonstant*(power(5,2)));
X[n] := (SektionBredde[n] * Naca4415X[n]);
Yop[n] := (SektionBredde[n] * Naca4415OP[n]);
Yned[n]:= (SektionBredde[n] * Naca4415NED[n]);
sx:= Format('%8.1f',[X[n]/100]);
sYo:= Format('%8.1f',[Yop[n]/100]);
sYn:= Format('%8.1f',[Yned[n]/100]);
Memo1.Lines.Add('X[Hen]:'+sx+' Y[op]:'+sYo+' Y[Ned]:'+sYn);
Panel1.Caption:=(' Vingebredde: '+ FormatFloat('#00.0', SektionBredde[n])+' mm.');
// Afstanden fra rod til NACA-profilet beregnes
Label3.Caption:=('Afstand fra vingerod '+ FormatFloat('#0',(Rkonstant)* radius)+' mm');
//Får Memo1 til øverste linje
Linescroll_Op;
end; // for..next.
end;
end;
procedure TfmProfilValg.RadioButton3Click(Sender: TObject);
var
n: Integer;
begin
if not (radius >1) or not (p >1) then begin
Showmessage('Der er ikke indtastet nogen talværdier for NACA 4412');
Form1.Profilvalg1Click(Sender);
end else begin
Memo1.Clear;
frmProfil.seZoom.Value:=0;
frmProfil.seVinkel.Value:=0;
Memo1.Font.Name:='courier new';
Memo1.Font.Size:=9;
for n:=1 to 18 do begin
Naca4415X[n]:= 0.00; Naca4415OP[n] := 0.00; Naca4415NED[n] := 0.00;
end;
for n:=1 to 18 do
Naca4415X[0] := 0.00; Naca4415OP[0] := 0.00; Naca4415NED[0] := 0.00;
Naca4415X[1] := 1.25; Naca4415OP[1] := 2.44; Naca4415NED[1] := -1.43;
Naca4415X[2] := 2.50; Naca4415OP[2] := 3.39; Naca4415NED[2] := -1.95;
Naca4415X[3] := 5.00; Naca4415OP[3] := 4.73; Naca4415NED[3] := -2.49;
Naca4415X[4] := 7.50; Naca4415OP[4] := 5.76; Naca4415NED[4] := -2.74;
Naca4415X[5] := 10.00; Naca4415OP[5] := 6.59; Naca4415NED[5] := -2.86;
Naca4415X[6] := 15.00; Naca4415OP[6] := 7.89; Naca4415NED[6] := -2.88;
Naca4415X[7] := 20.00; Naca4415OP[7] := 8.80; Naca4415NED[7] := -2.74;
Naca4415X[8] := 25.00; Naca4415OP[8] := 9.41; Naca4415NED[8] := -2.50;
Naca4415X[9] := 30.00; Naca4415OP[9] := 9.76; Naca4415NED[9] := -2.26;
Naca4415X[10] := 40.00; Naca4415OP[10] := 9.80; Naca4415NED[10] := -1.80;
Naca4415X[11] := 50.00; Naca4415OP[11] := 9.19; Naca4415NED[11] := -1.40;
Naca4415X[12] := 60.00; Naca4415OP[12] := 8.14; Naca4415NED[12] := -1.00;
Naca4415X[13] := 70.00; Naca4415OP[13] := 6.69; Naca4415NED[13] := -0.65;
Naca4415X[14] := 80.00; Naca4415OP[14] := 4.89; Naca4415NED[14] := -0.39;
Naca4415X[15] := 90.00; Naca4415OP[15] := 2.71; Naca4415NED[15] := -0.22;
Naca4415X[16] := 95.00; Naca4415OP[16] := 1.47; Naca4415NED[16] := -0.16;
Naca4415X[17] := 100.00; Naca4415OP[17] := 0.13; Naca4415NED[17] := -0.13;
Naca4415X[18] := 100.00; Naca4415OP[18] := 0.00; Naca4415NED[18] := -0.00;
Rkonstant:= serRadius.Value/100;
//Sektion[n]:= (Rkonstant/10)*radius;
//Memo1.Lines.Add('Rkonstant r/R: '+ FormatFloat('#0',Rkonstant));
Memo1.Lines.Add('VingeProfil Type NACA 4412 ');
Memo1.Lines.Add('VingeRadius '+ FormatFloat('#0',radius)+' mm');
Memo1.Lines.Add('Afstand fra vingerod '+ FormatFloat('#0',(Rkonstant)* radius)+' mm');
Memo1.Lines.Add('ProfilBredde '+
FormatFloat('#0.0',(5.6*radius)/(i*1.0*Rkonstant*(power(5,2))))+' mm');
Profilbredde[18]:= (5.6*radius)/(i*1.0*Rkonstant*(power(5,2)));
Profilbreddemaal:= FloatToStr(Profilbredde[18]);
Memo1.Lines.Add(' ');
for n:=1 to 18 do
begin
//SektionBredde[n]:= (16*pi*power(5000,2))/(9*i*1.0*2500*(power(5,2)));
SektionBredde[n]:= (5.6*radius)/(i*1.0*Rkonstant*(power(5,2)));
X[n] := (SektionBredde[n] * Naca4415X[n]);
Yop[n] := (SektionBredde[n] * Naca4415OP[n]);
Yned[n]:= (SektionBredde[n] * Naca4415NED[n]);
sx:= Format('%8.1f',[X[n]/100]);
sYo:= Format('%8.1f',[Yop[n]/100]);
sYn:= Format('%8.1f',[Yned[n]/100]);
Memo1.Lines.Add('X[Hen]:'+sx+' Y[op]:'+sYo+' Y[Ned]:'+sYn);
Panel1.Caption:=(' Vingebredde: '+ FormatFloat('#,##0.00;;Zero', SektionBredde[n])+'
mm.');
// Afstanden fra rod til NACA-profilet beregnes
Label3.Caption:=('Afstand fra vingerod '+ FormatFloat('#0',(Rkonstant)* radius)+' mm');
//Får Memo1 til øverste linje
Linescroll_Op;
end;
end;
end;
procedure TfmProfilValg.RadioButton4Click(Sender: TObject);
var
n: Integer;
begin
if not (radius >1) or not (p >1) then begin
Showmessage('Der er ikke indtastet nogen talværdier for NACA 4418');
Form1.Profilvalg1Click(Sender);
end else begin
Memo1.Clear;
frmProfil.seZoom.Value:=0;
frmProfil.seVinkel.Value:=0;
Memo1.Font.Name:='courier new';
Memo1.Font.Size:=9;
for n:=1 to 18 do begin
Naca4415X[n]:= 0.00; Naca4415OP[n] := 0.00; Naca4415NED[n] := 0.00;
end;
for n:=1 to 18 do
Naca4415X[0] := 0.00; Naca4415OP[0] := 0.00; Naca4415NED[0] := 0.00;
Naca4415X[1] := 1.25; Naca4415OP[1] := 3.76; Naca4415NED[1] := -2.11;
Naca4415X[2] := 2.50; Naca4415OP[2] := 5.00; Naca4415NED[2] := -2.99;
Naca4415X[3] := 5.00; Naca4415OP[3] := 6.75; Naca4415NED[3] := -4.06;
Naca4415X[4] := 7.50; Naca4415OP[4] := 8.06; Naca4415NED[4] := -4.67;
Naca4415X[5] := 10.00; Naca4415OP[5] := 9.11; Naca4415NED[5] := -5.06;
Naca4415X[6] := 15.00; Naca4415OP[6] := 10.66; Naca4415NED[6] := -5.49;
Naca4415X[7] := 20.00; Naca4415OP[7] := 11.72; Naca4415NED[7] := -5.56;
Naca4415X[8] := 25.00; Naca4415OP[8] := 12.40; Naca4415NED[8] := -5.49;
Naca4415X[9] := 30.00; Naca4415OP[9] := 12.76; Naca4415NED[9] := -5.26;
Naca4415X[10] := 40.00; Naca4415OP[10] := 12.70; Naca4415NED[10] := -4.70;
Naca4415X[11] := 50.00; Naca4415OP[11] := 11.85; Naca4415NED[11] := -4.02;
Naca4415X[12] := 60.00; Naca4415OP[12] := 10.44; Naca4415NED[12] := -3.24;
Naca4415X[13] := 70.00; Naca4415OP[13] := 8.55; Naca4415NED[13] := -2.45;
Naca4415X[14] := 80.00; Naca4415OP[14] := 6.22; Naca4415NED[14] := -1.67;
Naca4415X[15] := 90.00; Naca4415OP[15] := 3.46; Naca4415NED[15] := -0.93;
Naca4415X[16] := 95.00; Naca4415OP[16] := 1.89; Naca4415NED[16] := -0.55;
Naca4415X[17] := 100.00; Naca4415OP[17] := 0.19; Naca4415NED[17] := -0.19;
Naca4415X[18] := 100.00; Naca4415OP[18] := 0.00; Naca4415NED[18] := -0.00;
Rkonstant:= serRadius.Value/100;
//Sektion[n]:= (Rkonstant/10)*radius;
//Memo1.Lines.Add('Rkonstant r/R: '+ FormatFloat('#0',Rkonstant));
Memo1.Lines.Add('VingeProfil Type NACA 4418 ');
Memo1.Lines.Add('VingeRadius '+ FormatFloat('#0',radius)+' mm');
Memo1.Lines.Add('Afstand fra vingerod '+ FormatFloat('#0',(Rkonstant)* radius)+' mm');
Memo1.Lines.Add('ProfilBredde '+
FormatFloat('#0.0',(5.6*radius)/(i*1.0*Rkonstant*(power(5,2))))+' mm');
Profilbredde[18]:= (5.6*radius)/(i*1.0*Rkonstant*(power(5,2)));
Profilbreddemaal:= FloatToStr(Profilbredde[18]);
Memo1.Lines.Add(' ');
for n:=1 to 18 do
begin
//SektionBredde[n]:= (16*pi*power(5000,2))/(9*i*1.0*2500*(power(5,2)));
SektionBredde[n]:= (5.6*radius)/(i*1.0*Rkonstant*(power(5,2)));
X[n] := (SektionBredde[n] * Naca4415X[n]);
Yop[n] := (SektionBredde[n] * Naca4415OP[n]);
Yned[n]:= (SektionBredde[n] * Naca4415NED[n]);
sx:= Format('%8.1f',[X[n]/100]);
sYo:= Format('%8.1f',[Yop[n]/100]);
sYn:= Format('%8.1f',[Yned[n]/100]);
Memo1.Lines.Add('X[Hen]:'+sx+' Y[op]:'+sYo+' Y[Ned]:'+sYn);
Panel1.Caption:=(' Vingebredde: '+ FormatFloat('#,##0.00;;Zero', SektionBredde[n])+'
mm.');
// Afstanden fra rod til NACA-profilet beregnes
Label3.Caption:=('Afstand fra vingerod '+ FormatFloat('#0',(Rkonstant)* radius)+' mm');
//Får Memo1 til øverste linje
Linescroll_Op;
end;
end;
end;
procedure TfmProfilValg.RadioButton5Click(Sender: TObject);
// NACA 4421 profil
var
n: Integer;
begin
if not (radius >1) or not (p >1) then begin
Showmessage('Der er ikke indtastet nogen talværdier for NACA 4421');
Form1.Profilvalg1Click(Sender);
end else begin
Memo1.Clear;
frmProfil.seZoom.Value:=0;
frmProfil.seVinkel.Value:=0;
Memo1.Font.Name:='courier new';
Memo1.Font.Size:=9;
for n:=1 to 18 do begin
Naca4415X[n]:= 0.00; Naca4415OP[n] := 0.00; Naca4415NED[n] := 0.00;
end;
for n:=1 to 18 do
Naca4415X[0] := 0.00; Naca4415OP[0] := 0.00; Naca4415NED[0] := 0.00;
Naca4415X[1] := 1.25; Naca4415OP[1] := 4.45; Naca4415NED[1] := -2.42;
Naca4415X[2] := 2.50; Naca4415OP[2] := 5.84; Naca4415NED[2] := -3.48;
Naca4415X[3] := 5.00; Naca4415OP[3] := 7.82; Naca4415NED[3] := -4.78;
Naca4415X[4] := 7.50; Naca4415OP[4] := 9.24; Naca4415NED[4] := -5.62;
Naca4415X[5] := 10.00; Naca4415OP[5] := 10.35; Naca4415NED[5] := -6.15;
Naca4415X[6] := 15.00; Naca4415OP[6] := 12.04; Naca4415NED[6] := -6.75;
Naca4415X[7] := 20.00; Naca4415OP[7] := 13.17; Naca4415NED[7] := -6.98;
Naca4415X[8] := 25.00; Naca4415OP[8] := 13.88; Naca4415NED[8] := -6.92;
Naca4415X[9] := 30.00; Naca4415OP[9] := 14.27; Naca4415NED[9] := -6.76;
Naca4415X[10] := 40.00; Naca4415OP[10] := 14.16; Naca4415NED[10] := -6.16;
Naca4415X[11] := 50.00; Naca4415OP[11] := 13.18; Naca4415NED[11] := -5.34;
Naca4415X[12] := 60.00; Naca4415OP[12] := 11.60; Naca4415NED[12] := -4.40;
Naca4415X[13] := 70.00; Naca4415OP[13] := 9.50; Naca4415NED[13] := -3.35;
Naca4415X[14] := 80.00; Naca4415OP[14] := 6.91; Naca4415NED[14] := -2.31;
Naca4415X[15] := 90.00; Naca4415OP[15] := 3.85; Naca4415NED[15] := -1.27;
Naca4415X[16] := 95.00; Naca4415OP[16] := 2.11; Naca4415NED[16] := -0.74;
Naca4415X[17] := 100.00; Naca4415OP[17] := 0.22; Naca4415NED[17] := -0.22;
Naca4415X[18] := 100.00; Naca4415OP[18] := 0.00; Naca4415NED[18] := -0.00;
Rkonstant:= serRadius.Value/100;
//Sektion[n]:= (Rkonstant/10)*radius;
//Memo1.Lines.Add('Rkonstant r/R: '+ FormatFloat('#0',Rkonstant));
Memo1.Lines.Add('VingeProfil Type NACA 4421 ');
Memo1.Lines.Add('VingeRadius '+ FormatFloat('#0',radius)+' mm');
Memo1.Lines.Add('Afstand fra vingerod '+ FormatFloat('#0',(Rkonstant)* radius)+' mm');
Memo1.Lines.Add('VingeBredde '+
FormatFloat('#0.0',(5.6*radius)/(i*1.0*Rkonstant*(power(5,2))))+' mm');
Profilbredde[18]:= (5.6*radius)/(i*1.0*Rkonstant*(power(5,2)));
Profilbreddemaal:= FloatToStr(Profilbredde[18]);
Memo1.Lines.Add(' ');
for n:=1 to 18 do
begin
//SektionBredde[n]:= (16*pi*power(5000,2))/(9*i*1.0*2500*(power(5,2)));
SektionBredde[n]:= (5.6*radius)/(i*1.0*Rkonstant*(power(5,2)));
X[n] := (SektionBredde[n] * Naca4415X[n]);
Yop[n] := (SektionBredde[n] * Naca4415OP[n]);
Yned[n]:= (SektionBredde[n] * Naca4415NED[n]);
sx:= Format('%8.1f',[X[n]]);
sYo:= Format('%8.1f',[Yop[n]]);
sYn:= Format('%8.1f',[Yned[n]]);
Memo1.Lines.Add('X[Hen]:'+sx+' Y[op]:'+sYo+' Y[Ned]:'+sYn);
Panel1.Caption:=(' Vingebredde: '+ FormatFloat('#,##0.00;;Zero', SektionBredde[n])+'
mm.');
// Afstanden fra rod til NACA-profilet beregnes
Label3.Caption:=('Afstand fra vingerod '+ FormatFloat('#0',(Rkonstant)* radius)+' mm');
//Får Memo1 til øverste linje
Linescroll_Op;
end;
end;
end;
procedure TfmProfilValg.RadioButton6Click(Sender: TObject);
var
n: Integer;
begin
if not (radius >1) or not (p >1) then begin
Showmessage('Der er ikke indtastet nogen talværdier for NACA 23012');
Form1.Profilvalg1Click(Sender);
end else begin
Memo1.Clear;
frmProfil.seZoom.Value:=0;
frmProfil.seVinkel.Value:=0;
Memo1.Font.Name:='courier new';
Memo1.Font.Size:=9;
for n:=1 to 18 do begin
Naca4415X[n]:= 0.00; Naca4415OP[n] := 0.00; Naca4415NED[n] := 0.00;
end;
for n:=1 to 18 do
Naca4415X[0] := 0.00; Naca4415OP[0] := 0.00; Naca4415NED[0] := 0.00;
Naca4415X[1] := 1.25; Naca4415OP[1] := 2.67; Naca4415NED[1] := -1.23;
Naca4415X[2] := 2.50; Naca4415OP[2] := 3.61; Naca4415NED[2] := -1.71;
Naca4415X[3] := 5.00; Naca4415OP[3] := 4.91; Naca4415NED[3] := -2.26;
Naca4415X[4] := 7.50; Naca4415OP[4] := 5.80; Naca4415NED[4] := -2.61;
Naca4415X[5] := 10.00; Naca4415OP[5] := 6.43; Naca4415NED[5] := -2.92;
Naca4415X[6] := 15.00; Naca4415OP[6] := 7.19; Naca4415NED[6] := -3.50;
Naca4415X[7] := 20.00; Naca4415OP[7] := 7.50; Naca4415NED[7] := -3.97;
Naca4415X[8] := 25.00; Naca4415OP[8] := 7.60; Naca4415NED[8] := -4.28;
Naca4415X[9] := 30.00; Naca4415OP[9] := 7.55; Naca4415NED[9] := -4.46;
Naca4415X[10] := 40.00; Naca4415OP[10] := 7.14; Naca4415NED[10] := -4.48;
Naca4415X[11] := 50.00; Naca4415OP[11] := 6.41; Naca4415NED[11] := -4.17;
Naca4415X[12] := 60.00; Naca4415OP[12] := 5.47; Naca4415NED[12] := -3.67;
Naca4415X[13] := 70.00; Naca4415OP[13] := 4.36; Naca4415NED[13] := -3.00;
Naca4415X[14] := 80.00; Naca4415OP[14] := 3.08; Naca4415NED[14] := -2.16;
Naca4415X[15] := 90.00; Naca4415OP[15] := 1.68; Naca4415NED[15] := -1.23;
Naca4415X[16] := 95.00; Naca4415OP[16] := 0.92; Naca4415NED[16] := -0.70;
Naca4415X[17] := 100.00; Naca4415OP[17] := 0.13; Naca4415NED[17] := -0.13;
Naca4415X[18] := 100.00; Naca4415OP[18] := 0.00; Naca4415NED[18] := -0.00;
Rkonstant:= serRadius.Value/100;
//Sektion[n]:= (Rkonstant/10)*radius;
//Memo1.Lines.Add('Rkonstant r/R: '+ FormatFloat('#0',Rkonstant));
Memo1.Lines.Add('VingeProfil Type NACA 23012 ');
Memo1.Lines.Add('VingeRadius '+ FormatFloat('#0',radius)+' mm');
Memo1.Lines.Add('Afstand fra vingerod '+ FormatFloat('#0',(Rkonstant)* radius)+' mm');
Memo1.Lines.Add('VingeBredde '+
FormatFloat('#0.0',(5.6*radius)/(i*1.0*Rkonstant*(power(5,2))))+' mm');
Memo1.Lines.Add(' ');
for n:=1 to 18 do
begin
//SektionBredde[n]:= (16*pi*power(5000,2))/(9*i*1.0*2500*(power(5,2)));
SektionBredde[n]:= (5.6*radius)/(i*1.0*Rkonstant*(power(5,2)));
X[n] := (SektionBredde[n] * Naca4415X[n]);
Yop[n] := (SektionBredde[n] * Naca4415OP[n]);
Yned[n]:= (SektionBredde[n] * Naca4415NED[n]);
sx:= Format('%8.1f',[X[n]/100]);
sYo:= Format('%8.1f',[Yop[n]/100]);
sYn:= Format('%8.1f',[Yned[n]/100]);
Memo1.Lines.Add('X[Hen]:'+sx+' Y[op]:'+sYo+' Y[Ned]:'+sYn);
Panel1.Caption:=(' Vingebredde: '+ FormatFloat('#,##0.00;;Zero', SektionBredde[n])+'
mm.');
// Afstanden fra rod til NACA-profilet beregnes
Label3.Caption:=('Afstand fra vingerod '+ FormatFloat('#0',(Rkonstant)* radius)+' mm');
//Får Memo1 til øverste linje
Linescroll_Op;
end;
end;
end;
procedure TfmProfilValg.btnTegnProfilClick(Sender: TObject);
begin
if RadioButton1.Checked then begin
frmProfil.btnClear.Click;
fmProfilValg.Hide;
frmProfil.Show;
frmProfil.btnTegn.Click;
fmProfilValg.StandartTekstNaca4415;
end else
if RadioButton2.Checked then begin
frmProfil.btnClear.Click;
fmProfilValg.Hide;
frmProfil.Show;
frmProfil.btnTegn.Click;
fmProfilValg.StandartTekstFX72MS150B;
end else
if RadioButton3.Checked then begin
frmProfil.btnClear.Click;
fmProfilValg.Hide;
frmProfil.Show;
frmProfil.btnTegn.Click;
fmProfilValg.StandartTekstNaca4412;
end else
if RadioButton4.Checked then begin
frmProfil.btnClear.Click;
fmProfilValg.Hide;
frmProfil.Show;
frmProfil.btnTegn.Click;
fmProfilValg.StandartTekstNaca4418;
end else
if RadioButton5.Checked then begin
frmProfil.btnClear.Click;
fmProfilValg.Hide;
frmProfil.Show;
frmProfil.btnTegn.Click;
fmProfilValg.StandartTekstNaca4421;
end else
if RadioButton6.Checked then begin
frmProfil.btnClear.Click;
fmProfilValg.Hide;
frmProfil.Show;
frmProfil.btnTegn.Click;
fmProfilValg.StandartTekstNaca23012;
end
end;
procedure TfmProfilValg.FormCreate(Sender: TObject);
begin
Memo1.Clear;
fmProfilValg.RadioButton1.Checked:=False;
fmProfilValg.RadioButton2.Checked:=False;
fmProfilValg.RadioButton3.Checked:=False;
fmProfilValg.RadioButton4.Checked:=False;
fmProfilValg.RadioButton5.Checked:=False;
fmProfilValg.RadioButton6.Checked:=False;
with TFloatSpinEdit.Create(self) do
begin
Parent := Self;
Left := 100;
Top := 100;
FloatIncrement := (100.0 / 6.0);
MaxFloatValue := 100.0;
MinFloatValue := 0.0;
end;
end;
procedure TfmProfilValg.StandartTekstNaca4415;
begin
with frmProfil.Image1 do
begin
Picture.Bitmap.Canvas.TextFlags := 0;
Picture.Bitmap.Canvas.Font.Size := 12;
Picture.Bitmap.Canvas.Font.Color := clBlue;
Picture.Bitmap.Canvas.Font.Name := 'Comic Sans MS';
Picture.Bitmap.Canvas.TextOut(20, 0, 'VingeProfil NASA 4415');
Picture.Bitmap.Canvas.Font.Size := 10;
Picture.Bitmap.Canvas.TextOut(550, 0,'' + UpperText(FormatDateTime('dddd' +' "d." d"." mmmm
yyyy',now)));
Picture.Bitmap.Canvas.TextOut(600, 20, ' ');
Picture.Bitmap.Canvas.TextOut(550, 20, 'Klokken er ' + TimeToStr(Now) );
Picture.Bitmap.Canvas.TextOut(20, 35,'VingeRadius '+ FormatFloat('#0',radius)+' mm');
Picture.Bitmap.Canvas.TextOut(20, 50, 'Afstand fra vingerod '+
FormatFloat('#0',(Rkonstant)* radius)+' mm');
Picture.Bitmap.Canvas.TextOut(20, 65, 'ProfilBredde:'+
Format('%8.1f',[(5.6*radius)/(i*1.0*Rkonstant*(power(5,2)))])+' mm');
Picture.Bitmap.Canvas.TextOut(20, 80, 'Filename: '+ Form1.OpenDialog1.FileName);
// Memo1.Lines.Add('VingeRadius '+ FormatFloat('#0.0',radius/1000)+' Meter');
//Memo1.Lines.Add('VingeProfil Type NACA 4415 ');
//Memo1.Lines.Add('Afstand fra Tip r/R '+ FormatFloat('#0.0',((Rkonstant*radius)-radius))+'
mm');
//Memo1.Lines.Add('VingeBredde '+
FormatFloat('#0.0',(5.6*radius)/(i*1.0*Rkonstant*(power(5,2))))+' mm');
end;
end;
procedure TfmProfilValg.StandartTekstFX72MS150B;
begin
with frmProfil.Image1 do
begin
Picture.Bitmap.Canvas.TextFlags := 0;
Picture.Bitmap.Canvas.Font.Size := 12;
Picture.Bitmap.Canvas.Font.Color := clBlue;
Picture.Bitmap.Canvas.Font.Name := 'Comic Sans MS';
Picture.Bitmap.Canvas.TextOut(20, 0, 'VingeProfil FX 72-MS-150 B');
Picture.Bitmap.Canvas.Font.Size := 10;
Picture.Bitmap.Canvas.TextOut(550, 0,'' + UpperText(FormatDateTime('dddd' +' "d." d"." mmmm
yyyy',now)));
Picture.Bitmap.Canvas.TextOut(600, 20, ' ');
Picture.Bitmap.Canvas.TextOut(550, 20,'Klokken er ' + TimeToStr(Now) );
Picture.Bitmap.Canvas.TextOut(20, 35, 'VingeRadius '+ FormatFloat('#0',radius)+' mm');
Picture.Bitmap.Canvas.TextOut(20, 50, 'Afstand fra vingerod '+
FormatFloat('#0',(Rkonstant)* radius)+' mm');
Picture.Bitmap.Canvas.TextOut(20, 65, 'ProfilBredde:'+
Format('%8.1f',[(5.6*radius)/(i*1.0*Rkonstant*(power(5,2)))])+' mm');
Picture.Bitmap.Canvas.TextOut(20, 80, 'Filename: '+ Form1.OpenDialog1.FileName);
end;
end;
procedure TfmProfilValg.StandartTekstNaca4412;
begin
with frmProfil.Image1 do
begin
Picture.Bitmap.Canvas.TextFlags := 0;
Picture.Bitmap.Canvas.Font.Size := 12;
Picture.Bitmap.Canvas.Font.Color := clBlue;
Picture.Bitmap.Canvas.Font.Name := 'Comic Sans MS';
Picture.Bitmap.Canvas.TextOut(20, 0, 'VingeProfil NACA 4412');
Picture.Bitmap.Canvas.Font.Size := 10;
Picture.Bitmap.Canvas.TextOut(550, 0,'' + UpperText(FormatDateTime('dddd' +' "d." d"." mmmm
yyyy',now)));
Picture.Bitmap.Canvas.TextOut(600, 20, ' ');
Picture.Bitmap.Canvas.TextOut(550, 20,'Klokken er ' + TimeToStr(Now) );
Picture.Bitmap.Canvas.TextOut(20, 35, 'VingeRadius '+ FormatFloat('#0',radius)+' mm');
Picture.Bitmap.Canvas.TextOut(20, 50, 'Afstand fra vingerod '+
FormatFloat('#0',(Rkonstant)* radius)+' mm');
Picture.Bitmap.Canvas.TextOut(20, 65, 'ProfilBredde:'+
Format('%8.1f',[(5.6*radius)/(i*1.0*Rkonstant*(power(5,2)))])+' mm');
Picture.Bitmap.Canvas.TextOut(20, 80, 'Filename: '+ Form1.OpenDialog1.FileName);
end;
end;
procedure TfmProfilValg.StandartTekstNaca4418;
begin
with frmProfil.Image1 do
begin
Picture.Bitmap.Canvas.TextFlags := 0;
Picture.Bitmap.Canvas.Font.Size := 12;
Picture.Bitmap.Canvas.Font.Color := clBlue;
Picture.Bitmap.Canvas.Font.Name := 'Comic Sans MS';
Picture.Bitmap.Canvas.TextOut(20, 0, 'VingeProfil NACA 4418');
Picture.Bitmap.Canvas.Font.Size := 10;
Picture.Bitmap.Canvas.TextOut(550, 0,'' + UpperText(FormatDateTime('dddd' +' "d." d"." mmmm
yyyy',now)));
Picture.Bitmap.Canvas.TextOut(600, 20, ' ');
Picture.Bitmap.Canvas.TextOut(550, 20,'Klokken er ' + TimeToStr(Now) );
Picture.Bitmap.Canvas.TextOut(20, 35, 'VingeRadius '+ FormatFloat('#0',radius)+' mm');
Picture.Bitmap.Canvas.TextOut(20, 50, 'Afstand fra vingerod '+
FormatFloat('#0',(Rkonstant)* radius)+' mm');
Picture.Bitmap.Canvas.TextOut(20, 65, 'ProfilBredde:'+
Format('%8.1f',[(5.6*radius)/(i*1.0*Rkonstant*(power(5,2)))])+' mm');
Picture.Bitmap.Canvas.TextOut(20, 80, 'Filename: '+ Form1.OpenDialog1.FileName);
end;
end;
procedure TfmProfilValg.StandartTekstNaca4421;
begin
with frmProfil.Image1 do
begin
Picture.Bitmap.Canvas.TextFlags := 0;
Picture.Bitmap.Canvas.Font.Size := 12;
Picture.Bitmap.Canvas.Font.Color := clBlue;
Picture.Bitmap.Canvas.Font.Name := 'Comic Sans MS';
Picture.Bitmap.Canvas.TextOut(20, 0, 'VingeProfil NACA 4421');
Picture.Bitmap.Canvas.Font.Size := 10;
Picture.Bitmap.Canvas.TextOut(550, 0,'' + UpperText(FormatDateTime('dddd' +' "d." d"." mmmm
yyyy',now)));
Picture.Bitmap.Canvas.TextOut(600, 20, ' ');
Picture.Bitmap.Canvas.TextOut(550, 20,'Klokken er ' + TimeToStr(Now) );
Picture.Bitmap.Canvas.TextOut(20, 35, 'VingeRadius '+ FormatFloat('#0',radius)+' mm');
Picture.Bitmap.Canvas.TextOut(20, 50, 'Afstand fra vingerod '+
FormatFloat('#0',(Rkonstant)* radius)+' mm');
Picture.Bitmap.Canvas.TextOut(20, 65, 'ProfilBredde:'+
Format('%8.1f',[(5.6*radius)/(i*1.0*Rkonstant*(power(5,2)))])+' mm');
Picture.Bitmap.Canvas.TextOut(20, 80, 'Filename: '+ Form1.OpenDialog1.FileName);
end;
end;
procedure TfmProfilValg.StandartTekstNaca23012;
begin
with frmProfil.Image1 do
begin
Picture.Bitmap.Canvas.TextFlags := 0;
Picture.Bitmap.Canvas.Font.Size := 12;
Picture.Bitmap.Canvas.Font.Color := clBlue;
Picture.Bitmap.Canvas.Font.Name := 'Comic Sans MS';
Picture.Bitmap.Canvas.TextOut(20, 0, 'VingeProfil NACA 23012');
Picture.Bitmap.Canvas.Font.Size := 10;
Picture.Bitmap.Canvas.TextOut(550, 0,'' + UpperText(FormatDateTime('dddd' +' "d." d"." mmmm
yyyy',now)));
Picture.Bitmap.Canvas.TextOut(600, 20, ' ');
Picture.Bitmap.Canvas.TextOut(550, 20,'Klokken er ' + TimeToStr(Now) );
Picture.Bitmap.Canvas.TextOut(20, 35, 'VingeRadius '+ FormatFloat('#0',radius)+' mm');
Picture.Bitmap.Canvas.TextOut(20, 50, 'Afstand fra vingerod '+
FormatFloat('#0',(Rkonstant)* radius)+' mm');
Picture.Bitmap.Canvas.TextOut(20, 65, 'ProfilBredde:'+
Format('%8.1f',[(5.6*radius)/(i*1.0*Rkonstant*(power(5,2)))])+' mm');
Picture.Bitmap.Canvas.TextOut(20, 80, 'Filename: '+ Form1.OpenDialog1.FileName);
end;
end;
procedure TfmProfilValg.serRadiusChange(Sender: TObject);
begin
Memo1.Clear;
frmProfil.seZoom.Value:=0;
frmProfil.seVinkel.Value:=0;
if serRadius.Value<1 then serRadius.Value:=1;
if fmProfilValg.RadioButton1.Checked then begin
fmProfilValg.RadioButton1Click(Sender);
fmProfilValg.StandartTekstNaca4415;
fmProfilValg.Show;
fmProfilValg.Update;
end else
if RadioButton2.Checked then begin
fmProfilValg.RadioButton2Click(Sender);
fmProfilValg.StandartTekstFX72MS150B;
fmProfilValg.Show;
fmProfilValg.Update;
end else
if RadioButton3.Checked then begin
fmProfilValg.RadioButton3Click(Sender);
fmProfilValg.StandartTekstNaca4412;
fmProfilValg.Show;
fmProfilValg.Update;
end else
if RadioButton4.Checked then begin
fmProfilValg.RadioButton4Click(Sender);
fmProfilValg.StandartTekstNaca4418;
fmProfilValg.Show;
fmProfilValg.Update;
end else
if RadioButton5.Checked then begin
fmProfilValg.RadioButton5Click(Sender);
fmProfilValg.StandartTekstNaca4421;
fmProfilValg.Show;
fmProfilValg.Update;
end else
if RadioButton6.Checked then begin
fmProfilValg.RadioButton6Click(Sender);
fmProfilValg.StandartTekstNaca23012;
fmProfilValg.Show;
fmProfilValg.Update;
end else
end;
procedure TfmProfilValg.Linescroll_Op;
begin
with memo1 do begin
SelStart := Perform(EM_LINEINDEX, 0, 0);
Perform(EM_SCROLLCARET, 0, 0)
end;
memo1.SetFocus;
end;
procedure TfmProfilValg.GemSom1Click(Sender: TObject);
begin
Form1.GemSom1Click(Sender);
end;
procedure TfmProfilValg.Open1Click(Sender: TObject);
begin
Form1.ReadFileClick(Sender);
Memo1.Clear;
end;
procedure TfmProfilValg.Print1Click(Sender: TObject);
Var
S: String;
R: TRect;
Begin
With Printer Do Begin
BeginDoc;
try
Canvas.Font := Memo1.Font;
{ Set up output rect, using margins of 0.75 inch top and left,
0.5 inch right and bottom }
R.Left := GetDeviceCaps( Handle, LOGPIXELSX ) div 4 * 3 -
GetDeviceCaps( Handle, PHYSICALOFFSETX );
R.Top := GetDeviceCaps( Handle, LOGPIXELSY ) div 4 * 3 -
GetDeviceCaps( Handle, PHYSICALOFFSETY );
R.Right:= GetDeviceCaps( Handle, PHYSICALWIDTH ) -
GetDeviceCaps( Handle, LOGPIXELSX ) div 2 -
GetDeviceCaps( Handle, PHYSICALOFFSETX );
R.Bottom:=GetDeviceCaps( Handle, PHYSICALHEIGHT ) -
GetDeviceCaps( Handle, LOGPIXELSY ) div 2 -
GetDeviceCaps( Handle, PHYSICALOFFSETY );
// The following statement makes sure the font is selected
// into the device context of the canvas.
Canvas.TextOut( 0,0, ' ');
S:= memo1.Text;
DrawText( Canvas.Handle,
PChar(S),
Length(S),
R,
DT_WORDBREAK or DT_LEFT or DT_NOPREFIX );
finally
EndDoc;
end;
End;
End;
procedure TfmProfilValg.FormActivate(Sender: TObject);
begin
serRadius.MaxValue:=100;
end;
procedure TfmProfilValg.Button1Click(Sender: TObject);
var
AntalSek : integer;
begin
antalsek := StrToIntDef(Inputbox('Indskriv antal sektioner','Heltal','1'),-1);
serRadius.FloatIncrement:= trunc(100/AntalSek);
serRadius.MinFloatValue := 1; //25
serRadius.MaxFloatValue := 100;
serRadius.MinFloatValue := trunc((100 div AntalSek)+0.5);
end;
procedure TfmProfilValg.Afslut1Click(Sender: TObject);
begin
Close;
end;
procedure TfmProfilValg.serRadiusKeyPress(Sender: TObject; var Key: Char);
begin
if not (Key in ['0'..'9',#08])then Key := #0;
end;
procedure TfmProfilValg.Memo1Change(Sender: TObject);
begin
//Sætter margin til 10 (pixels)
Sendmessage(Memo1.handle,EM_SETMARGINS,EC_LEFTMARGIN,makelparam(10,10));
end;
procedure TfmProfilValg.Button2Click(Sender: TObject);
var
AntalSek : integer;
begin
antalsek:=1;
antalsek := StrToIntDef(Inputbox('Indskriv antal sektioner','Heltal','1'),-1);
if (antalsek mod 2)=0 then
begin
serRadius.Increment:= trunc((100 div antalsek)+0.5);
serRadius.Value := trunc((100 div antalsek)+0.5);
end
else
begin
serRadius.Increment:= 100;
serRadius.Value := 100;
end;
serRadius.MinValue := 1; //25
serRadius.MaxValue := 100;
end;
end.
Håber ikke dette er for stor en mundfuld!
Med venlig hilsen
Monie Jacobsen
E-mail: mjs at nypost dot dk