📄 platecomparequery.pas
字号:
begin
sql := sql + ' USERID= ''' + getdm(cobOpeater.Text) + ''' and ';
end;
if bz=true then
begin
sql := sql + ' 1 = 1 order by 图片序号';
end;
result := sql;
end;
procedure TfrmPlateCompareQery.TFrmSjfy1DBGridCellClick(Column: TColumn);
var
photoXH:String; //组合的唯一标识
begin
//显示相互关联的3张图片
//其中可能会出现1,2,3的不全情况
//TFrmSjfy1.DBGrid.Fields[0].asstri
photoXH:=TFrmSjfy1.DBGrid.Fields[0].AsString ; //图片序号
zpsj:=TFrmSjfy1.DBGrid.Fields[2].AsDateTime ; //抓拍时间
zpdd:=TFrmSjfy1.DBGrid.Fields[3].AsString ; //抓拍地点
isSaveList:= TFrmSjfy1.DBGrid.Fields[4].AsString ; //是否受保护
isCompare:= TFrmSjfy1.DBGrid.Fields[5].AsString ; //是否已比对
isAvailably:= TFrmSjfy1.DBGrid.Fields[6].AsString ; //是否有效
onlyID:=TFrmSjfy1.DBGrid.Fields[8].AsString ; //通过onlyID,最多可查询出3张图片
compareDate:=TFrmSjfy1.DBGrid.Fields[9].AsDateTime ; //比对时间
compareUserID:=TFrmSjfy1.DBGrid.Fields[10].AsString ; //比对人
rowNum:= TFrmSjfy1.DBGrid.Fields[11].AsInteger ; //查询结果的序号
dbConn.DisplayPicPhoto(onlyID,photoXH,img1,img2,img3,'0');
if isCompare='1' then
begin
if isSaveList='1' then
begin
if isAvailably='1' then
begin
sbBar.SimpleText := ' 当前照片抓拍时间:'+datetimetostr(zpsj) + ' 比对结果:受保护!' + ' 比对时间:'+datetimetostr(CompareDate)+' 比对人ID:'+CompareUserID + ' 该照片有效!';;
end
else
begin
sbBar.SimpleText := ' 当前照片抓拍时间:'+datetimetostr(zpsj) + ' 比对结果:受保护!' + ' 比对时间:'+datetimetostr(CompareDate)+' 比对人ID:'+CompareUserID + ' 该照片已为被作废,视为无效!';
end;
end
else
begin
if isAvailably='1' then
begin
sbBar.SimpleText := ' 当前照片抓拍时间:'+datetimetostr(zpsj) + ' 比对结果:非保护!' + ' 比对时间:'+datetimetostr(CompareDate)+' 比对人ID:'+CompareUserID + ' 该照片有效!';;
end
else
begin
sbBar.SimpleText := ' 当前照片抓拍时间:'+datetimetostr(zpsj) + ' 比对结果:非保护!' + ' 比对时间:'+datetimetostr(CompareDate)+' 比对人ID:'+CompareUserID + ' 该照片已为被作废,视为无效!';
end;
//sbBar.SimpleText := ' 当前照片抓拍时间:'+datetimetostr(zpsj)+ ' 比对结果: 非保护!' + ' 比对时间:'+datetimetostr(CompareDate)+' 比对人ID:'+CompareUserID;
end;
end
else
begin
sbBar.SimpleText := ' 当前照片抓拍时间:'+datetimetostr(zpsj)+ ' 未比对!';
end;
end;
procedure TfrmPlateCompareQery.btnPrintClick(Sender: TObject);
var
px,py:integer; //屏幕分辨率
rect1,rect2,rect3:TRect; //使用三个来分别对其 控制
picnamewpath:string;
fileNames:String; //将要显示的抓拍地点和抓拍时间
begin
///处理无图片情况
if img1.Picture.Bitmap.Empty and img2.Picture.Bitmap.Empty and img3.Picture.Bitmap.Empty then
begin
messageBox(self.Handle, '您当前无照片,无法实现打印!','提示',MB_OK+MB_ICONINFORMATION);
exit;
end;
try
//获得打印机的分辨率
px:=getdevicecaps(printer.Handle,logpixelsx) div PixelsPerInch;
py:=getdevicecaps(printer.Handle,logpixelsy) div PixelsPerInch;
//横向方向的 ,长度不能够满足
with rect1 do //rect1第一张图片
begin
left:=150;
top:=250;
right:=trunc(img1.Picture.Width*px*0.95)+left;
bottom:=trunc(img1.Picture.Height*py*0.95)+top;
end;
with rect2 do //rect2第二张图片
begin
left:=rect1.Right+1;
top:=250 ;
right:=trunc(img1.Picture.Width*px*0.95)+left;
bottom:=trunc(img1.Picture.Height*py*0.95)+top;
end;
with rect3 do //rect2第二张图片
begin
left:=rect2.Right+1;
top:=250;
right:=trunc(img1.Picture.Width*px*0.95)+left;
bottom:=trunc(img1.Picture.Height*py*0.95)+top;
end;
//20070719星期四另外一种思路
Printer.Orientation := polandscape; //横向polandscape //纵向--> poPortrait
Printer.Title :='照片打印';
try
Printer.BeginDoc;
printer.Canvas.Font.Name:='宋体';
printer.Canvas.Font.Size := 13;
printer.Canvas.Font.Color :=clRed;
Printer.Canvas.StretchDraw(rect1,img1.Picture.Graphic );
Printer.Canvas.StretchDraw(rect2,img2.Picture.Graphic );
Printer.Canvas.StretchDraw(rect3,img3.Picture.Graphic );
//要求显示抓拍时间与抓拍地点
fileNames:='抓拍地点:'+zpdd+' 抓拍时间:'+datetimetostr(zpsj);
Printer.Canvas.TextOut(rect1.Left,rect1.Bottom+8,fileNames);
Printer.EndDoc;
messagebox(self.Handle ,'打印成功!','打印提示',MB_OK+MB_ICONINFORMATION);
except
Printer.Abort ;
raise;
end;
except
messageBox(self.Handle, '请检查打印机是否正确安装!','提示',MB_OK+MB_ICONINFORMATION);
end;
end;
procedure TfrmPlateCompareQery.TFrmSjfy1DBGridDrawColumnCell(
Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
begin
with (Sender as TDBGrid) do
begin
if gdSelected in State then
begin
Canvas.Brush.Color:=clGreen; //新颜色 clInfobk
DefaultDrawColumnCell(rect,datacol,Column,state);
end
else
Canvas.Brush.Color:=clwindow; //默认颜色
end;
end;
procedure TfrmPlateCompareQery.sbBarDrawPanel(StatusBar: TStatusBar;
Panel: TStatusPanel; const Rect: TRect);
begin
sbBar.Canvas.Font.Name :='宋体';
sbBar.Canvas.Font.Size :=13;
sbBar.Canvas.Font.Color := clBlue;
end;
procedure TfrmPlateCompareQery.btnExportCurrentPhotoClick(Sender: TObject);
var
saveDir:String;
savePath:String;
begin
///处理无图片情况
if img1.Picture.Bitmap.Empty and img2.Picture.Bitmap.Empty and img3.Picture.Bitmap.Empty then
begin
messageBox(self.Handle, '您当前无照片,无法实现该操作!','提示',MB_OK+MB_ICONINFORMATION);
exit;
end;
//export current
if CommUnit.SelectDirectory('选择一个文件路径', '', saveDir, Handle) then
savePath := saveDir;
if savePath<>'' then
begin
if dbConn.ExportPhotoFromDB(onlyID,'',savePath)=true then
begin
messageBox(0,PChar('已成功将照片保存到'+savePath+'目录下!') ,'提示',MB_OK+MB_ICONINFORMATION );
end;
end;
end;
procedure TfrmPlateCompareQery.btnExportAllPhotoClick(Sender: TObject);
var
saveDir:String;
savePath:String;
selSql:String; //根据所查询的条件保存
begin
//export all
//export current
if CommUnit.SelectDirectory('选择一个文件路径', '', saveDir, Handle) then
savePath := saveDir;
if savePath<>'' then
begin
selSql:=GetSQL(true);
if dbConn.ExportPhotoFromDB('',selSql,savePath)=true then
begin
messageBox(0,PChar('已成功将照片保存到'+savePath+'目录下!') ,'提示',MB_OK+MB_ICONINFORMATION );
end;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -