![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
Решение проблемы мигания TGroupBoxes и TLabels в DelphiDelphi , Компоненты и Классы , TGroupBoxTLabel and TGroupBox Captions Flicker on Resize in Delphi Problem Description: When resizing a form that loads different plugins, each with its own TForm associated, the TLabels inside TGroupBoxes flicker. The TLabels outside TGroupBoxes and the TGroupBoxes themselves do not flicker. Several attempts to resolve this issue, such as using WM_SETREDRAW, setting ParentBackground to False, enabling DoubleBuffer, using LockWindowUpdate, and setting Transparent to False, have not been successful. Solution:
The most effective solution is to use the ```pascal procedure EnableComposited(WinControl: TWinControl); var i: Integer; NewExStyle: DWORD; begin NewExStyle := GetWindowLong(WinControl.Handle, GWL_EXSTYLE) or WS_EX_COMPOSITED; SetWindowLong(WinControl.Handle, GWL_EXSTYLE, NewExStyle);
end; ``` Call this procedure in the
Another approach is to override the ```pascal type PWndProc = function(hWnd: HWND; Msg: UINT; wParam, lParam: Longint): Longint; stdcall; procedure SetNonFlickeringWndProc(control: TWinControl; var oldWndProc: TArray
end; procedure RestoreWndProc(var oldWndProc: TArray var
oldWndProc: TArray procedure NonFlickeringWndProc(hWnd: HWND; Msg: UINT; wParam, lParam: Longint): Longint; begin if Msg = WM_ERASEBKGND then Exit(1);
end; procedure TForm1.FormShow(Sender: TObject); begin SetNonFlickeringWndProc(Self, oldWndProc, @NonFlickeringWndProc); end; procedure TForm1.FormClose(Sender: TObject; Action: TCloseAction); begin RestoreWndProc(oldWndProc); end; ``` This solution uses a map to store the old window procedures and restores them when the form is closed. Alternative Solution: Another alternative is to use In conclusion, the best solution for preventing TLabel and TGroupBox captions from flickering on resize in Delphi is to use the В Delphi при перемещении окна, содержащего разные плагины с собственными TForm, наблюдается мерцание TLabels внутри TGroupBox, которое не удается устранить при помощи различных методов, таких как использование WM_SETREDRAW, DoubleBuffer, Комментарии и вопросыПолучайте свежие новости и обновления по Object Pascal, Delphi и Lazarus прямо в свой смартфон. Подпишитесь на наш Материалы статей собраны из открытых источников, владелец сайта не претендует на авторство. Там где авторство установить не удалось, материал подаётся без имени автора. В случае если Вы считаете, что Ваши права нарушены, пожалуйста, свяжитесь с владельцем сайта.
|
||||
©KANSoftWare (разработка программного обеспечения, создание программ, создание интерактивных сайтов), 2007 |