I need to capture a panel image.
The problem I am facing is that if the panel contains TCombobox, the text does not appear.
procedure AssignPanelImageToPicture(Panel : TPanel;Image : TImage); var B : TBitmap; begin B := TBitmap.Create; try B.Width := Panel.Width; B.Height := Panel.Height; B.Canvas.Lock; Panel.PaintTo(B.Canvas.Handle,0,0); B.Canvas.Unlock; Image1.Picture.Assign(B); finally B.Free; end; end;
Using this code, I throw a panel on it with TCombobox. Then enter the value in the text property. I also throw a TImage. Then I add a button to call the above code.
Here is the result:

Is there a better way to capture a true panel image.
source share