vcl

How can I create alpha blended icon/cursor (indirect) from the TBitmap instance of 32 bpp w/o making an temporary DIB section?

别等时光非礼了梦想. 提交于 2019-12-03 15:23:44
According to MS KB entry , there is a quirk in CreateIconIndirect which recognizes HBITMAP s been created with BITMAPV5HEADER passed to CreateDIBSection (and BGRA channel layout). However, TBitmap instances with (PixelFormat = pf32bit) and (AlphaFormat = afDefined) (behaving as alpha blended for the other purposes) when referred by its Handle s are not being recognized as valid alpha blended bitmaps for creation of icons or cursors. Currently, I have to create a full copy of TBitmap using described API calls ( see ) to make CreateIconIndirect accept a bitmap handle as alpha blended. How do I

Form.Release + NIL

£可爱£侵袭症+ 提交于 2019-12-03 12:16:32
问题 if Form.Release is called after using the form, it will free all related memory but not set the form variable to nil. if not assigned (Form1) then begin Application.CreateForm(Tform1, Form1); try // Do something finally Form1.Release end; end; To be able to call the same code again, Form1 would have to be set to nil at some point. From the description of Release I cannot do Form1 := nil; right after Release, because the Release procedure will return directly after being called and before the

TControlState.csDesignerHide vs. TControlStyle.csNoDesignVisible

牧云@^-^@ 提交于 2019-12-03 11:29:57
The VCL seems to offer two mechanisms for hiding controls from form designers : TControlState.csDesignerHide and TControlStyle.csNoDesignVisible . What's the difference between them as far as the IDE is concerned? Which should you use when? Summary Use TControlState.csDesignerHide to prevent the control from drawing. Use TControlStyle.csNoDesignVisible to mimic runtime behaviour of the Visible property. Elaboration Nice question! There simply must be a difference between them, so I did a little investigation. Searching for usage in the Controls unit, we find that: TControlState.csDesignerHide

Simplifying VCL thread wrapper code

隐身守侯 提交于 2019-12-03 09:45:09
I am using thread wrapper which checks if function which updates VCL (which also has some arguments) was called from main thread or not and then executes in within the context of Main thread always. It works but I want to make it simpler. The problem is that I have to repeat this code in every function which needs VCL synchronization which is prone to errors. Is there a way to make this wrapper simpler and more re-useable? Note that this particular wrapper only uses one parameter but there can be any number of parameters which are copied to TLocalArgs and passed on. Current code: boost::scoped

Delphi - Using the TApplicationEvents OnShortCut event to detect Alt+C key presses

混江龙づ霸主 提交于 2019-12-03 08:14:27
I am using TApplicationEvents OnShortCut event to get application keyboard short cuts in a Delphi program. Using the following code: procedure TForm1.ApplicationEvents1ShortCut(var Msg: TWMKey; var Handled: Boolean) ; begin if (Msg.CharCode = VK_F9) then begin ShowMessage('F9 pressed!') ; Handled := True; end; end; Question: How do I detect when 'ALT C' has been pressed ? Like so: procedure TForm1.ApplicationEvents1ShortCut(var Msg: TWMKey; var Handled: Boolean); begin if (Msg.CharCode = Ord('C')) and (HiWord(Msg.KeyData) and KF_ALTDOWN <> 0) then begin ShowMessage('Alt+C pressed!') ; Handled

wsMaximized forms do not appear maximized

自古美人都是妖i 提交于 2019-12-03 08:09:13
问题 Setting a form to WindowState = wsMaximized will sometimes cause the form to be maximized but not: Long-time bug: this is a question I first asked in the Borland newsgroups in 2003: Accepted fix for WindowState = wsMaximized? and then again in 2006: wsMaximized breaks it, NOT caused by Position=poScreenCenter, reproducible dfm and then again in 2008: Forms not starting maximized Someone asked it on the Embarcadero forums in 2012: Thread: Application not starting with maximized window Now it's

How do you line up a TPopupMenu so that it accurately positions itself above a button?

纵饮孤独 提交于 2019-12-03 07:33:36
I want a popup menu above a button: Delphi wraps the Win32 menu system in a way that seems to preclude every mode or flag that the underlying Win32 API provides that was not in the VCL author's brain on that day. One such example appears to be the TPM_BOTTOMALIGN which can be passed into TrackPopupMenu but, the Delphi wrapper appears to render this not only impossible in the stock VCL, but by injudicious use of private and protected methods, is impossible (at least seems to me to be impossible) to do either accurately at runtime, or by overrides. The VCL component TPopupMenu is not very well

Form.Release + NIL

瘦欲@ 提交于 2019-12-03 02:39:27
if Form.Release is called after using the form, it will free all related memory but not set the form variable to nil. if not assigned (Form1) then begin Application.CreateForm(Tform1, Form1); try // Do something finally Form1.Release end; end; To be able to call the same code again, Form1 would have to be set to nil at some point. From the description of Release I cannot do Form1 := nil; right after Release, because the Release procedure will return directly after being called and before the form is actually freed. I cannot detect when Form.Release is finished to set the form var to nil. What

Is there any Delphi XE2 styles gallery?

依然范特西╮ 提交于 2019-12-02 21:58:12
In XE2 there is a new function : 'styles', for VCL( .vsf) and Firemonkey ( .styles), and some are provided in C:\Program Files\Embarcadero\RAD Studio\9.0\Redist\styles directory. As it seems to be easy to create a new style, is there any 'styles Gallery' Web site or blog somewhere ? RRUZ No, for the moment there is no such thing like a gallery of styles for FireMonkey or VCL styles. But if you want to create you own try these entries in my blog which show an easy way to create/modify new VCL styles and FireMoney styles in few clicks. Both articles include additional styles to download.

Tag editor component for Delphi/C++Builder

这一生的挚爱 提交于 2019-12-02 16:51:05
I need a VCL tag editor component for Delphi or C++Builder, similar to what's available for JavaScript: e.g. this one , or this one or StackOverflow's own tags editor. Is there something like this available or do I need to make it from scratch? Some specific things that I need are: Editor should allow either scrolling or become multi-line if more tags are present than the editor's width allows. If multi-line, there should be an option to define some maximum height however, preventing it from becoming too tall Option to select whether tags are created when pressing space or comma key Prompt