Delphi

Delphi使用Zint生成QR二维条码(zint.dll)

守給你的承諾、 提交于 2020-02-25 07:29:58
Delphi使用Zint生成QRCODE 本文使用的Zint Barcode Library(zint.dll)版本为2.6.0,和之前使用的2.4.3版本在zint_symbol这个结构体上会有差异。 文件下载地址: https://sourceforge.net/projects/zint/files/zint/2.6.0/ ,下载zint-2.6.0_win32_qtZint_cmd_tcl.zip这个文件,里面包含了要使用的zint.dll 在Delphi定义和zint_symbol对应的结构体和常量: type TZintSymbol = packed record symbology: Integer; height: Integer; whitespace_width: Integer; border_width: Integer; output_options: Integer; fgcolour: array[0..9] of AnsiChar; bgcolour: array[0..9] of AnsiChar; outfile: array[0..255] of AnsiChar; scale: Single; option_1: Integer; option_2: Integer; option_3: Integer; show_hrt: Integer;

Drawing to main form canvas from a non-main thread

a 夏天 提交于 2020-02-24 16:57:25
问题 I am trying to make an arcade game for my school project. The basic idea is to do all the math and drawing in other thread than the main, and to use the main thread only for input routines. Drawing is done by a procedure saved in an external unit, and is done by creating a bitmap, then drawing parts of the environment on the bitmap and finally dawing the bitmap on the main form's canvas. When I finished the drawing procedure, I tried to run it from the main thread, and managed to make

How do I restrict my custom control's children to a certain area?

限于喜欢 提交于 2020-02-24 12:09:21
问题 I have a custom control based on TPanel , and it has an inner panel that defines the working region for my components and a outer area with a "minimize/restore" button to hide and show the (inner) panel. If I drop a component at design time on my control and set its Align property to alClient , the size of the outer panel is used and the minimize button is no longer visible. How can I align or drop components on my panel to force them (to stay) within the area of the inner panel? 回答1: Place

Using Chromium Edge WebView2 in Delphi or C++ Builder

纵然是瞬间 提交于 2020-02-24 11:54:08
问题 Now that the Microsoft Chromium Edge is final, is it possible to use it in Delphi or C++ Builder? As I understand it is based on a WebView2 component. Is there a component such as TWebView2 or will Embarcadero provide one? Is there an example how to host WebView2 in Delphi / C++ Builder? Is it enough to install the latest Edge version so the app can utilize it? There was an example for the older version - EdgeHTML - here: Using WebView (EdgeHTML) in Delphi / C++ Builder 回答1: You can use

Delphi XE3 WM_HOTKEY How to tell when HotKey is Released ?

谁说胖子不能爱 提交于 2020-02-24 10:36:32
问题 I am trying to program a "cough button" in a communications program that does not always have focus. I have the code working to mute and unmute the mic (MMDevApi) and it works perfect. I set up a global hot key and this works perfect to set the mute. Now the problem. How do I tell when the Hotkey is released ? I tried a timer as shown in the code but it has an odd behavior. I Hold down my hotkey and the mic mutes immediately then after the interval of the timer it unmutes for a what appears

Delphi - Detect Int64 Overflow Error

你。 提交于 2020-02-24 09:10:46
问题 In Delphi how can I detect overflow errors for Int64 ? For Integers we could do: type MyInt = Integer; //Int64 function TryMaxTimes10(out Res: MyInt): boolean; var a, b: MyInt; begin {$Q+} try a := High(MyInt); b := 10; Res := a * b; //REF1 Result := True; except Result := False; end; {$Q-} end; For MyInt = Integer , line REF1 gives an exception and so TryMaxTimes10 returns false . But if we change MyInt to MyInt = Int64 , then REF1 does not give an exception and TryMaxTimes10 returns true !

Delphi - Detect Int64 Overflow Error

家住魔仙堡 提交于 2020-02-24 09:09:20
问题 In Delphi how can I detect overflow errors for Int64 ? For Integers we could do: type MyInt = Integer; //Int64 function TryMaxTimes10(out Res: MyInt): boolean; var a, b: MyInt; begin {$Q+} try a := High(MyInt); b := 10; Res := a * b; //REF1 Result := True; except Result := False; end; {$Q-} end; For MyInt = Integer , line REF1 gives an exception and so TryMaxTimes10 returns false . But if we change MyInt to MyInt = Int64 , then REF1 does not give an exception and TryMaxTimes10 returns true !

Why casting an open array parameter to an array type causes E2089 Invalid typecast?

和自甴很熟 提交于 2020-02-24 00:34:13
问题 I'm using Delphi 2007 (Pre generics) and I've defined many functions who can be used for all arrays of TObject 's descendants, example: function IndexOf(AArray : array of TObject; AItem : TObject) : integer; begin //... end; For passing them dynamic arrays of TObject 's descendants, I've defined an array type TObjectArray = array of TObject . In this way I can cast dynamic arrays and pass them to my functions without any problems: type TChild = class(TObject); ... procedure Test(); var Items

The initialization part is not called

≡放荡痞女 提交于 2020-02-23 10:29:32
问题 I'm maintaining the VirtualTreeView component for Delphi and C++Builder. With Delphi everything is okay but when I compile the packages with the C++Builder the code in the initialization part in the Delphi units is not called. Any ideas? 回答1: When a Delphi unit's initialization / finalization sections are not being called in a C++Builder project, it usually means the Delphi unit is not being linked into the final executable, typically because the C++ code is not directly referencing any code

Delphi DbgridEh实现鼠标拖动选中列,并使复选框选中

大憨熊 提交于 2020-02-23 01:26:31
1.先设置表格列的属性 procedure TForm_TaskToDW.InitGrid; var MyCol: TColumnEh; begin with DBGridEh_Task do begin Columns.Clear; MyCol := Columns.Add; MyCol.FieldName := 'Select'; MyCol.Title.Caption := '选择'; MyCol.Alignment := taCenter; MyCol.Width := 50; MyCol.ReadOnly := false; MyCol := Columns.Add; MyCol.FieldName := 'TASK_NAME'; MyCol.Title.Caption := '任务名称'; MyCol.Width := 300; //MyCol.Alignment := taCenter; MyCol.ReadOnly := True; end; end; 2.创建CDS procedure TForm_TaskToDW.CreateCDSFlds; begin with CDS_Task do begin FieldDefs.Clear; FieldDefs.Add('Select', ftBoolean); FieldDefs.Add('TASK_ID',