⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jvqexextctrls.pas

📁 East make Tray Icon in delphi
💻 PAS
📖 第 1 页 / 共 5 页
字号:
  begin
    if csDesigning in ComponentState then
      Result := Perform(CM_DESIGNHITTEST, XPos, YPos)
    else
    begin
      Handled := (XPos >= 0) and (YPos >= 0) and (XPos < Width) and (YPos < Height);
      if Handled then
        Result := HTCLIENT;
    end;
  end;
end;

function TJvExCustomControlBar.DoPaintBackground(Canvas: TCanvas; Param: Integer): Boolean;
begin
  Result := false;
end;

procedure TJvExCustomControlBar.ShowingChanged;
begin
  Perform(CM_SHOWINGCHANGED, 0 ,0);
  inherited;
end;

procedure TJvExCustomControlBar.ColorChanged;
begin
  Perform(CM_COLORCHANGED, 0, 0);
  inherited;
end;

procedure TJvExCustomControlBar.CursorChanged;
begin
  Perform(CM_CURSORCHANGED, 0, 0);
  inherited;
end;

procedure TJvExCustomControlBar.DoSetFocus(PreviousWnd: QWidgetH);
begin
  { notification }
end;

procedure TJvExCustomControlBar.DoKillFocus(NextWnd: QWidgetH);
begin
  { notification }
end;

procedure TJvExCustomControlBar.DoEnter;
begin
  Perform(CM_ENTER, 0 ,0);
  inherited DoEnter;
end;

procedure TJvExCustomControlBar.DoExit;
begin
  Perform(CM_EXIT, 0 ,0);
  inherited DoExit;
end;

function TJvExCustomControlBar.EventFilter(Sender: QObjectH; Event: QEventH): Boolean;
begin
  Result := False;
  if Assigned(FOnEvent) then
    FOnEvent(Sender, Event, Result);
  if not Result then
    Result := inherited EventFilter(Sender, Event); 
end;

procedure TJvExCustomControlBar.FocusChanged;
begin
  NotifyControls(CM_FOCUSCHANGED);
end;

procedure TJvExCustomControlBar.DoOnFontChanged(Sender: TObject);
begin
  ParentFont := False;
  PostMessage(Self, CM_FONTCHANGED, 0, 0);
end;

procedure TJvExCustomControlBar.CreateWidget;
begin
  CreateWnd;
end;

procedure TJvExCustomControlBar.CreateWnd;
begin
  inherited CreateWidget;
end;

procedure TJvExCustomControlBar.RecreateWnd;
begin
  if not (csRecreating in ControlState) then
    RecreateWidget;
end;

procedure TJvExCustomControlBar.PaintTo(PaintDevice: QPaintDeviceH; X, Y: Integer);
begin
  WidgetControl_PaintTo(self, PaintDevice, X, Y);
end;

procedure TJvExCustomControlBar.PaintWindow(PaintDevice: QPaintDeviceH);
begin
  PaintTo(PaintDevice, 0, 0);
end;

function TJvExCustomControlBar.WidgetFlags: Integer;
begin
  Result := inherited WidgetFlags or
    Integer(WidgetFlags_WRepaintNoErase) or
    Integer(WidgetFlags_WMouseNoMask);
end;

function TJvExCustomControlBar.ColorToRGB(Value: TColor): TColor;
begin
  Result := QWindows.ColorToRGB(Value, self);
end;
  
{ QControl Common}

function TJvExCustomControlBar.HitTest(X, Y: integer): Boolean;
begin
   Result := Perform(CM_HITTEST, 0, 0) <> HTNOWHERE;
end;

procedure TJvExCustomControlBar.CMHintShow(var Mesg: TJvMessage);
begin
  with Mesg do
  begin
    Handled := inherited HintShow(HintInfo^);
  end;
end;

procedure TJvExCustomControlBar.CMSysFontChanged(var Mesg: TMessage);
begin
  if FDesktopFont then
  begin
    Font.Assign(Application.Font);
    FDesktopFont := True;
  end;
end;

procedure TJvExCustomControlBar.EnabledChanged;
begin
  Perform(CM_ENABLEDCHANGED, 0, 0);
  inherited EnabledChanged;
end;

procedure TJvExCustomControlBar.TextChanged;
begin
  Perform(CM_TEXTCHANGED, 0, 0);
  inherited TextChanged;
end;

procedure TJvExCustomControlBar.VisibleChanged;
begin
  Perform(CM_VISIBLECHANGED, 0, 0);
  inherited VisibleChanged;
end;

function TJvExCustomControlBar.HintShow(var HintInfo : THintInfo): Boolean;
begin
  Result := Perform(CM_HINTSHOW, 0, Integer(@HintInfo)) <> 0;
end;

procedure TJvExCustomControlBar.MouseEnter(AControl: TControl);
begin
  Perform(CM_MOUSEENTER, 0, 0);
  inherited MouseEnter(AControl);
end;

procedure TJvExCustomControlBar.MouseLeave(AControl: TControl);
begin
  Perform(CM_MOUSELEAVE, 0, 0);
  inherited MouseLeave(AControl);
end;

procedure TJvExCustomControlBar.ParentColorChanged;
begin
  inherited ParentColorChanged;
  if Assigned(FOnParentColorChanged) then
    FOnParentColorChanged(Self);
end;

procedure TJvExCustomControlBar.SetDesktopFont(Value: Boolean);
begin
  if FDesktopFont <> Value then
  begin
    FDesktopFont := Value;
    Perform(CM_SYSFONTCHANGED, 0, 0);
  end;
end;

procedure TJvExCustomControlBar.Dispatch(var Mesg);
begin
  if Assigned(FWindowProc) then
    FWindowProc(TMessage(Mesg))
  else
    inherited Dispatch(Mesg);
end;

function TJvExCustomControlBar.Perform(Msg: Cardinal; WParam, LParam: Longint): Longint;
var
  Mesg: TMessage;
begin
  Mesg.Msg := Msg;
  Mesg.WParam := WParam;
  Mesg.LParam := LParam;
  Mesg.Result := 0;
  Dispatch(Mesg);
  Result := Mesg.Result;
end;

function TJvExCustomControlBar.IsRightToLeft: Boolean;
begin
  Result := False;
end;
  
 
{ QCustomControl Create }

constructor TJvExControlBar.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  FWindowProc := WndProc;
  FInternalFontChanged := Font.OnChange;
  Font.OnChange := DoOnFontChanged;
  FHintColor := clDefault;
  FDoubleBuffered := True;
  
end;

destructor TJvExControlBar.Destroy;
begin
  
  inherited Destroy;
end;
  
procedure TJvExControlBar.WndProc(var Mesg: TMessage);
begin
  //OutputDebugString(PAnsiChar(Format('WINCONTROL %s: %s Msg $%x',[Name, ClassName, Mesg.Msg])));
  with TJvMessage(Mesg) do
  begin
    case Msg of
      { WinControl Messages }
      WM_KILLFOCUS   : DoKillFocus(FocusedWnd);
      WM_SETFOCUS    : DoSetFocus(FocusedWnd);
      CM_FONTCHANGED : FInternalFontChanged(Font);
      CM_HINTSHOW    : HintInfo^.HintColor := GetHintcolor(Self);
      WM_GETDLGCODE:
      begin
        Result := InputKeysToDlgCodes(InputKeys);
        Exit;
      end;
      WM_ERASEBKGND:
      begin
        Canvas.Start;
        try
          Handled := DoPaintBackGround(Canvas, LParam);
        finally
          Canvas.Stop;
        end;
        Exit;
      end;
      { Control Messages }
      CM_FOCUSCHANGED: FocusChanged;
      CM_MOUSEENTER: FMouseOver := True;
      CM_MOUSELEAVE: FMouseOver := False;
    end;
  end;
  inherited Dispatch(Mesg);
end;
{ QWinControl Common }
procedure TJvExControlBar.CMDesignHitTest(var Mesg: TJvMessage);
begin
  with Mesg do
  begin
    Handled := (XPos >= 0) and (YPos >= 0) and (XPos < Width) and (YPos < Height);
    if Handled then
      Result := HTCLIENT;
  end;
end;

procedure TJvExControlBar.CMHitTest(var Mesg: TJvMessage);
begin
  with Mesg do
  begin
    if csDesigning in ComponentState then
      Result := Perform(CM_DESIGNHITTEST, XPos, YPos)
    else
    begin
      Handled := (XPos >= 0) and (YPos >= 0) and (XPos < Width) and (YPos < Height);
      if Handled then
        Result := HTCLIENT;
    end;
  end;
end;

function TJvExControlBar.DoPaintBackground(Canvas: TCanvas; Param: Integer): Boolean;
begin
  Result := false;
end;

procedure TJvExControlBar.ShowingChanged;
begin
  Perform(CM_SHOWINGCHANGED, 0 ,0);
  inherited;
end;

procedure TJvExControlBar.ColorChanged;
begin
  Perform(CM_COLORCHANGED, 0, 0);
  inherited;
end;

procedure TJvExControlBar.CursorChanged;
begin
  Perform(CM_CURSORCHANGED, 0, 0);
  inherited;
end;

procedure TJvExControlBar.DoSetFocus(PreviousWnd: QWidgetH);
begin
  { notification }
end;

procedure TJvExControlBar.DoKillFocus(NextWnd: QWidgetH);
begin
  { notification }
end;

procedure TJvExControlBar.DoEnter;
begin
  Perform(CM_ENTER, 0 ,0);
  inherited DoEnter;
end;

procedure TJvExControlBar.DoExit;
begin
  Perform(CM_EXIT, 0 ,0);
  inherited DoExit;
end;

function TJvExControlBar.EventFilter(Sender: QObjectH; Event: QEventH): Boolean;
begin
  Result := False;
  if Assigned(FOnEvent) then
    FOnEvent(Sender, Event, Result);
  if not Result then
    Result := inherited EventFilter(Sender, Event); 
end;

procedure TJvExControlBar.FocusChanged;
begin
  NotifyControls(CM_FOCUSCHANGED);
end;

procedure TJvExControlBar.DoOnFontChanged(Sender: TObject);
begin
  ParentFont := False;
  PostMessage(Self, CM_FONTCHANGED, 0, 0);
end;

procedure TJvExControlBar.CreateWidget;
begin
  CreateWnd;
end;

procedure TJvExControlBar.CreateWnd;
begin
  inherited CreateWidget;
end;

procedure TJvExControlBar.RecreateWnd;
begin
  if not (csRecreating in ControlState) then
    RecreateWidget;
end;

procedure TJvExControlBar.PaintTo(PaintDevice: QPaintDeviceH; X, Y: Integer);
begin
  WidgetControl_PaintTo(self, PaintDevice, X, Y);
end;

procedure TJvExControlBar.PaintWindow(PaintDevice: QPaintDeviceH);
begin
  PaintTo(PaintDevice, 0, 0);
end;

function TJvExControlBar.WidgetFlags: Integer;
begin
  Result := inherited WidgetFlags or
    Integer(WidgetFlags_WRepaintNoErase) or
    Integer(WidgetFlags_WMouseNoMask);
end;

function TJvExControlBar.ColorToRGB(Value: TColor): TColor;
begin
  Result := QWindows.ColorToRGB(Value, self);
end;
  
{ QControl Common}

function TJvExControlBar.HitTest(X, Y: integer): Boolean;
begin
   Result := Perform(CM_HITTEST, 0, 0) <> HTNOWHERE;
end;

procedure TJvExControlBar.CMHintShow(var Mesg: TJvMessage);
begin
  with Mesg do
  begin
    Handled := inherited HintShow

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -