-
procedure DrawImage(Canvas: TCanvas; DestRect: TRect; ABitmap: TBitmap); var Header, Bits: Pointer; HeaderSize: DWORD; BitsSize: DWORD; begin GetDIBSizes(ABitmap.Handle, HeaderSize, BitsSize); Header := AllocMem(HeaderSize); Bits := AllocMem(BitsSize); try GetDIB(ABitmap.Handle, ABitmap.Palette, Header^, Bits^); StretchDIBits(Canvas.Handle, DestRect.Left, DestRect.Top, DestRect.Right, DestRect.Bottom, 0, 0, ABitmap.Width, ABitmap.Height, Bits, TBitmapInfo(Header^), DIB_RGB_COLORS, SRCCOPY); finally FreeMem(Header, HeaderSize); FreeMem(Bits, BitsSize); end; end;
procedure PrintImage(Image: TImage; ZoomPercent: Integer); // if ZoomPercent=100, Image will be printed across the whole page var relHeight, relWidth: integer; begin Screen.Cursor := crHourglass; Printer.BeginDoc; with Image.Picture.Bitmap do begin if ((Width / Height) > (Printer.PageWidth / Printer.PageHeight)) then begin // Stretch Bitmap to width of PrinterPage relWidth := Printer.PageWidth; relHeight := MulDiv(Height, Printer.PageWidth, Width); end else begin // Stretch Bitmap to height of PrinterPage relWidth := MulDiv(Width, Printer.PageHeight, Height); relHeight := Printer.PageHeight; end; relWidth := Round(relWidth * ZoomPercent / 100); relHeight := Round(relHeight * ZoomPercent / 100); DrawImage(Printer.Canvas, Rect(0, 0, relWidth, relHeight), Image.Picture.Bitmap); end; Printer.EndDoc; Screen.cursor := crDefault; end;
procedure TForm1.Button1Click(Sender: TObject); var i:integer; begin i:=strtoint(edit1.Text)*746 div 100; image1.Height:=i; image1.Width:=i; image1.Canvas.Pen.Color := clwhite; image1.Canvas.Ellipse(0, 0, oldr, oldr);
image1.Canvas.Brush.Style := bsClear; image1.Canvas.Pen.Color := clblack; image1.Canvas.Ellipse(0, 0, i, i); oldr:=i; end;
строю окружность как мне эту окружность разделить на равные дольки, к примеру на 7 часей?
-
for i := 0 to 6 do Points[i] := Point(Round(CenterX + Radius*Cos(i*2*Pi/7)),Round(CenterY + Radius*Sin(i*2*Pi/7)));
-
гептограмму решил нарисовать? Оо
|