TComboBox=class(StdCtrls.TComboBox)
protected
procedure WMPaint(var Message: TWMPaint); message WM_PAINT;
end;
procedure TComboBox.WMPaint(var Message: TWMPaint);
var
EC:TControlCanvas;
begin
inherited;
if Self.Enabled = False then
begin
EC:= TControlCanvas.Create;
EC.Handle:= GetDC(Self.Handle);
EC.Font:= Self.Font;
EC.Brush:= Self.Brush;
Ec.TextOut(3,3,Self.Text);
ReleaseDC(Self.Handle,EC.Handle);
EC.Free;
end;
end;我断点跟踪能运行到指定的代码。但是效果没有出来!大虾帮帮忙!
protected
procedure WMPaint(var Message: TWMPaint); message WM_PAINT;
end;
procedure TComboBox.WMPaint(var Message: TWMPaint);
var
EC:TControlCanvas;
begin
inherited;
if Self.Enabled = False then
begin
EC:= TControlCanvas.Create;
EC.Handle:= GetDC(Self.Handle);
EC.Font:= Self.Font;
EC.Brush:= Self.Brush;
Ec.TextOut(3,3,Self.Text);
ReleaseDC(Self.Handle,EC.Handle);
EC.Free;
end;
end;我断点跟踪能运行到指定的代码。但是效果没有出来!大虾帮帮忙!
你说的方法我没有用过。能不能给点语句。谢谢了
protected
procedure CreateWnd; override;
procedure CMEnabledChanged(var Message: TMessage); message CM_ENABLEDCHANGED;
end;procedure TComboBoxEx.CreateWnd;
begin
inherited;
if FEditHandle <> 0 then EnableWindow(FEditHandle, True);
end;procedure TComboBoxEx.CMEnabledChanged(var Message: TMessage);
begin
inherited;
if FEditHandle <> 0 then EnableWindow(FEditHandle, True);
end;
不过还有个问题,当TCOMBOBOX的STYLE设置为csDropDownList的时候!没有效果,是不是当csDropDownList模式的时候没有输入焦点的原因!