阿
阿张
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TepCustomComboBox.CNDrawItem(var Message: TWMDrawItem);
var
State: TOwnerDrawState;
begin
with Message.DrawItemStruct^ do
begin
//下面一行报错:invalid typecast,该怎么处理好呢?
State := TOwnerDrawState(WordRec(LongRec(itemState).Lo).Lo);
Canvas.Handle := hDC;
Canvas.Font := Font;
Canvas.Brush := Brush;
if (Integer(itemID) >= 0) and (odSelected in State) then
begin
Canvas.Brush.Color := FSelectColor;
Canvas.Font.Color := FSelectTextColor;
end;
if Integer(itemID) >= 0 then
DrawItem(itemID, rcItem, State);
if odFocused in State
then
if FUseFocusFrame
then
Frm3D(Canvas,rcItem, FInnerFocusColor, FOuterFocusColor,1)
else
begin
Canvas.Brush.Style := bsSolid;
Canvas.DrawFocusRect(rcItem);
end;
Canvas.Handle := 0;
end;
end;
var
State: TOwnerDrawState;
begin
with Message.DrawItemStruct^ do
begin
//下面一行报错:invalid typecast,该怎么处理好呢?
State := TOwnerDrawState(WordRec(LongRec(itemState).Lo).Lo);
Canvas.Handle := hDC;
Canvas.Font := Font;
Canvas.Brush := Brush;
if (Integer(itemID) >= 0) and (odSelected in State) then
begin
Canvas.Brush.Color := FSelectColor;
Canvas.Font.Color := FSelectTextColor;
end;
if Integer(itemID) >= 0 then
DrawItem(itemID, rcItem, State);
if odFocused in State
then
if FUseFocusFrame
then
Frm3D(Canvas,rcItem, FInnerFocusColor, FOuterFocusColor,1)
else
begin
Canvas.Brush.Style := bsSolid;
Canvas.DrawFocusRect(rcItem);
end;
Canvas.Handle := 0;
end;
end;