Ich habe jetzt mal mein letztes Control so erstellt das es übersichtlicher und besser anzusprechen ist
was die Properties und bedienung angeht.
Vorher so!
Delphi-Quellcode:
ISkinDriveList =
interface
['
{6EB00DD0-CA49-4C92-A452-4D75FDAC2D91}']
function GetHandle: hWnd;
function GetDrawStyle: Integer;
procedure SetFont(nPointSize: Integer; FontName: WideString; FontStyle: TFontStyle;
AktForecolor: COLORREF; InAktForecolor: COLORREF; Shadow: Boolean;
SOffset: Integer; ShadowColor: COLORREF);
property Handle: hWnd
read GetHandle;
property DrawStyle: Integer
read GetDrawStyle;
end;
constructor TSkinDriveList.Create(hOwner: HWND; SelectedImg: WideString; ListButton: WideString;
x, y, xW, yH, DriveListID: integer; Visible: Boolean; ItemHeight: Integer; BackColor: COLORREF);
Nun so!
Delphi-Quellcode:
ISkinDriveList =
interface
['
{6EB00DD0-CA49-4C92-A452-4D75FDAC2D91}']
function GetHandle: hWnd;
function GetDrawStyle: Integer;
function GetSelectedImg: WideString;
procedure SetSelectedImg(
const SelectedImg: WideString);
function GetListButton: WideString;
procedure SetListButton(
const ListButton: WideString);
function GetHeight: Integer;
procedure SetHeight(
const Height: Integer);
function GetLeft: Integer;
procedure SetLeft(
const Left: Integer);
function GetTop: Integer;
procedure SetTop(
const Top: Integer);
function GetWidth: Integer;
procedure SetWidth(
const Width: Integer);
function GetDlgItemID: integer;
procedure SetDlgItemID(
const DlgItemID: integer);
function GetVisible: Boolean;
procedure SetVisible(
const Visible: Boolean);
function GetListItemHeight: Integer;
procedure SetListItemHeight(
const ListItemHeight: Integer);
function GetBackcolor: COLORREF;
procedure SetBackcolor(
const Backcolor: COLORREF);
function CreateWindow(ParentHandle: HWND): HWND;
procedure SetFont(nPointSize: Integer; FontName: WideString; FontStyle: TFontStyle;
AktForecolor: COLORREF; InAktForecolor: COLORREF; Shadow: Boolean;
SOffset: Integer; ShadowColor: COLORREF);
property Handle: hWnd
read GetHandle;
property DrawStyle: Integer
read GetDrawStyle;
property SelectedImg: WideString
read GetSelectedImg
write SetSelectedImg;
property ListButton: WideString
read GetListButton
write SetListButton;
property Left: Integer
read GetLeft
write SetLeft;
property Top: Integer
read GetTop
write SetTop;
property Width: Integer
read GetWidth
write SetWidth;
property Height: Integer
read GetHeight
write SetHeight;
property DlgItemID: integer
read GetDlgItemID
write SetDlgItemID;
property Visible: Boolean
read GetVisible
write SetVisible;
property ListItemHeight: Integer
read GetListItemHeight
write SetListItemHeight;
property BackColor: COLORREF
read GetBackColor
write SetBackColor;
end;
constructor TSkinDriveList.Create();
begin
inherited Create;
end;
Der sinn dabei ist das ich vorher alle propertys zuweisen kann bevor ich das Window erstelle.
So wie es normalerweise auch in der Designer umgebung mit PropertyEditor ist.
Delphi-Quellcode:
lbDriveList := CTRL_DriveListCreate();
lbDriveList.SelectedImg := (SKAERO_FOLDER + 'Search\ListSelect.png');
lbDriveList.ListButton := (SKAERO_FOLDER + 'Search\combo.png');
lbDriveList.Left := 18;
lbDriveList.Top := 209;
lbDriveList.Width := 105;
lbDriveList.Height := 21;
lbDriveList.DlgItemID := ID_DRIVELIST;
lbDriveList.Visible := True;
lbDriveList.ListItemHeight := 21;
lbDriveList.BackColor := SKAERO_BTNTEXTCOLOR;
DriveListHandle := lbDriveList.CreateWindow(SearchHandle);
if DriveListHandle <> 0 then
begin
lbDriveList.SetFont(SKAERO_PUSHBUTFONTSIZE, PWideChar(SKAERO_TEXTFONT), FontStyleBoldItalic,
SKAERO_ACTIVECAPTION, SKAERO_INACTIVECAPTION, TRUE, 2, 0);
SKAERO_SetAnchorMode(DriveListHandle, ANCHOR_HEIGHT_WIDTH);
SKAERO_SetZorder(DriveListHandle, HWND_TOP);
end;
Die frage ist nun bei create
lbDriveList := CTRL_DriveListCreate();
Da exisitert ja ausgenommen von inherited Create;
kein weiterer Eintrag.
Constructor entfernen oder so lassen wie es ist.
Hab da noch ein verständis problem .. sorry
oops..
Denke die frage hat sich erübrigt.
gruss