IdAboutDotNET.pas 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. unit IdAboutDotNET;
  2. interface
  3. uses
  4. System.Drawing, System.Collections, System.ComponentModel,
  5. System.Windows.Forms, System.Data;
  6. type
  7. TfrmAbout = class(System.Windows.Forms.Form)
  8. {$REGION 'Designer Managed Code'}
  9. strict private
  10. /// <summary>
  11. /// Required designer variable.
  12. /// </summary>
  13. Components: System.ComponentModel.Container;
  14. imgLogo: System.Windows.Forms.PictureBox;
  15. bbtnOk: System.Windows.Forms.Button;
  16. lblName: System.Windows.Forms.Label;
  17. lblName2: System.Windows.Forms.Label;
  18. lblVersion: System.Windows.Forms.Label;
  19. lblCopyright: System.Windows.Forms.Label;
  20. lblBuiltFor: System.Windows.Forms.Label;
  21. lblLicense: System.Windows.Forms.Label;
  22. lblPleaseVisitUs: System.Windows.Forms.Label;
  23. lblURL: System.Windows.Forms.LinkLabel;
  24. /// <summary>
  25. /// Required method for Designer support - do not modify
  26. /// the contents of this method with the code editor.
  27. /// </summary>
  28. procedure InitializeComponent;
  29. procedure lblURL_LinkClicked(sender: System.Object; e: System.Windows.Forms.LinkLabelLinkClickedEventArgs);
  30. {$ENDREGION}
  31. strict protected
  32. /// <summary>
  33. /// Clean up any resources being used.
  34. /// </summary>
  35. procedure Dispose(Disposing: Boolean); override;
  36. protected
  37. { Private Declarations }
  38. function GetProductName: string;
  39. procedure SetProductName(const AValue: string);
  40. function GetProductName2: string;
  41. procedure SetProductName2(const AValue: string);
  42. function GetVersion: string;
  43. procedure SetVersion(const AValue: string);
  44. function LoadBitmap(AResName: string): Bitmap;
  45. public
  46. constructor Create;
  47. //we have a method for providing a product name and version in case
  48. //we ever want to make another product.
  49. class Procedure ShowAboutBox(const AProductName, AProductName2, AProductVersion : String);
  50. class Procedure ShowDlg;
  51. property ProductName : String read GetProductName write SetProductName;
  52. property ProductName2 : String read GetProductName2 write SetProductName2;
  53. property Version : String read GetVersion write SetVersion;
  54. end;
  55. [assembly: RuntimeRequiredAttribute(TypeOf(TfrmAbout))]
  56. implementation
  57. uses
  58. IdDsnCoreResourceStrings, System.Diagnostics,
  59. IdGlobal, System.Reflection, System.Resources, SysUtils;
  60. const
  61. ResourceBaseName = 'IdAboutNET';
  62. {$R 'AboutIndyNET.resources'}
  63. {$AUTOBOX ON}
  64. {$REGION 'Windows Form Designer generated code'}
  65. /// <summary>
  66. /// Required method for Designer support -- do not modify
  67. /// the contents of this method with the code editor.
  68. /// </summary>
  69. procedure TfrmAbout.InitializeComponent;
  70. begin
  71. Self.imgLogo := System.Windows.Forms.PictureBox.Create;
  72. Self.bbtnOk := System.Windows.Forms.Button.Create;
  73. Self.lblName := System.Windows.Forms.Label.Create;
  74. Self.lblName2 := System.Windows.Forms.Label.Create;
  75. Self.lblVersion := System.Windows.Forms.Label.Create;
  76. Self.lblCopyright := System.Windows.Forms.Label.Create;
  77. Self.lblBuiltFor := System.Windows.Forms.Label.Create;
  78. Self.lblLicense := System.Windows.Forms.Label.Create;
  79. Self.lblPleaseVisitUs := System.Windows.Forms.Label.Create;
  80. Self.lblURL := System.Windows.Forms.LinkLabel.Create;
  81. Self.SuspendLayout;
  82. //
  83. // imgLogo
  84. //
  85. Self.imgLogo.Location := System.Drawing.Point.Create(0, 0);
  86. Self.imgLogo.Name := 'imgLogo';
  87. Self.imgLogo.Size := System.Drawing.Size.Create(388, 240);
  88. Self.imgLogo.TabIndex := 0;
  89. Self.imgLogo.TabStop := False;
  90. //
  91. // bbtnOk
  92. //
  93. Self.bbtnOk.Anchor := (System.Windows.Forms.AnchorStyles((System.Windows.Forms.AnchorStyles.Bottom
  94. or System.Windows.Forms.AnchorStyles.Right)));
  95. Self.bbtnOk.DialogResult := System.Windows.Forms.DialogResult.Cancel;
  96. Self.bbtnOk.Location := System.Drawing.Point.Create(475, 302);
  97. Self.bbtnOk.Name := 'bbtnOk';
  98. Self.bbtnOk.TabIndex := 0;
  99. Self.bbtnOk.Text := 'Button1';
  100. //
  101. // lblName
  102. //
  103. Self.lblName.Font := System.Drawing.Font.Create('Arial Black', 14.25, System.Drawing.FontStyle.Regular,
  104. System.Drawing.GraphicsUnit.Point, (Byte(0)));
  105. Self.lblName.Location := System.Drawing.Point.Create(51, 28);
  106. Self.lblName.Name := 'lblName';
  107. Self.lblName.Size := System.Drawing.Size.Create(200, 101);
  108. Self.lblName.TabIndex := 1;
  109. Self.lblName.Text := 'Label1';
  110. Self.lblName.TextAlign := System.Drawing.ContentAlignment.TopCenter;
  111. //
  112. // lblName2
  113. //
  114. Self.lblName.Font := System.Drawing.Font.Create('Arial', 14.25, System.Drawing.FontStyle.Regular,
  115. System.Drawing.GraphicsUnit.Point, (Byte(0)));
  116. Self.lblName.Location := System.Drawing.Point.Create(54, 110);
  117. Self.lblName.Name := 'lblName';
  118. Self.lblName.Size := System.Drawing.Size.Create(192, 35);
  119. Self.lblName.TabIndex := 2;
  120. Self.lblName.Text := 'Label2';
  121. Self.lblName.TextAlign := System.Drawing.ContentAlignment.TopCenter;
  122. //
  123. // lblVersion
  124. //
  125. Self.lblVersion.Font := System.Drawing.Font.Create('Arial', 14.25,
  126. System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (Byte(0)));
  127. Self.lblVersion.Location := System.Drawing.Point.Create(300, 170);
  128. Self.lblVersion.Name := 'lblVersion';
  129. Self.lblVersion.Size := System.Drawing.Size.Create(200, 17);
  130. Self.lblVersion.TabIndex := 3;
  131. Self.lblVersion.Text := 'Label3';
  132. Self.lblVersion.TextAlign := System.Drawing.ContentAlignment.TopRight;
  133. //
  134. // lblCopyright
  135. //
  136. Self.lblCopyright.Font := System.Drawing.Font.Create('Arial', 14.25,
  137. System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, (Byte(0)));
  138. Self.lblCopyright.Location := System.Drawing.Point.Create(58, 171);
  139. Self.lblCopyright.Name := 'lblCopyright';
  140. Self.lblCopyright.Size := System.Drawing.Size.Create(138, 15);
  141. Self.lblCopyright.TabIndex := 6;
  142. Self.lblCopyright.Text := 'Label6';
  143. Self.lblCopyright.TextAlign := System.Drawing.ContentAlignment.TopCenter;
  144. //
  145. // lblBuiltFor
  146. //
  147. Self.lblBuiltFor.Anchor := (System.Windows.Forms.AnchorStyles(((System.Windows.Forms.AnchorStyles.Top
  148. or System.Windows.Forms.AnchorStyles.Right)));
  149. Self.lblBuiltFor.Font := System.Drawing.Font.Create('Arial', 14.25,
  150. System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, (Byte(0)));
  151. Self.lblBuiltFor.Location := System.Drawing.Point.Create(300, 188);
  152. Self.lblBuiltFor.Name := 'lblBuiltFor';
  153. Self.lblBuiltFor.Size := System.Drawing.Size.Create(200, 17);
  154. Self.lblBuiltFor.TabIndex := 4;
  155. Self.lblBuiltFor.Text := 'Label4';
  156. Self.lblBuiltFor.TextAlign := System.Drawing.ContentAlignment.TopRight;
  157. //
  158. // lblLicense
  159. //
  160. Self.lblLicense.Anchor := (System.Windows.Forms.AnchorStyles(((System.Windows.Forms.AnchorStyles.Top
  161. or System.Windows.Forms.AnchorStyles.Right)));
  162. Self.lblLicense.Font := System.Drawing.Font.Create('Arial', 14.25,
  163. System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, (Byte(0)));
  164. Self.lblLicense.Location := System.Drawing.Point.Create(300, 227);
  165. Self.lblLicense.Name := 'lblLicense';
  166. Self.lblLicense.Size := System.Drawing.Size.Create(200, 45);
  167. Self.lblLicense.TabIndex := 5;
  168. Self.lblLicense.Text := 'Label5';
  169. Self.lblBuiltFor.TextAlign := System.Drawing.ContentAlignment.TopRight;
  170. //
  171. // lblPleaseVisitUs
  172. //
  173. Self.lblPleaseVisitUs.Font := System.Drawing.Font.Create('Arial', 14.25,
  174. System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, (Byte(0)));
  175. Self.lblPleaseVisitUs.Location := System.Drawing.Point.Create(58, 278);
  176. Self.lblPleaseVisitUs.Name := 'lblPleaseVisitUs';
  177. Self.lblPleaseVisitUs.Size := System.Drawing.Size.Create(276, 15);
  178. Self.lblPleaseVisitUs.TabIndex := 7;
  179. Self.lblPleaseVisitUs.Text := 'Label7';
  180. Self.lblPleaseVisitUs.TextAlign := System.Drawing.ContentAlignment.TopCenter;
  181. //
  182. // lblURL
  183. //
  184. Self.lblCopyright.Font := System.Drawing.Font.Create('Arial', 14.25,
  185. System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, (Byte(0)));
  186. Self.lblURL.Location := System.Drawing.Point.Create(58, 292);
  187. Self.lblURL.Name := 'lblURL';
  188. Self.lblURL.Size := System.Drawing.Size.Create(141, 15);
  189. Self.lblURL.TabIndex := 8;
  190. Self.lblURL.TabStop := True;
  191. Self.lblURL.Text := 'LinkLabel8';
  192. Self.lblURL.TextAlign := System.Drawing.ContentAlignment.TopCenter;
  193. Include(Self.lblURL.LinkClicked, Self.lblURL_LinkClicked);
  194. //
  195. // TfrmAbout
  196. //
  197. Self.AcceptButton := Self.bbtnOk;
  198. Self.AutoScaleBaseSize := System.Drawing.Size.Create(5, 13);
  199. Self.CancelButton := Self.bbtnOk;
  200. Self.ClientSize := System.Drawing.Size.Create(336, 554);
  201. Self.Controls.Add(Self.lblURL);
  202. Self.Controls.Add(Self.lblPleaseVisitUs);
  203. Self.Controls.Add(Self.lblCopyright);
  204. Self.Controls.Add(Self.lblVersion);
  205. Self.Controls.Add(Self.lblName);
  206. Self.Controls.Add(Self.lblName2);
  207. Self.Controls.Add(Self.lblBuiltFor);
  208. Self.Controls.Add(Self.lblLicense);
  209. Self.Controls.Add(Self.bbtnOk);
  210. Self.Controls.Add(Self.imgLogo);
  211. Self.FormBorderStyle := System.Windows.Forms.FormBorderStyle.FixedDialog;
  212. Self.MaximizeBox := False;
  213. Self.MinimizeBox := False;
  214. Self.Name := 'TfrmAbout';
  215. Self.ShowInTaskbar := False;
  216. Self.StartPosition := System.Windows.Forms.FormStartPosition.CenterScreen;
  217. Self.Text := 'WinForm';
  218. Self.ResumeLayout(False);
  219. end;
  220. {$ENDREGION}
  221. procedure TfrmAbout.Dispose(Disposing: Boolean);
  222. begin
  223. if Disposing then
  224. begin
  225. if Components <> nil then
  226. Components.Dispose();
  227. end;
  228. inherited Dispose(Disposing);
  229. end;
  230. constructor TfrmAbout.Create;
  231. begin
  232. inherited Create;
  233. //
  234. // Required for Windows Form Designer support
  235. //
  236. InitializeComponent;
  237. //
  238. // TODO: Add any constructor code after InitializeComponent call
  239. //
  240. Self.Text := RSAAboutFormCaption;
  241. lblName.Text := RSAAboutBoxTitle1;
  242. lblName2.Text := RSAAboutBoxTitle2;
  243. lblBuiltFor.Text := IndyFormat(RSAAboutBoxBuiltFor, ['DotNET']);
  244. lblLicense.Text := RSAAboutBoxLicences;
  245. lblCopyright.Text := RSAAboutBoxCopyright;
  246. lblPleaseVisitUs.Text := RSAAboutBoxPleaseVisit;
  247. lblURL.Text := RSAAboutBoxIndyWebsite;
  248. lblURL.Links.Add(0, Length(RSAABoutBoxIndyWebsite), RSAAboutBoxIndyWebsite);
  249. bbtnOk.Text := RSOk;
  250. imgLogo.Image := LoadBitmap('AboutBackground.bmp');
  251. end;
  252. procedure TfrmAbout.SetProductName(const AValue : String);
  253. begin
  254. Self.lblName.Text := AValue;
  255. end;
  256. procedure TfrmAbout.SetProductName2(const AValue : String);
  257. begin
  258. Self.lblName2.Text := AValue;
  259. end;
  260. procedure TfrmAbout.SetVersion(const AValue: string);
  261. begin
  262. Self.lblVersion.Text := AValue;
  263. end;
  264. function TfrmAbout.GetVersion: string;
  265. begin
  266. Result := Self.lblVersion.Text;
  267. end;
  268. function TfrmAbout.GetProductName: string;
  269. begin
  270. Result := Self.lblName.Text;
  271. end;
  272. function TfrmAbout.GetProductName2: string;
  273. begin
  274. Result := Self.lblName2.Text;
  275. end;
  276. class procedure TfrmAbout.ShowAboutBox(const AProductName, AProductName2,
  277. AProductVersion: String);
  278. begin
  279. with TfrmAbout.Create do
  280. try
  281. Version := IndyFormat(RSAAboutBoxVersion, [AProductVersion]);
  282. ProductName := AProductName;
  283. ProductName2 := AProductName2;
  284. Text := AProductName;
  285. ShowDialog;
  286. finally
  287. Dispose;
  288. end;
  289. end;
  290. class procedure TfrmAbout.ShowDlg;
  291. begin
  292. ShowAboutBox(RSAAboutBoxTitle1, RSAAboutBoxTitle2, gsIdVersion);
  293. end;
  294. procedure TfrmAbout.lblURL_LinkClicked(sender: System.Object; e: System.Windows.Forms.LinkLabelLinkClickedEventArgs);
  295. var
  296. LDest : String;
  297. begin
  298. LDest := e.Link.LinkData as string;
  299. System.Diagnostics.Process.Start(LDest);
  300. e.Link.Visited := True;
  301. end;
  302. function TfrmAbout.LoadBitmap(AResName: string): Bitmap;
  303. var
  304. LR: System.Resources.ResourceManager;
  305. begin
  306. LR := System.Resources.ResourceManager.Create('AboutIndyNET', System.Reflection.Assembly.GetExecutingAssembly);
  307. Result := (Bitmap(LR.GetObject(AResName)));
  308. end;
  309. end.