vcl

Load Jpg/Gif/Bitmap and convert to Bitmap

天大地大妈咪最大 提交于 2019-11-27 03:42:05
I have to load an image from an XML file. There is no information in the XML file about whether the image is JPG/GIF/BMP. After loading the image, I need to convert it to Bitmap. Does anyone have any clue how to convert images to Bitmap without knowing the actual file format? I'm using Delphi 2007/2009 Thank you. Delphi 2009 comes with built in support for JPEG, BMP, GIF and PNG. For earlier versions of Delphi you may need to find third party implementations for PNG and GIF, but in Delphi 2009 you simply add the Jpeg , pngimage and GIFImg units to your uses clause. If the file has an extension

Is there any way to get all the controls on a container control?

被刻印的时光 ゝ 提交于 2019-11-27 03:17:01
问题 I've got a form with a bunch of controls on it, and I wanted to iterate through all the controls on a certain panel and enable/disable them. I tried this: var component: TComponent; begin for component in myPanel do (component as TControl).Enabled := Value; end; But that did nothing. Turns out all components are in the form's component collection, not their parent object's. So does anyone know if there's any way to get all the controls inside a control? (Besides an ugly workaround like this,

Hide the Main Form in a Delphi 2009 Application

淺唱寂寞╮ 提交于 2019-11-27 02:22:07
问题 The following code works fine in Delphi 7. However, in Delphi 2009 the form does remain hidden but the button on the taskbar is now appearing. ShowWindow(Handle, SW_HIDE); SetWindowLong(Handle, GWL_EXSTYLE, GetWindowLong(Handle, GWL_EXSTYLE) or WS_EX_TOOLWINDOW ); ShowWindow(Handle, SW_SHOW); The above code is called in the FormCreate method. 回答1: Turns out the reason we were seeing the Application window on the taskbar was a simple setting similar to stukelly's answer but not quite. To get

How to add mouse wheel support to a component descended from TGraphicControl?

若如初见. 提交于 2019-11-26 23:08:25
I have created a delphi component which descends from TGraphicControl. Is it possible to add support for mouse wheels? --- Edit --- I've exposed the MouseWheel events as shown below but they aren't called. TMyComponent = class(TGraphicControl) published property OnMouseWheel; property OnMouseWheelDown; property OnMouseWheelUp; end; --- Edit --- As suggested below, I've tried to trap the WM_MOUSEWHEEL and CM_MOUSEWHEEL messages, but it doesn't seem to work. However I've managed to trap the CM_MOUSEENTER message. I don't understand why i can trap one type of message, but not the other. NGLN Due

Styling only one VCL component in Delphi

↘锁芯ラ 提交于 2019-11-26 21:51:56
问题 I know, that it's possible to disable custom styling for components, but how can I enable styles for only one component class? For example leave the whole form and all components on it unskinned, and skin only TButton. Like on this image. 回答1: Most of the VCL controls internally uses the StyleServices global function to get the methods to draw the control. So if you are not using the Vcl Styles, the StyleServices return an instance to the windows API functions to draw themed controls (UxTheme

DecimalSeparator in SysUtils and System.SysUtils

家住魔仙堡 提交于 2019-11-26 21:47:51
问题 I need to find DecimalSeparator var SysUtils Delphi 7, in Delphi XE6 i tried to find in System.SysUtils, but without success. Someone can tell me where to find her in Delphi XE6? In Delphi 7 it is located in SysUtils.pas unit, in line 618: var CurrencyString: string; CurrencyFormat: Byte; NegCurrFormat: Byte; ThousandSeparator: Char; DecimalSeparator: Char; I need this variable to convert a component of Delphi 7 to XE6 回答1: My bad, first I needed to call FormatSettings , and then I can use in

How to recompile a specific unit from the VCL?

不羁的心 提交于 2019-11-26 21:36:09
问题 I want to apply a fix from QC to a Delphi 2009 unit (DBClient as it happens). I know I need to copy the unit to another directory and make the change to the copy. How do I then get Delphi to compile that unit and use it in favour of the DCU that already exists? 回答1: If you don't want to modify the original .Pas file, I do this by copy the .Pas file into my application folder, then choose built project, it will create new dcu file in my application folder, which will be used instead of the

Delphi Change main form while application is running

旧城冷巷雨未停 提交于 2019-11-26 18:19:37
问题 I have this problem. When I hide my main form, then the taskbar icon of my application is also hidden. I saw a new question about this problem as well and the answers didn't really help. They suggested to minimize it, but I do not want to minimize the application. Is it possible to change the main form while the application is already running? for instance. I have two forms. when I want to hide the one form and show the other form, then the taskbar icon should stay at the taskbar and the main

Delphi XE2: Possible to instantiate a FireMonkey Form in VCL application?

戏子无情 提交于 2019-11-26 17:37:46
问题 Prior to Delphi XE2, we have VCL only to create GUI apps. Delphi XE2 states that: Caution: FireMonkey (FMX) and the Visual Component Library (VCL) are not compatible and cannot be used in the same project or application. That is, an application must be exclusively one or the other, either FireMonkey or VCL. The incompatibility is caused by framework differences between FireMonkey (FMX) and VCL. My application is a pure VCL application that is built with runtime packages. All VCL forms are

How to avoid issues when embedding a TForm in another TForm?

孤街醉人 提交于 2019-11-26 14:24:38
问题 I often embed a TForm descendant into another TForm descendant like this: var Form1: TForm1; Form2: TForm2; begin Form2.Parent := Form1; Form2.BorderStyle := bsNone; Form2.Align := alClient; Form2.Show; end; Usually this works just fine, but sometimes the controls in Form2 are not aligned properly. Is there a general workaround for this sort of problem? Does anybody know what is causing this "misalignment"? I know that I could use TFrame for this kind of job, but I have a lot of library code