<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>梅のブログ</title>
<link>https://ameblo.jp/batarojp/</link>
<atom:link href="https://rssblog.ameba.jp/batarojp/rss20.xml" rel="self" type="application/rss+xml" />
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com" />
<description>ブログの説明を入力します。</description>
<language>ja</language>
<item>
<title>Printer設定の保存・読み込み</title>
<description>
<![CDATA[ <p><span style="font-size:1.4em;">Printer設定の保存・読み込み</span></p><p>&nbsp;</p><p><span style="font-size:0.83em;">unit Unit1;<br><br>{$mode objfpc}{$H+}<br><br>interface<br><br>uses<br>&nbsp; Classes, SysUtils, FileUtil, PrintersDlgs, Forms, Controls,<br>&nbsp; Graphics, Dialogs, Printers, ExtCtrls, StdCtrls, LCLType;<br><br>type<br><br>&nbsp; { TForm1 }<br><br>&nbsp; TForm1 = class(TForm)<br>&nbsp; &nbsp; Button1: TButton;<br>&nbsp; &nbsp; Button2: TButton;<br>&nbsp; &nbsp; Memo1: TMemo;<br>&nbsp; &nbsp; PrinterSetupDialog1: TPrinterSetupDialog;<br>&nbsp; &nbsp; procedure Button1Click(Sender: TObject);<br>&nbsp; &nbsp; procedure Button2Click(Sender: TObject);<br>&nbsp; private<br>&nbsp; &nbsp; { private declarations }<br>&nbsp; public<br>&nbsp; &nbsp; { public declarations }<br>&nbsp; end;<br><br>var<br>&nbsp; Form1: TForm1;<br><br>implementation<br><br>{$R *.lfm}<br><br><br><br>{ TForm1 }<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br>&nbsp; s : string ;<br>&nbsp; sFileName : string ;<br>&nbsp; sDirName : string ;<br>&nbsp; F : TextFile;<br>begin<br>&nbsp; if not PrinterSetupDialog1.Execute then Exit;</span><br><span style="font-size:0.83em;">&nbsp; // プリンタ名<br>&nbsp; Memo1.Clear;<br>&nbsp; s := 'プリンタ名：' + Printer.PrinterName ;<br>&nbsp; Memo1.Lines.Add(s);<br>&nbsp; // PaperSize<br>&nbsp; s := 'PaperSize：' + (Printer.PaperSize.PaperName);<br>&nbsp; Memo1.Lines.Add(s);<br>&nbsp; //横方向の総ドット数<br>&nbsp; s := '横：' + IntToStr(Printer.PageWidth);<br>&nbsp; Memo1.Lines.Add(s);<br>&nbsp; //横方向の解像度<br>&nbsp; s := 'XDPI：' + IntToStr(Printer.XDPI);<br>&nbsp; Memo1.Lines.Add(s);<br>&nbsp; //縦方向の総ドット数<br>&nbsp; s := '縦：' + IntToStr(Printer.PageHeight);<br>&nbsp; Memo1.Lines.Add(s);<br>&nbsp; //縦方向の解像度<br>&nbsp; s := 'XDPI：' + IntToStr(Printer.YDPI);<br>&nbsp; Memo1.Lines.Add(s);<br>&nbsp; //印刷の向き<br>&nbsp; if Printer.Orientation = poPortrait then s := 'Portrait'<br>&nbsp; else s := 'Landscape';<br>&nbsp; s := '向き　　：' + s;<br>&nbsp; Memo1.Lines.Add(s);<br>&nbsp; &nbsp;//給紙ビンの数<br>&nbsp;if Printer.SupportedBins.Count &gt; 0 then<br>&nbsp; &nbsp;begin<br>&nbsp; &nbsp; s := 'BinCount：' + IntToStr(Printer.SupportedBins.Count);<br>&nbsp; &nbsp; Memo1.Lines.Add(s);<br>&nbsp; &nbsp;end;<br>&nbsp;//給紙ビンの名前<br>&nbsp; s := '給紙　　：' + Printer.BinName;<br>&nbsp; Memo1.Lines.Add(s);</span><br><br><span style="font-size:1.4em;">&nbsp; //設定保存</span></p><p>&nbsp;</p><p><span style="font-size:0.83em;">&nbsp; //GetAppConfigDir(False)<br>&nbsp; //win以外も考えるならば(False)が良いかも<br>&nbsp; //C:\Users\ユーザー名\AppData\Local\Printer1<br><br>&nbsp; sDirName := GetAppConfigDir(False);<br>&nbsp; sDirName := Copy(sDirName,1,Length(sDirName) - 1);<br>&nbsp; Memo1.Lines.Add(sDirName);<br>&nbsp; application.ProcessMessages;;<br>&nbsp; if not DirectoryExists(sDirName) then &nbsp;ForceDirectories(sDirName);<br><br>&nbsp; sFileName := GetAppConfigDir(False) + 'Printer.ini';<br>&nbsp; Memo1.Lines.Add(sFileName);<br><br>&nbsp; application.ProcessMessages;;<br>&nbsp; AssignFile(F,sFileName);<br>&nbsp; ReWrite(F);<br>&nbsp; &nbsp; try<br>&nbsp; &nbsp; &nbsp;// プリンタ名<br>&nbsp; &nbsp; &nbsp; WriteLn(F,'PrinterName:' + Printer.PrinterName);<br>&nbsp; &nbsp; &nbsp; // PaperSize<br>&nbsp; &nbsp; &nbsp; WriteLn(F,'PaperSize:' + Printer.PaperSize.PaperName);<br>&nbsp; &nbsp; &nbsp; //縦横<br>&nbsp; &nbsp; &nbsp; if Printer.Orientation = poPortrait then s := 'Portrait'<br>&nbsp; &nbsp; &nbsp; else s := 'Landscape';<br>&nbsp; &nbsp; &nbsp; WriteLn(F,'Orientation:' + s);<br>&nbsp; &nbsp; &nbsp; //給紙ビンの名前<br>&nbsp; &nbsp; &nbsp; WriteLn(F,'BinName:' + Printer.BinName);<br>&nbsp; &nbsp; Finally;<br>&nbsp; &nbsp; &nbsp; CloseFile(F);<br>&nbsp; &nbsp; end;<br>end;<br><br><br><br>procedure TForm1.Button2Click(Sender: TObject);<br>var<br>&nbsp; s, sFileName : string ;<br>&nbsp; sProperty, sValue:string;<br>&nbsp; F : TextFile;<br><br>begin<br>&nbsp; Memo1.Clear;</span></p><p><span style="font-size:1.4em;">//設定読み込み</span><br><span style="font-size:0.83em;">&nbsp; // Button1で保存したファイルを読み込み<br>&nbsp; sFileName := GetAppConfigDir(False) + 'Printer.ini';<br><br>&nbsp; if not FileExists(sFileName) then<br>&nbsp; &nbsp;begin<br>&nbsp; &nbsp; Memo1.Lines.Add('保存したファイルが無い！');<br>&nbsp; &nbsp; Exit;<br>&nbsp; &nbsp;end;<br><br>&nbsp; AssignFile(F,sFileName);<br>&nbsp; ReSet(F);<br>&nbsp; &nbsp;try<br>&nbsp; &nbsp; While not Eof(F) do<br>&nbsp; &nbsp; &nbsp;begin<br>&nbsp; &nbsp; &nbsp; Readln(F, s);<br>&nbsp; &nbsp; &nbsp; sProperty := Copy(S,1,Pos(':',S) - 1);<br>&nbsp; &nbsp; &nbsp; sValue := Copy(S,Pos(':',S) + 1,200);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// プリンタ名をセット<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if sProperty = 'PrinterName' then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Printer.SetPrinter(sValue)<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// PaperSize<br>&nbsp; &nbsp; &nbsp; else if sProperty = 'PaperSize' then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Printer.PaperSize.PaperName := sValue<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//縦横<br>&nbsp; &nbsp; &nbsp;else if sProperty = 'Orientation' then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if &nbsp;sValue = 'Landscape' then Printer.Orientation := poLandscape<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else Printer.Orientation := poPortrait;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//給紙ビンの名前<br>&nbsp; &nbsp; &nbsp; else if sProperty = 'BinName' then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Printer.BinName := sValue;<br><br>&nbsp; &nbsp; &nbsp;end;<br>&nbsp; &nbsp; Finally;<br>&nbsp; &nbsp; &nbsp; CloseFile(F);<br>&nbsp; &nbsp; end;<br><br><br>&nbsp; &nbsp; // プリンタ名<br>&nbsp; &nbsp; s := 'プリンタ名：' + Printer.PrinterName ;<br>&nbsp; &nbsp; Memo1.Lines.Add(s);<br>&nbsp; &nbsp; // PaperSize<br>&nbsp; &nbsp; s := 'PaperSize：' + (Printer.PaperSize.PaperName);<br>&nbsp; &nbsp; Memo1.Lines.Add(s);<br>&nbsp; &nbsp; //横方向の総ドット数<br>&nbsp; &nbsp; s := '横：' + IntToStr(Printer.PageWidth);<br>&nbsp; &nbsp; Memo1.Lines.Add(s);<br>&nbsp; &nbsp; //横方向の解像度<br>&nbsp; &nbsp; s := 'XDPI：' + IntToStr(Printer.XDPI);<br>&nbsp; &nbsp; Memo1.Lines.Add(s);<br>&nbsp; &nbsp; //縦方向の総ドット数<br>&nbsp; &nbsp; s := '縦：' + IntToStr(Printer.PageHeight);<br>&nbsp; &nbsp; Memo1.Lines.Add(s);<br>&nbsp; &nbsp; //縦方向の解像度<br>&nbsp; &nbsp; s := 'XDPI：' + IntToStr(Printer.YDPI);<br>&nbsp; &nbsp; Memo1.Lines.Add(s);<br>&nbsp; &nbsp; //印刷の向き<br>&nbsp; &nbsp; if Printer.Orientation = poPortrait then s := 'Portrait'<br>&nbsp; &nbsp; else s := 'Landscape';<br>&nbsp; &nbsp; s := '向き　　：' + s;<br>&nbsp; &nbsp; Memo1.Lines.Add(s);<br>&nbsp; &nbsp;//給紙ビンの名前<br>&nbsp; &nbsp; s := '給紙　　：' + Printer.BinName;<br>&nbsp; &nbsp; Memo1.Lines.Add(s);<br><br>end;<br><br>end.</span><br>&nbsp;</p>
]]>
</description>
<link>https://ameblo.jp/batarojp/entry-12279108229.html</link>
<pubDate>Tue, 30 May 2017 00:24:36 +0900</pubDate>
</item>
<item>
<title>PrinterSetupDialogの設定</title>
<description>
<![CDATA[ <p>PrinterSetupDialogの設定</p><p>&nbsp;</p><p><a href="https://stat.ameba.jp/user_images/20170528/23/batarojp/ee/f7/p/o0317044913948065282.png"><img alt="" contenteditable="inherit" height="312" src="https://stat.ameba.jp/user_images/20170528/23/batarojp/ee/f7/p/o0317044913948065282.png" width="220"></a></p><p><a href="https://stat.ameba.jp/user_images/20170528/23/batarojp/f7/3b/p/o0398048013948067397.png"><img alt="" contenteditable="inherit" height="265" src="https://stat.ameba.jp/user_images/20170528/23/batarojp/f7/3b/p/o0398048013948067397.png" width="220"></a></p><p>&nbsp;</p><p>&nbsp;</p><p><span style="font-size:1em;">unit Unit1;<br><br>{$mode objfpc}{$H+}<br><br>interface<br><br>uses<br>&nbsp; Classes, SysUtils, FileUtil, PrintersDlgs, Forms, Controls,<br>&nbsp; Graphics, Dialogs, Printers, ExtCtrls, StdCtrls, LCLType;<br><br>type<br><br>&nbsp; { TForm1 }<br><br>&nbsp; TForm1 = class(TForm)<br>&nbsp; &nbsp; Button1: TButton;<br>&nbsp; &nbsp; Button2: TButton;<br>&nbsp; &nbsp; Memo1: TMemo;<br>&nbsp; &nbsp; PrinterSetupDialog1: TPrinterSetupDialog;<br>&nbsp; &nbsp; procedure Button1Click(Sender: TObject);<br>&nbsp; &nbsp; procedure Button2Click(Sender: TObject);<br>&nbsp; private<br>&nbsp; &nbsp; { private declarations }<br>&nbsp; public<br>&nbsp; &nbsp; { public declarations }<br>&nbsp; end;<br><br>var<br>&nbsp; Form1: TForm1;<br><br>implementation<br><br>{$R *.lfm}<br><br><br><br>{ TForm1 }<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br>&nbsp; s : string ;<br>begin<br>&nbsp; PrinterSetupDialog1.Execute;<br>&nbsp; // プリンタ名<br>&nbsp; Memo1.Clear;<br>&nbsp; s := 'プリンタ名：' + Printer.PrinterName ;<br>&nbsp; Memo1.Lines.Add(s);<br>&nbsp; // PaperSize<br>&nbsp; s := 'Size：' + (Printer.PaperSize.PaperName);<br>&nbsp; Memo1.Lines.Add(s);<br>&nbsp; //横方向の総ドット数<br>&nbsp; s := '横：' + IntToStr(Printer.PageWidth);<br>&nbsp; Memo1.Lines.Add(s);<br>&nbsp; //横方向の解像度<br>&nbsp; s := 'XDPI：' + IntToStr(Printer.XDPI);<br>&nbsp; Memo1.Lines.Add(s);<br>&nbsp; //縦方向の総ドット数<br>&nbsp; s := '縦：' + IntToStr(Printer.PageHeight);<br>&nbsp; Memo1.Lines.Add(s);<br>&nbsp; //縦方向の解像度<br>&nbsp; s := 'XDPI：' + IntToStr(Printer.YDPI);<br>&nbsp; Memo1.Lines.Add(s);<br>&nbsp; //印刷の向き<br>&nbsp; if Printer.Orientation = poPortrait then s := 'Portrait'<br>&nbsp; else s := 'Landscape';<br>&nbsp; s := '向き　　：' + s;<br>&nbsp; Memo1.Lines.Add(s);<br>&nbsp; &nbsp;//給紙ビンの数<br>&nbsp;if Printer.SupportedBins.Count &gt; 0 then<br>&nbsp; &nbsp;begin<br>&nbsp; &nbsp; s := 'BinCount：' + IntToStr(Printer.SupportedBins.Count);<br>&nbsp; &nbsp; Memo1.Lines.Add(s);<br>&nbsp; &nbsp;end;<br>&nbsp;//給紙ビンの名前<br>&nbsp; s := '給紙　　：' + Printer.BinName;<br>&nbsp; Memo1.Lines.Add(s);<br>end;<br><br>procedure TForm1.Button2Click(Sender: TObject);<br>var<br>&nbsp; s : string ;<br>begin<br>&nbsp; Memo1.Clear;<br><br>&nbsp; s := 'プリンタ数：' + IntToStr(Printer.Printers.Count);<br>&nbsp; Memo1.Lines.Add(s);<br>&nbsp; Printer.SetPrinter('Fax');<br>&nbsp; Printer.PaperSize.PaperName := 'A5';</span><br>&nbsp;</p><p><span style="font-size:1em;">&nbsp; s := 'プリンタ名：' + Printer.PrinterName ;<br>&nbsp; Memo1.Lines.Add(s);<br>&nbsp; s := 'Size：' + (Printer.PaperSize.PaperName);<br>&nbsp; Memo1.Lines.Add(s);<br>&nbsp; s := '横：' + IntToStr(Printer.PageWidth);<br>&nbsp; Memo1.Lines.Add(s);<br>&nbsp; s := 'XDPI：' + IntToStr(Printer.XDPI);<br>&nbsp; Memo1.Lines.Add(s);<br>&nbsp; s := '縦：' + IntToStr(Printer.PageHeight);<br>&nbsp; Memo1.Lines.Add(s);<br>&nbsp; s := 'XDPI：' + IntToStr(Printer.YDPI);<br>end;<br><br>end.</span><br>&nbsp;</p>
]]>
</description>
<link>https://ameblo.jp/batarojp/entry-12278798117.html</link>
<pubDate>Sun, 28 May 2017 23:25:46 +0900</pubDate>
</item>
<item>
<title>Lazarusで印刷</title>
<description>
<![CDATA[ <p><span style="font-size:1.4em;">Lazarusで印刷</span></p><p><span style="font-size:1em;">　<a href="http://ameblo.jp/batarojp/entry-12278798117.html">PrinterSetupDialogの設定</a></span></p><p><a href="http://ameblo.jp/batarojp/entry-12279108229.html">Printer設定の保存・読み込み</a></p>
]]>
</description>
<link>https://ameblo.jp/batarojp/entry-12276644850.html</link>
<pubDate>Sun, 21 May 2017 15:54:31 +0900</pubDate>
</item>
<item>
<title>Lazarus備忘録Top</title>
<description>
<![CDATA[ <p><span style="font-size:1.96em;">Lazarus備忘録</span></p><ol><li><a href="http://ameblo.jp/batarojp/entry-12276644850.html">Lazarusで印刷</a></li></ol>
]]>
</description>
<link>https://ameblo.jp/batarojp/entry-12276643387.html</link>
<pubDate>Sun, 14 May 2017 18:36:37 +0900</pubDate>
</item>
</channel>
</rss>
