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

📄 uabout.pas

📁 DelphiDoc is a program for automatic generation of documentation on a Delphi-Project. At the momen
💻 PAS
📖 第 1 页 / 共 2 页
字号:
            URL:
'http://partners.adobe.com/public/developer/pdf/index_reference.html')
           );









{$IFDEF VER120}

{Called whenever a node in the ~[link TreeView] has to be drawn.
~param Sender      the sender of the event, ~[link TreeView]
~param Node        the node to be drawn
~param State       the state of the node
~param DefaultDraw out: if the node should be drawn by the tree view }
procedure TFormAbout.TreeViewCustomDrawItem(Sender: TCustomTreeView;
                                            Node: TTreeNode;
                                            State: TCustomDrawState;
                                            var DefaultDraw: Boolean);
begin
 with TreeView.Canvas.Font do
  begin
   //set Font.Color, so it changed, so it does not "flicker" on a click with
   if Node = TreeView.Selected then           //the right mouse button
    begin
     Color := clWindowText;
     Color := clHighlightText;
    end
   else
    begin
     Color := clHighlightText;
     Color := clWindowText;
    end;
  end;
end;

{$ENDIF}





{$IFNDEF LINUX}

{Called when the mouse pointer enters the form or a component.
~param Msg TObject(Msg.LParam) contains a reference to the component that
           has been entered by the mouse pointer, it is nil for the form }
procedure TFormAbout.MouseEnter(var Msg: TMessage);
begin
 inherited;

 if (Msg.Msg = CM_MOUSEENTER) and
    (TObject(Msg.LParam) = LabelURL) then    //mouse pointer entered the label?
  //underline the text/link
  LabelURL.Font.Style := LabelURL.Font.Style + [fsUnderline];
end;

{Called when the mouse pointer leaves the form or a component.
~param Msg TObject(Msg.LParam) contains a reference to the component that
           has been left by the mouse pointer, it is nil for the form }
procedure TFormAbout.MouseLeave(var Msg: TMessage);
begin
 inherited;

 if (Msg.Msg = CM_MOUSELEAVE) and
    (TObject(Msg.LParam) = LabelURL) then    //mouse pointer left the label?
  //do not longer underline the text/link
  LabelURL.Font.Style := LabelURL.Font.Style - [fsUnderline];
end;


{$ELSE}




{Called when the mouse pointer enters the label of the URL.
~param Sender the label on which the mouse was moved, ~[link LabelURL] }
procedure TFormAbout.LabelURLMouseEnter(Sender: TObject);
begin
 //underline the text/link
 LabelURL.Font.Style := LabelURL.Font.Style + [fsUnderline];
end;

{Called when the mouse pointer leaves the label of the URL.
~param Sender the label which the mouse pointer left, ~[link LabelURL] }
procedure TFormAbout.LabelURLMouseLeave(Sender: TObject);
begin
 //do not longer underline the text/link
 LabelURL.Font.Style := LabelURL.Font.Style - [fsUnderline];
end;


{$ENDIF}





























{Called after the form has been created.
~param Sender the sender of the event, the form }
procedure TFormAbout.FormCreate(Sender: TObject);
begin
 //and only show vertical scroll bar when it's needed
 GeneralVCL.RegisterMemoToHideVerticalScrollbar(Memo);

 TreeView.FullExpand;  //show all nodes to components to show information about

{$IFDEF VER120}
 TreeView.OnCustomDrawItem := TreeViewCustomDrawItem;
{$ENDIF}

{$IFDEF LINUX}
 LabelURL.OnMouseEnter := LabelURLMouseEnter;   //hot track on the URL
 LabelURL.OnMouseLeave := LabelURLMouseLeave;
{$ENDIF}

 TFormSettings.SaveBasicFormValues(Self);        //read the basic form values
end;

{Called when the form is about to be closed.
~param Sender the sender of the event, the form
~param Action out: if and how the form should be closed }
procedure TFormAbout.FormClose(Sender: TObject; var Action: TCloseAction);
var       Settings  :TFormSettings;      //to save the settings of the form
begin
 //get object to save the settings in
 Settings := TFormSettings(TFormSettings.GetSettings(ClassName));
 if assigned(Settings) then
  Settings.GetValuesFromForm(Self);     //save current settings
end;



{Called when a node of the tree view should be collapsed.
~param Sender        the sender of the event, the ~[link TreeView]
~param Node          the node to be collapsed
~param AllowCollapse out: if the node is allowed to be collapsed }
procedure TFormAbout.TreeViewCollapsing(Sender: TObject; Node: TTreeNode;
                                        var AllowCollapse: Boolean);
begin
 AllowCollapse := False;               //don't collapse any node
end;


{Called when another node is selected in the ~[link TreeView].
~param Sender the sender of the event, ~[link TreeView]
~param Node   the newly selected node }
procedure TFormAbout.TreeViewChange(Sender: TObject; Node: TTreeNode);
begin
 Assert(Node.AbsoluteIndex >= Low(AboutInfo));
 Assert(Node.AbsoluteIndex <= High(AboutInfo));
 //show text and URL of the component of the selected node
 Memo.Text := AboutInfo[Node.AbsoluteIndex].Text;
 LabelURL.Caption := AboutInfo[Node.AbsoluteIndex].URL;
end;




{Called when the label with the URL is clicked.
~param Sender the sender of the event, ~[link LabelURL] }
procedure TFormAbout.LabelURLClick(Sender: TObject);
begin
 if LabelURL.Caption <> '' then           //URL for the component available?
{$IFNDEF LINUX}
  //launch the default browser on the URL
  ShellExecute(Handle, nil, PChar(LabelURL.Caption), nil, nil, SW_SHOWNORMAL);
{$ELSE}
  Clipboard.AsText := LabelURL.Caption;    //just copy it to the clip board
{$ENDIF}
end;

{Called when the label with the URL is clicked.
~param Sender the sender of the event, ~[link LabelURL]
~param Button the pressed mouse button
~param Shift  the state of special keys
~param X, Y   position of the mouse pointer }
procedure TFormAbout.LabelURLMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
 if Button = mbLeft then              //only left button is a click
  LabelURL.Font.Color := clRed;
end;

{Called when the mouse button is released after clicking the label with the
 URL.
~param Sender the sender of the event, ~[link LabelURL]
~param Button the released mouse button
~param Shift  the state of special keys
~param X, Y   position of the mouse pointer }
procedure TFormAbout.LabelURLMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
 if Button = mbLeft then              //only left button is a click
  LabelURL.Font.Color := clBlue;
end;

end.
    

⌨️ 快捷键说明

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