Delphi

TTreeView - Collapse and Expand Images not Alligned

淺唱寂寞╮ 提交于 2020-05-24 07:04:07
问题 Does anyone know how I can align the collapse/expand images with the center of my icon? Using a white theme they are correct, but in the dark theme, the arrows seem to be bottom-aligned: 回答1: If you're using VCL Style Utils components, then modify UxTheme_TreeView in Vcl.Styles.UxTheme.pas case iPartId of TVP_GLYPH: begin LColor := StyleServices.GetSystemColor(clWindowText); LRect := pRect; LRect.Top := LRect.Top + 1; // <---- here's the change //LRect.Top := LRect.Top + 5; LRect.Left :=

How to fill cell of a string grid using custom color?

让人想犯罪 __ 提交于 2020-05-23 10:56:13
问题 I am trying to write custom date picker(calendar). The dates will be displayed on the stringgrid. I am trying to fill the clicked cell with a custom color and make that selected celltext bold. Here is my code: type TStringGrid = Class(Vcl.Grids.TStringGrid) private FHideFocusRect: Boolean; protected Procedure Paint;override; public Property HideFocusRect:Boolean Read FHideFocusRect Write FHideFocusRect; End; TfrmNepaliCalendar = class(TForm) ... ... ... end; procedure TfrmNepaliCalendar

Http response: Cannot convert JSON into stream

最后都变了- 提交于 2020-05-16 07:13:06
问题 I have an API in JAVA to upload a zip file to a server in Delphi, and I am doing it as follows: DSRESTConnection conn = new DSRESTConnection(); conn.setHost("example.com"); conn.setPort(8080); TServerMethods1 proxy = new TServerMethods1(conn); try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); BufferedOutputStream bos = new BufferedOutputStream(baos); ZipOutputStream zos = new ZipOutputStream(bos); zos.putNextEntry(new ZipEntry("test.json")); byte[] bytes = inputJson.getBytes();

How to load a TImage using task dialog common icons?

微笑、不失礼 提交于 2020-05-15 09:13:37
问题 I'm trying to load icons used by Delphi's task dialogs into a TImage control. As I've learned here, I'm using LoadImage function but icons appear lightly different from the ones which are used by the MessageDlg function. unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TForm1 = class(TForm) Button1: TButton; Image1: TImage; procedure Button1Click(Sender: TObject); private { Private declarations } public {

How to load a TImage using task dialog common icons?

女生的网名这么多〃 提交于 2020-05-15 09:09:12
问题 I'm trying to load icons used by Delphi's task dialogs into a TImage control. As I've learned here, I'm using LoadImage function but icons appear lightly different from the ones which are used by the MessageDlg function. unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TForm1 = class(TForm) Button1: TButton; Image1: TImage; procedure Button1Click(Sender: TObject); private { Private declarations } public {

How to treat warnings as errors in Delphi 10.2 while setting some warnings to False

十年热恋 提交于 2020-05-15 08:02:27
问题 In Delphi 10.2 there is this option to treat warnings as errors (Project options -> Delphi Compiler -> Hints and Warnings -> Output warnings). The optiona are True , False and as errors . When set to as errors the compiler will treat every warning as an error, making the build fail. For me, this is essential as I want my build server to fail on any warning (I am using a Microsoft Azure DevOps build pipeline). The problem is that when I set any of the listed warnings to a non-default value

How to use MOVE for dynamic arrays with a record as an element and a dynamic array field on it?

送分小仙女□ 提交于 2020-05-15 05:55:41
问题 I'm using Delphi Rio and my program has a lot of dynamic arrays operations. In order to improve speed of some long array copy, I tried to use Move . For 1D dynamic arrays of basic types (real, integer) I could manage the use of Move, but for a dynamic arrays with a record as its element and this record with another dynamic array fields I'm having trouble to make it work. The way I' using MOVE for the dynamic arrays fileds of records, after issue the command , these fileds continue pointing to

Are unique indices on Access text fields always case insensitive?

孤人 提交于 2020-05-15 02:34:47
问题 I created an MS Access table using the following code: tbl := Database.CreateTableDef('English', 0, '', ''); try fld := tbl.CreateField('ID', dbLong, 0); fld.Attributes := dbAutoIncrField + dbFixedField; tbl.Fields.Append(fld); fld := tbl.CreateField('Content', dbText, 255); fld.Required := true; fld.AllowZeroLength := false; tbl.Fields.Append(fld); Database.TableDefs.Append(tbl); idx := tbl.CreateIndex('PrimaryKey'); idx.Fields.Append(idx.CreateField('ID', EmptyParam, EmptyParam)); idx

How to draw transparent text on form?

不羁岁月 提交于 2020-05-13 18:08:24
问题 Is there a way to draw a transparent text on form that has some controls? If I use TLabel control, it would always show behind controls on the form. 回答1: You cannot use a TLabel control, since it is not a windowed control, and therefore it will be hidden by every windowed child control of the form. You could use a TStaticText , which is indeed a windowed control (a STATIC control), but it will be a bit difficult to make it truly transparent, I'd suppose. You can use layered windows for this:

Delphi TeeChart - print preview and save dialog

丶灬走出姿态 提交于 2020-05-13 14:25:27
问题 I'm using the built in TeeChart in Delphi XE for graphs. When I just put a graph on a form, I have all these options to export/save or print preview, but those aren't there at runtime. I want to add a button for a save dialog and a print preview (right now I just have it doing Chart1.Print and Chart1.SaveToBitmapFile) I googled around and I found this link: http://www.steema.com/support/faq/NewVCL/FAQ_VCL_DIALOGS.htm So I added EditChar to Uses and added the line EditChart(Self,Chart1 ); but