请问在 DELPHY 里面有没有 下拉控件可直接连数据库的。
解决方案 »
- 关于chart自动更新的问题
- TMediaPlayer不能播放的问题?
- 下面用DELPHI写的DLL,在C中不会调用。请帮忙解决一下,谢谢!
- ado连接字中“Persist Security Info=true”是什么意思?
- 在线等待,语法问题:SQL语句中单引号的用法?
- 今天下载了一个控件,里面只有dpk和pas文件,怎样装啊?请会的同志讲详细点。还有一些只有dcu和pas的,又怎样装啊?
- 紧急求助:请问有什么办法能使得ADOTable取出的记录以每次显示10条的形式分页显示~~~!
- 关于MDIchild窗体关闭出错的问题
- 紧急求援:需要Fastreport 2.45的fr_class.pas文件,谁有?
- 大家来看看这个软件的图标拖动功能怎么实现的?
- 怎么解决delphi与网上数据库连接慢的问题
- cxGrid里的CardView能不能一次只显示一条记录?
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
DBCtrls;type
TRDBLookupComboBox = class(TDBLookupComboBox)
private
{ Private declarations }
HiBkColorSaved:boolean;
HiBkColor:TColor;
MouseEntered: Boolean;
procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
procedure DrawFocused;
procedure DrawUnfocus; procedure OnPaint(var Message: TWMPaint); message WM_PAINT ;
procedure OnCreate(var Message: TWMCreate); message WM_CREATE; protected
{ Protected declarations }
procedure DoEnter;override;
procedure DoExit;override;
end;procedure Register;implementation
//const
// ParentBkColor = $00F6FEFF;procedure Register;
begin
RegisterComponents('Ross', [TRDBLookupComboBox]);
end;procedure TRDBLookupComboBox.OnCreate(var Message: TWMCreate);
begin
inherited;
tag :=1;
end;
procedure TRDBLookupComboBox.DoEnter;
begin
inherited;
DrawFocused;
end;procedure TRDBLookupComboBox.DoExit;
begin
inherited;
DrawUnfocus;
end;procedure TRDBLookupComboBox.CMMouseEnter(var Message: TMessage);
begin
inherited;
if not MouseEntered and Enabled then begin
MouseEntered := True;
DrawFocused;
end;
end;procedure TRDBLookupComboBox.CMMouseLeave(var Message: TMessage);
begin
inherited;
if MouseEntered and Enabled then begin
MouseEntered := False;
DrawUnfocus;
end;
end;procedure TRDBLookupComboBox.DrawFocused;
var
DC: HDC;
R: TRect;
WindowBrush,b: HBRUSH;
begin
// if not(focused or mouseEntered) then exit;
if not HiBkColorSaved then
begin
HiBkColor := color;
HiBkColorSaved := true;
end;
color := ColorToRGB(HiBkColor); DC := GetWindowDC(Handle);
GetWindowRect(Handle, R);
OffsetRect(R, -R.Left, -R.Top);
try
// WindowBrush := CreateSolidBrush(getParentForm(self).color );
WindowBrush := CreateSolidBrush( ColorToRGB(Parent.Brush.Color) );
FrameRect(DC, R, WindowBrush); b := CreateSolidBrush(clOlive );
InflateRect(R, -1, -1);
FrameRect(DC, R, b); finally
ReleaseDC(Handle, DC);
end; DeleteObject(WindowBrush);
DeleteObject(b);
end;
procedure TRDBLookupComboBox.DrawUnfocus;
var
DC: HDC;
R: TRect;
WindowBrush,b: HBRUSH;
//tc:TCustomForm;
begin
if focused or mouseEntered then exit; if not HiBkColorSaved then
begin
HiBkColor := color;
HiBkColorSaved := true;
end;// tc := getParentForm(self);
if [csDesigning] <> ComponentState then
color := ColorToRGB(parent.brush.color);
DC := GetWindowDC(Handle); GetWindowRect(Handle, R);
OffsetRect(R, -R.Left, -R.Top);
// Dec(R.Right, 1);
try WindowBrush := CreateSolidBrush(ColorToRGB(parent.Brush.Color ));
FrameRect(DC, R, WindowBrush); InflateRect(R, -1, -1);
FrameRect(DC, R, WindowBrush); R.Top := r.Bottom -1; b := CreateSolidBrush(clOlive );
FrameRect(DC, R, b); finally
ReleaseDC(Handle, DC);
end;
DeleteObject(WindowBrush);
DeleteObject(b);// color := getparentform(self).Color;
end;procedure TRDBLookupComboBox.OnPaint(var Message: TWMPaint);
begin
inherited;
if MouseEntered or Focused then
DrawFocused
else
DrawUnfocus;
end;end.