deepinlinuxv23b3用lazarus3.2开发生成2维码

下载:

https://sourceforge.net/projects/lazarus/files/
    最新版3.2.2的fpc,3.2的lazarus
    sourceforge默认下载慢,选择auto-select能够选择近的镜像站点,还不行的话也能够motrix下载会自动更换域名

linux的qrencode安装是 sudo apt install qrencode

设置 lazarus

启动先安装gif控件,重启后在wile64控件组里有
    然后软件包启用dock相关三个组建,分散式ide变成一体化ide
    工具 选项 :编辑器 显示 右边线 从80改为120 字体更新为 dejavu sans mono 这样中英文在一起等高更好看些
    豆沙绿 RGB值为199, 237, 204,lazarus显示 颜色把默认文本背景色更新为钱绿
    工具 选项 :环境 对象查看器 背景也更新为 钱绿 不同值背景色 更新为银白 值更新为紫红 参考 更新为紫    
            窗体编辑器 网格把黑色改为中灰 其他设计器背景色 更新为 银白
    给lazarus工程信息文件lpi创建了图标/usr/share/mime/packages/lazarus.xml
    <generic-icon name="lazarus"/>这一行指定图标

linux用的图标主题boom

将文件放到 /usr/share/icons/bloom/mimetypes/48/lazarus.svg

linux下lazarus代码不能输入中文,尝试增加宏定义WITH_GTK2_IM失败

采用老办法 https://www.cnblogs.com/qiufeng2014/p/15640889.html

给/usr/share/lazarus/3.2.0/ide/sourceeditor.pp 和 sourceeditor.lfm增加写权限

procedure InsertKeyword(const AKeyWord: string);

	procedure TSourceEditor.InsertKeyword(const AKeyWord: string);
	begin
	  if ReadOnly then Exit;
	  FEditor.InsertTextAtCaret(AKeyWord);
	end;
procedure TSourceNotebook.FormKeyDown(Sender: TObject; var Key: Word;
	  Shift: TShiftState);
	var _sIns:String;
	begin
	  if (ssCtrl in Shift) and (key=13) then
	  begin
		key:=0;
		_sIns:=trim(InputBox('输入待插入中文字符','',''));
		if _sIns<>'' then
		begin
		  GetActiveSE.InsertKeyword(_sIns);
		  FocusEditor;
		end;
	  end;
	end;

然后重新编译lazarus,如果失败就用sudo启动lazarus编译,如果使用中有破坏了lazarus,清空home下.lazarus,就可以继续使用,只不过自定义的一堆要重来一遍

新建lazarus项目界面上一个gif控件一个普通控件,一个输入文本框,一个执行按钮,一个退出按钮,界面很简单,下面是业务代码备用

unit Unit1;
{$mode objfpc}{$H+}
interface
uses
  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls,
  GifAnim, Process;
type
  { TForm1 }
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Edit1: TEdit;
    GifAnim1: TGifAnim;
    Image1: TImage;
    Label1: TLabel;
    Timer1: TTimer;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);    
    procedure Timer1Timer(Sender: TObject);
  private
  public
  end;
var
  Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure convertimg(Source: string);
var
  Process: TProcess;
begin
  if (length(Source) > 0) then
  begin
    Form1.label1.Caption := '开始执行了...';
    Process := TProcess.Create(nil);
    try
      Process.InheritHandles := False;
      Process.Options := [];
      //Process.ShowWindow := swoShow;
      Process.Executable := 'qrencode';
      Process.Parameters.Add('-l');
      Process.Parameters.Add('L');
      Process.Parameters.Add('-v');
      Process.Parameters.Add('1');
      Process.Parameters.Add('-s');
      Process.Parameters.Add('11');
      Process.Parameters.Add('-o');
      Process.Parameters.Add('output.png');
      Process.Parameters.Add(Source);
      Process.Execute;
      Form1.label1.Caption := '已经执行了';
    except
      on E: EOSError do
        Form1.label1.Caption := '请检查文件路径是否有空格';
    end;
    Process.Free;
  end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
  Close();
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  GifAnim1.FileName := 'loading.gif';
  GifAnim1.Visible := True;
  convertimg(Edit1.Text);
  Timer1.Enabled := True;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Timer1.Enabled := False;
  if FileExists('output.png') then
    image1.Picture.LoadFromFile('output.png');
  GifAnim1.Visible := False;
end;

end.

  • 4
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值