procedure TAdvEdit.WMPaint(
var Msg: TWMPaint);
var
DC: HDC;
Fnt: HFont;
point : tpoint ;
begin
inherited;
if FExtButton.FshowButton
then
begin
if (
not Assigned(FCanvas))
then
begin
FCanvas := TControlCanvas.Create;
FCanvas.Control := Self;
end;
DC:=GetDC(
Handle);
FCanvas.Handle :=
DC;
Fnt:=FExtButton.FbtnFont.Handle;
SelectObject(
DC,Fnt);
// SetBkMode(DC,TRANSPARENT);
SetBkMode(
DC, OPAQUE);
CreateSolidBrush(FExtButton.FbtnColor );
SetBkColor(
DC, FExtButton.FbtnColor );
FExtButton.BtnRect:=ClientRect;
FExtButton.BtnRect.Left:=FExtButton.BtnRect.Right-FExtButton.fButtonWidth;
if FExtButton.fPressed
and FExtButton.fInButton
then
begin
DrawFrameControl(
DC,FExtButton.BtnRect,DFC_BUTTON,DFCS_BUTTONPUSH+
DFCS_PUSHED);
end
else
begin
DrawFrameControl(
DC,FExtButton.BtnRect,DFC_BUTTON,DFCS_BUTTONPUSH);
end;
if (Assigned(FExtButton.Fglyph)
and (FExtButton.FGlyphindex
in [0..
FExtButton.FGlyph.Count-1]))
then
begin
SetBkMode(
DC,TRANSPARENT);
point.X := ((FExtButton.fButtonWidth-FExtButton.
FGlyph.width)
div 2)+1;
point.Y := (FExtButton.BtnRect.Bottom -FExtButton.BtnRect.Top-FExtButton.
FGlyph.height)
div 2;
FExtButton.FGlyph.Draw(Fcanvas,FExtButton.BtnRect.Left+point.X ,FExtButton.
BtnRect.Top +point.y,FExtButton.FGlyphIndex);
end
else
begin
DrawText(
DC,PChar(FExtButton.fBtnCaption),Length(FExtButton.fBtnCaption),
FExtButton.BtnRect,DT_CENTER
or DT_SINGLELINE
or DT_VCENTER);
end;
FCanvas.Handle := 0;
// DeleteObject(Fnt);
// ReleaseDC(Handle,DC);
end;
end;