Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2005.10.23;
Скачать: CL | DM;

Вниз

Прозрачность в TglListBox (class(TCustomListBox))   Найти похожие ветки 

 
Kripton   (2005-08-19 05:57) [0]

Извините, это опять я.
Сначала приведу код. Ненужное удалено.

unit Unit1;

interface

uses

const
 cUseAlpha: array [Boolean] of Integer = (0, LWA_ALPHA);
 cUseColorKey: array [Boolean] of Integer = (0, LWA_COLORKEY);
 sUser32 = "User32.dll";

private
   SetLayeredWindowAttributes: TSetLayeredWindowAttributes;
   ModH : HMODULE;
   Style: integer;
   название процедуры;

type
 TSetLayeredWindowAttributes = function (Hwnd: THandle; crKey: COLORREF; bAlpha: Byte; dwFlags: DWORD): Boolean; stdcall;

procedure TForm1.SetTransparentWindow(WND: HWND; AlphaBlend,
 TransparentColor: boolean; AlphaBlendValue: byte;
 TransparentColorValue: integer);
begin
ModH := GetModuleHandle(sUser32);
if ModH <> 0 then
 begin
 @SetLayeredWindowAttributes := GetProcAddress(ModH, "SetLayeredWindowAttributes");
 Style := GetWindowLong(WND, GWL_EXSTYLE);
 if AlphaBlend or TransparentColor then
   begin
   if (Style and WS_EX_LAYERED) = 0 then
     begin
      SetWindowLong(WND, GWL_EXSTYLE, Style or WS_EX_LAYERED);
      SetLayeredWindowAttributes(WND, TransparentColorValue, AlphaBlendValue,
      cUseAlpha[AlphaBlend] or cUseColorKey[TransparentColor]);
     end;
   end
 else
   begin
   SetWindowLong(WND, GWL_EXSTYLE, Style and not WS_EX_LAYERED);
    RedrawWindow(WND, nil, 0, RDW_ERASE or RDW_INVALIDATE or RDW_FRAME or RDW_ALLCHILDREN);
   end;
 end;
end;

Если кто-нибудь работал с этим, то очень прошу помочь. Когда я применяю данную процедуру, то пишу в FormShow
SetTransparentWindow(Listbox1.Handle,True,False,170,0);
Если оставить только Handle, то всё работает для всей формы со всем, что на ней находится. Объясните, пожалуйста, почему так нельзя сделать для только одного ListBox"а(TglListBox)? А как можно и можно ли?


 
alpet ©   (2005-08-19 07:10) [1]

See MSDN Layered Windows, UpdateLayeredWindow function.

"Note that WS_EX_LAYERED cannot be used for child windows"



Страницы: 1 вся ветка

Текущий архив: 2005.10.23;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.042 c
14-1128271384
Piter
2005-10-02 20:43
2005.10.23
Прикольно блин :)


3-1126758023
Barmaglot
2005-09-15 08:20
2005.10.23
Склейка полей и отображение их в combobox


14-1128177952
ArtemESC
2005-10-01 18:45
2005.10.23
Отключиться от ИНЕТА


14-1127801118
boriskb
2005-09-27 10:05
2005.10.23
Вы согласны?


3-1126087199
dolmat
2005-09-07 13:59
2005.10.23
Поле типа Memo