Перейти к содержанию
Fire Monkey от А до Я

randydom

Пользователи
  • Постов

    3
  • Зарегистрирован

  • Посещение

Весь контент randydom

  1. randydom

    VCL procedure to FMX

    Hello , please can someone helps me porting this VCL procedure into FMX : procedure AssignBmp(SrcBmp,DstBmp:TBitmap); var _pxlSize : integer; begin if (SrcBmp.Width * SrcBmp.Height) = 0 then Exit; // 0 size case SrcBmp.PixelFormat of pf8bit: _pxlSize := 1; pf16bit: _pxlSize := 2; pf24bit: _pxlSize := 3; pf32bit: _pxlSize := 4; else raise Exception.Create('AssignBmp Error : Unknown PixelFormat .'); end; try if SrcBmp.PixelFormat <> DstBmp.PixelFormat then // assign the source bitmap pix-format to the target bitmap DstBmp.PixelFormat := SrcBmp.PixelFormat; if SrcBmp.Width <> DstBmp.Width then // assign the source bitmap width to the target bitmap width DstBmp.Width := SrcBmp.Width; if SrcBmp.Height <> DstBmp.Height then DstBmp.Height := SrcBmp.Height; // copy the source bitmap to the target one Move( SrcBmp.ScanLine[SrcBmp.Height-1]^, DstBmp.ScanLine[DstBmp.Height-1]^, SrcBmp.Width * SrcBmp.Height * _pxlSize ); except on E : Exception do raise Exception.Create('AssignBmp Error : ' + E.Message ); end; so many thanks .
  2. randydom

    ListView Item.Height

    i'm trying to accomplish a kind of ListView Items hide mechanism by setting ListView.Item[x].Height:=0 , But that didn't give any result Adding Items : procedure TForm6.AddItemsClick(Sender: TObject); var I:Integer; AItem: TListViewItem; begin for I := 0 to 5 do Begin AItem := ListView1.Items.Add; //with AItem do // Text := 'Text'; End; end; Trying to hide Items : procedure TForm6.HideItemsClick(Sender: TObject); var I:Integer; begin ListView1.BeginUpdate; try for I := 0 to ListView1.ItemCount-1 do // ListView1.Items.Item[I].Height:=0; // doesn't give any result ListView1.Items.Item[I].Height:=1; finally ListView1.EndUpdate; end; end; The Result : Any help to fix this please ? or why ListView1.Items.Item.Height:=0; Has no effect ?
  3. I've a VCL Component that i want to port it into FMX type TMyVclComponent = class (TCustomControl) ... procedure TMyVclComponent.MouseUp (Button: TMouseButton; Shift: TShiftState; X, Y: Single); begin FIsMouseDown: = false; end; procedure TMyVclComponent.Paint; begin if csDesigning in ComponentState then with inherited Canvas do begin Pen.Style: = psDash; Brush.Style: = bsClear; Rectangle (0, 0, Width, Height); end; TBackground(FBackground).PaintOn(FBitmapPreveiw); Canvas.Draw (0, 0, FBitmapPreveiw); end; My porting progress : type TMyFMXComponent = class(TStyledControl) ... procedure TMyFMXComponent.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Single); begin FIsMouseDown := false; end; procedure TMyFMXComponent.Paint; begin { How can we port this code part ? } if csDesigning in ComponentState then with inherited Canvas do begin Pen.Style := psDash; Brush.Style := bsClear; Rectangle(0, 0, Width, Height); end; TBackground(FBackground).PaintOn(FBitmapPreveiw); Canvas.Draw(0, 0, FBitmapPreveiw); end; How the code inside the Paint procedure can be ported to FMX ? thank you .
×
×
  • Создать...