nglthach
Members-
Content Count
11 -
Joined
-
Last visited
-
Days Won
1
nglthach last won the day on June 4 2022
nglthach had the most liked content!
Community Reputation
23 ExcellentRecent Profile Visitors
5990 profile views
-
The problem is VCL TCustomForm.WndProc call SaveDC before the owner drawing method, then restore the drawing context by calling RestoreDC Solving the problem by overriding WndProc as: interface TForm12 = class(TForm) public procedure WndProc(var Message: TMessage); override; end; implementation procedure TForm12.WndProc(var Message: TMessage); var MenuItem: TMenuItem; Canvas: TCanvas; SaveIndex: Integer; begin if Message.Msg = WM_DRAWITEM then begin with PDrawItemStruct(Message.LParam)^ do if (CtlType = ODT_MENU) and Assigned(Menu) and not IsVclControl(HWndItem) then begin MenuItem := Menu.FindItem(itemID, fkCommand); if (MenuItem <> nil) and not (MenuItem.GetParentComponent is TMainMenu) then begin Canvas := TControlCanvas.Create; with Canvas do try //SaveIndex := SaveDC(hDC); <==== here is the problem try Handle := hDC; Font := Screen.MenuFont; Vcl.Menus.DrawMenuItem(MenuItem, Canvas, rcItem, TOwnerDrawState(LoWord(itemState))); finally Handle := 0; //RestoreDC(hDC, SaveIndex) <==== here is the problem end; finally Free; end; Exit; end; end; end; inherited WndProc(Message); end;
-
Thanks! It solved my problem!
-
Hi folks, I am trying to skin menu item. I have successfully customize the menu item appearance. But if the menu has sub menu, I could not owner drawing the arrow. Here is my code: procedure TForm12.cmniOpenRecentAdvancedDrawItem(Sender: TObject; ACanvas: TCanvas; ARect: TRect; State: TOwnerDrawState); begin // Prevent the OS drawing the arrow ExcludeClipRect(ACanvas.Handle, ARect.Left, ARect.Top, ARect.Right, ARect.Bottom); end; procedure TForm12.cmniOpenRecentDrawItem(Sender: TObject; ACanvas: TCanvas; ARect: TRect; Selected: Boolean); begin ACanvas.Brush.Style := bsSolid; ACanvas.Brush.Color := clRed; ACanvas.Rectangle(ARect); // Prevent the OS drawing the arrow ExcludeClipRect(ACanvas.Handle, ARect.Left, ARect.Top, ARect.Right, ARect.Bottom); end; Here is the result: As you see, the arrow still there although I already draw a rectangle to the whole menu item's rect. Do you know how to prevent the OS drawing the arrow? Thanks!
-
How to display one of several web pages at one URL
nglthach replied to David Schwartz's topic in Network, Cloud and Web
Hi @David Schwartz I don't use WordPress, if you are willing to use Drupal 7 (not the latest one, I haven't worked on Drupal in a long time), here is the solution: - Create pages for Monday, Wednesday, ... - In settings.php, change $conf['site_frontpage'] to corresponding page for each day I could install this on your host (for free)! Please let me know if you would like! -
How to display one of several web pages at one URL
nglthach replied to David Schwartz's topic in Network, Cloud and Web
Hi @David Schwartz You would like to do this on client site (at the browser) or server side? Both are easy to implement (not TMS WebCore). If you would like to see a working demo, like my comment and back in tomorrow, I will show you š -
Hiring-related question: Delphi + javascript ?
nglthach replied to David Schwartz's topic in Cross-platform
Hi @David Schwartz As a web developer in 12 years, Iām sure no Javascript developer willing to learn Delphi. From their point of view, Delphi is dying programming language and the concept of two languages are different. Js eco (include NodeJs) has a lot of framework for both back-end and front-end, there is no reason for a Js dev using Delphi for the back-end! You could take a look at AdonisJs for an example! And the Delphi dev also dont want to learn Js, it is a dynamic language and annoyed when using (it is why TypeScript was born). If you would like to hire a Delphi dev who experienced with Js, please contact me! Iām willing to work š -
[Source code] ACL - Visual component set which used in famous music player AIMP is now open source
nglthach posted a topic in VCL
Artem's Classes/Components/Controls library (ACL) Library contains number of classes, components and visual controls for Delphi that used in AIMP. I have published the library because it was used in plugins that no longer supported by me. If anyone will be interested the library I will add more details and create index of all features and abilities of the library. My working Delphi is 11.0 Alexandria. The library may work on earlier versions of Delphi, but I haven't tested it. Link: https://github.com/ArtemIzmaylov/ACL -
Hi, I have released source code of a small game. You could see the demo here: https://youtu.be/KVNRi83yYQA Some screenshots: Github repository: https://github.com/nglthach/Swim Best!!
-
Hi, I have ported SpkToolbar from Lazarus to Delphi. Here is the screenshot: You could download here: https://github.com/nglthach/SpkToolbar4Delphi OT: I'm looking for a remote Delphi developer position, if you would like to hire me, please contact via PM! Thanks!
-
@chkaufmann Something like this?
-
You should take a look on AddExitProc: http://docwiki.embarcadero.com/Libraries/Sydney/en/System.SysUtils.AddExitProc procedure DoOnExit; var s: string; begin s := ''; // Set a breakpoint here end; begin AddExitProc(DoOnExit); // Put this line before Application.Run Application.Initialize; Application.DefaultFont.Assign(Screen.MenuFont); Application.MainFormOnTaskbar := True; Application.CreateForm(TMainForm, MainForm); Application.Run; end;