This code works for me (tested on Windows):
procedure TForm1.Button1Click(Sender: TObject); var bmp: Graphics.TBitmap; begin bmp := Graphics.TBitmap.Create; bmp.SetSize(StringGrid1.ClientWidth, StringGrid1.ClientHeight); bmp.Canvas.Brush.Color := clWhite; bmp.Canvas.FillRect(0, 0, bmp.Width, bmp.Height); StringGrid1.PaintTo(bmp.Canvas, 0, 0); bmp.SaveToFile('test.bmp'); FreeAndNil(bmp); end;
No tested on Mac..
Maybe?
var bmp:tbitmap; begin bmp:=TBitmap.Create; bmp.SetSize(stringgrid1.ClientWidth,stringgrid1.ClientHeight); bmp.PixelFormat:= pf24bit; bmp.Canvas.Brush.Color := clWhite; bmp.clear; StringGrid1.PaintTo(bmp.Canvas, 0, 0); bmp.SaveToFile('test.bmp'); bmp.free; end;
Not work, return all black image
Cocoa is the future - carbon apps will soon no run on Mac. As Phil said, if the bug is there on Cocoa as well report bug! :)
Hint: I use fpcupdeluxe to get newest trunk version of Cocoa (easiest way to get started I think)
Cocoa is the future - carbon apps will soon no run on Mac. As Phil said, if the bug is there on Cocoa as well report bug! :)
Hint: I use fpcupdeluxe to get newest trunk version of Cocoa (easiest way to get started I think)
Problem with my actual version of cocoa lazarus 1.8.4
I test install cocoa lazarus trunk yesterday but not function. When i start ide return arithmetic overflow.
Hi
If you click the OK Button, and the IDE stays there; try rebuilding the IDE from the Tools Menu, this has sometimes fixed an odd Startup with Laz-FPC-Trunk->for Cocoa.
Please always check that you are using the very latest Trunk version when testing Laz(1.9.0) Cocoa, as it is being rapidly developed multi comit changes per day in some cases; and it is probable that a fix/addition may have a knock on effect, if so report to forum to check if others can confirm and then post on bugtracker, this is the best route to getting Lazarus-Cocoa working...
Hi
If you click the OK Button, and the IDE stays there; try rebuilding the IDE from the Tools Menu, this has sometimes fixed an odd Startup with Laz-FPC-Trunk->for Cocoa.
Please always check that you are using the very latest Trunk version when testing Laz(1.9.0) Cocoa, as it is being rapidly developed multi comit changes per day in some cases; and it is probable that a fix/addition may have a knock on effect, if so report to forum to check if others can confirm and then post on bugtracker, this is the best route to getting Lazarus-Cocoa working...