首页 > 代码库 > flowchart 保存成位图
flowchart 保存成位图
将flowchart的内容输出成位图的函数
function GetFlowChartBitmap(FC: TdxFlowChart): TBitmap;
var
H, W, NewW: Integer;
AAlign: TAlign;
ABorder: TBorderStyle;
SInfo: TScrollInfo;
R: TRect;
begin
Result := TBitmap.Create;
try
H := FC.Height;
W := FC.Width;
AAlign := FC.Align;
ABorder := FC.BorderStyle;
SendMessage(FC.Parent.Handle, WM_SETREDRAW, 0, 0);
SendMessage(FC.Handle, WM_SETREDRAW, 0, 0);
FC.Align := alNone;
FC.BorderStyle := bsNone;
SInfo.cbSize := SizeOf(SInfo);
SInfo.fMask := SIF_RANGE;
if GetScrollInfo(FC.Handle, SB_HORZ, SInfo) then
NewW := SInfo.nMax - SInfo.nMin + 1
else
NewW := 0;
if GetScrollInfo(FC.Handle, SB_VERT, SInfo) then
FC.ClientHeight := SInfo.nMax - SInfo.nMin + 1;
if NewW > 0 then
FC.ClientWidth := NewW;
Result.Width := FC.ClientWidth ;
Result.Height := FC.ClientHeight;
Result.Canvas.Brush := FC.Brush;
Result.Canvas.FillRect(FC.ClientRect);
Result.Canvas.Lock;
try
FC.PaintTo(Result.Canvas.Handle, 0, 0);
finally
Result.Canvas.Unlock;
FC.Width := W;
FC.Height := H;
FC.BorderStyle := ABorder;
FC.Align := AAlign;
SendMessage(FC.Parent.Handle, WM_SETREDRAW, 1, 0);
SendMessage(FC.Handle, WM_SETREDRAW, 1, 0);
R := FC.Parent.ClientRect;
Windows.InvalidateRect(FC.Parent.Handle, @R, FALSE);
R := FC.ClientRect;
Windows.InvalidateRect(FC.Handle, @R, FALSE);
end;
except
Result.Free;
raise;
end;
end;
flowchart 保存成位图