⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pictureproc.pas

📁 delphi图形程序开发,就是怎么样给图片加文字
💻 PAS
📖 第 1 页 / 共 2 页
字号:
begin
  Notebook1.PageIndex:= 1;
  SpinEdit1.Value:= 0;
end;

procedure TFormPictureProc.LeftRotate90(dTxt: String);
begin
  FormPicture.LeftRotate90;
  Notebook1.PageIndex:= 0;
  if dTxt = '' then
    Label1.Caption:= '请在工具栏或菜单选择你需要的功能...'
  else
    Label1.Caption:= dTxt;
end;

procedure TFormPictureProc.RightRotate90(dTxt: String);
begin
  FormPicture.RightRotate90;
  Notebook1.PageIndex:= 0;
  if dTxt = '' then
    Label1.Caption:= '请在工具栏或菜单选择你需要的功能...'
  else
    Label1.Caption:= dTxt;
end;

procedure TFormPictureProc.Rotate180(dTxt: String);
begin
  FormPicture.Rotate180;
  Notebook1.PageIndex:= 0;
  if dTxt = '' then
    Label1.Caption:= '请在工具栏或菜单选择你需要的功能...'
  else
    Label1.Caption:= dTxt;
end;

procedure TFormPictureProc.RotateRePic(dTxt: String);
begin
  FormPicture.CustomeRotate(0);
  Notebook1.PageIndex:= 0;
  if dTxt = '' then
    Label1.Caption:= '请在工具栏或菜单选择你需要的功能...'
  else
    Label1.Caption:= dTxt;
end;

procedure TFormPictureProc.Button1Click(Sender: TObject);
begin
  FormPicture.CustomeRotate(SpinEdit1.Value);
end;

procedure TFormPictureProc.N10Click(Sender: TObject);
begin
  CustomeRotate;
end;

procedure TFormPictureProc.AutoSelect(dTxt: String);
begin
  FormPicture.AutoSelect;
  Notebook1.PageIndex:= 0;
  if dTxt = '' then
    Label1.Caption:= '请在工具栏或菜单选择你需要的功能...'
  else
    Label1.Caption:= dTxt;
end;

procedure TFormPictureProc.ClientSize(dTxt: String);
begin
  FormPicture.ClientSize;
  Notebook1.PageIndex:= 0;
  if dTxt = '' then
    Label1.Caption:= '请在工具栏或菜单选择你需要的功能...'
  else
    Label1.Caption:= dTxt;
end;

procedure TFormPictureProc.CutOutSelect(dTxt: String);
begin
  FormPicture.CutOutSelect;
  Notebook1.PageIndex:= 0;
  if dTxt = '' then
    Label1.Caption:= '请在工具栏或菜单选择你需要的功能...'
  else
    Label1.Caption:= dTxt;
end;

procedure TFormPictureProc.EraseBlack(dTxt: String);
begin
  FormPicture.EraseBlack;
  Notebook1.PageIndex:= 0;
  if dTxt = '' then
    Label1.Caption:= '请在工具栏或菜单选择你需要的功能...'
  else
    Label1.Caption:= dTxt;
end;

procedure TFormPictureProc.FullSize(dTxt: String);
begin
  FormPicture.FullSize;
  Notebook1.PageIndex:= 0;
  if dTxt = '' then
    Label1.Caption:= '请在工具栏或菜单选择你需要的功能...'
  else
    Label1.Caption:= dTxt;
end;

procedure TFormPictureProc.LeftRightMirror(dTxt: String);
begin
  FormPicture.SetLeftRightMirror;
  Notebook1.PageIndex:= 0;
  if dTxt = '' then
    Label1.Caption:= '请在工具栏或菜单选择你需要的功能...'
  else
    Label1.Caption:= dTxt;
end;

procedure TFormPictureProc.TopBottomMirror(dTxt: String);
begin
  FormPicture.SetTopBottomMirror;
  Notebook1.PageIndex:= 0;
  if dTxt = '' then
    Label1.Caption:= '请在工具栏或菜单选择你需要的功能...'
  else
    Label1.Caption:= dTxt;
end;

procedure TFormPictureProc.Preferences;
begin
  Notebook1.PageIndex:= 2;
  SpinEdit2.Value:= FormPicture.GetBaseColor;
  SpinEdit3.Value:= FormPicture.GetColorArea;
  ColorBox1.Selected:= FormPicture.GetBKColor;
  CheckBox1.Checked:= FormPicture.GetTransparent;
end;

procedure TFormPictureProc.Button2Click(Sender: TObject);
var
  PF: TextFile;
  cpath: String;
  pcolor: String;
  ps1, ps2, ps3: String;
begin
  cpath:= ExtractFilePath(ParamStr(0));
  ps1:= IntToStr(SpinEdit2.Value);
  ps2:= IntToStr(SpinEdit3.Value);
  ps3:= BoolToStr(CheckBox1.Checked);
  pcolor:= ColorToString(ColorBox1.Selected);
  FormPicture.SetBaseColor(SpinEdit2.Value);
  FormPicture.SetColorArea(SpinEdit3.Value);
  FormPicture.SetBKColor(ColorBox1.Selected);
  FormPicture.SetTransparent(CheckBox1.Checked);
  AssignFile(PF, cpath+'\'+PFILENAME);
  Rewrite(PF);
  Writeln(PF, pcolor);
  Writeln(PF, ps1);
  Writeln(PF, ps2);
  Writeln(PF, ps3);
  CloseFile(PF);
end;

procedure TFormPictureProc.N21Click(Sender: TObject);
begin
  Preferences;
end;

procedure TFormPictureProc.N28Click(Sender: TObject);
begin
  MessageBox(0,'超级图像处理1.0 作者:Harry XSpace Team','关于',MB_ICONINFORMATION);
end;

procedure TFormPictureProc.GetOrgPicture(dTxt: String);
begin
  FormPicture.OrgPictrue;
  Notebook1.PageIndex:= 0;
  if dTxt = '' then
    Label1.Caption:= '请在工具栏或菜单选择你需要的功能...'
  else
    Label1.Caption:= dTxt;
end;

procedure TFormPictureProc.N35Click(Sender: TObject);
begin
  GetOrgPicture;
end;

procedure TFormPictureProc.AutoProcess(dTxt: String);
begin
  Label1.Caption:= '图片正在处理,请稍候...';
  Application.ProcessMessages;
  FormPicture.EraseBlack;
  Notebook1.PageIndex:= 3;
end;

procedure TFormPictureProc.TrackBar1Change(Sender: TObject);
begin
  SpinEdit4.Value:= TrackBar1.Position;
  FormPicture.CustomeRotate(TrackBar1.Position);
end;

procedure TFormPictureProc.Button3Click(Sender: TObject);
begin
  FormPicture.AutoSelect;
  FormPicture.CutOutSelect;
  Notebook1.PageIndex:= 0;
  Label1.Caption:= '请在工具栏或菜单选择你需要的功能...';
  FormPicture.AutoAdjustPosition;
end;

procedure TFormPictureProc.N36Click(Sender: TObject);
begin
  AutoProcess;
end;

procedure TFormPictureProc.N30Click(Sender: TObject);
var
  picture: TPicture;
  bitmap: TBitmap;
begin
  if OpenPictureDialog1.Execute then
  begin
    picture:= TPicture.Create;
    picture.LoadFromFile(OpenPictureDialog1.FileName);
    bitmap:= TBitmap.Create;
    bitmap.Width:= picture.Width;
    bitmap.Height:= picture.Height;
    bitmap.Canvas.Draw(0,0,picture.Graphic);
    InitProc(bitmap);
    bitmap.Free;
    picture.Free;
  end;
end;

procedure TFormPictureProc.SpinEdit4Change(Sender: TObject);
begin
  TrackBar1.Position:= SpinEdit4.Value;
end;

procedure TFormPictureProc.ReadPFCFG;
var
  PF: TextFile;
  cpath: String;
  pcolor: String;
  ps1, ps2, ps3: String;
begin
  cpath:= ExtractFilePath(ParamStr(0));
  if FileExists(cpath+'\'+PFILENAME) then
  begin
    AssignFile(PF, cpath+'\'+PFILENAME);
    Reset(PF);
    Readln(PF, pcolor);
    Readln(PF, ps1);
    Readln(PF, ps2);
    Readln(PF, ps3);
    FormPicture.SetBaseColor(StrToInt(ps1));
    FormPicture.SetColorArea(StrToInt(ps2));
    FormPicture.SetBKColor(StringToColor(pcolor));
    FormPicture.SetTransparent(StrToBool(ps3));
    CloseFile(PF);
  end;
end;

function TFormPictureProc.GetImageFormProc: TBitmap;
var
  jpg: TJPEGImage;
  cpath: string;
begin
  cpath:= ExtractFilePath(ParamStr(0));
  if FileExists(cpath+'\'+'procimage.jpg') then
  begin
    jpg:= TJPEGImage.Create;
    jpg.LoadFromFile(cpath+'\'+'procimage.jpg');
    DeleteFile(cpath+'\'+'procimage.jpg');
    Result:= TBitmap.Create;
    Result.Width:= jpg.Width;
    Result.Height:= jpg.Height;
    Result.Canvas.Draw(0,0,jpg);
    jpg.Free;
  end else
  begin
    MessageBox(0,'找不到图像!','错误',MB_ICONERROR);
    Result:=nil;
    AsSave:= True;
    Close;
  end;
end;

procedure TFormPictureProc.ReplaceImageToProc(Bitmap: TBitmap);
var
  Jpg: TJPEGImage;
  hw: HWND;
  cpath: string;
begin
  if SaveDialog1.Execute then
  begin
    cpath:= ExtractFilePath(ParamStr(0));
    Jpg:= TJPEGImage.Create;
    Jpg.Assign(Bitmap);
    Jpg.SaveToFile(SaveDialog1.FileName);
    Jpg.Free;
    Bitmap.Free;
  end;
end;

procedure TFormPictureProc.ViewMode;
begin
  N4.Visible:= False;
  N31.Visible:= False;
  N1.Visible:= False;
  FormToolBar.ToolButton14.Visible:= False;
  FormToolBar.ToolButton3.Visible:= False;
  FormToolBar.ToolButton2.Visible:= False;
  FormToolBar.ToolButton9.Visible:= False;
  FormToolBar.ToolButton4.Visible:= False;
  FormToolBar.ToolButton14.Visible:= False;
end;

procedure TFormPictureProc.EditMode;
begin
  N4.Visible:= True;
  N31.Visible:= True;
  N1.Visible:= True;
  FormToolBar.ToolButton14.Visible:= True;
  FormToolBar.ToolButton3.Visible:= True;
  FormToolBar.ToolButton2.Visible:= True;
  FormToolBar.ToolButton9.Visible:= True;
  FormToolBar.ToolButton4.Visible:= True;
  FormToolBar.ToolButton14.Visible:= True;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -