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

📄 faq.txt

📁 絮语2007视频聊天软件源程序.仅供参考
💻 TXT
字号:
  ============================================================================
                BarMenu Components Frequently Asked Questions
        Copyright (C) 2000-2001 Bluecave Software. All Rights Reserved.
  ============================================================================

  This file contains common questions and answers to those. Before asking
  the Author for help, please read this file completely. If your problem is
  not solved after read this file, you may contact the Author. For contact
  information see Readme.txt.

  FAQ:
   1. How to use separator line item captions?
   2. How to convert existing menus to BarMenus?
   3. How to use OnBeforeDrawBar and OnAfterDrawBar?

  ----------------------------------------------------------------------------
  1.
  Q: How to use separator line item captions?

  A: You make the separator line like before (with "-" character as caption) and
  then the separator line caption you want to have is put to the Hint property
  of the item. If you want to disable the separator line caption, set the
  items Enabled property to False. And of course you need to have the menu
  component ShortLines set True. See the demo application for example.

  Tip: If you want to have separator line as the first item in the menu, you
       need to set the AutoLineReducation on the parent item to maManual.
       Otherwise the item is removed automatically by VCL.

  ----------------------------------------------------------------------------
  2.
  Q: How to convert existing menus to BarMenus?

  A: You need to edit the source code and the dfm source code manually.

  Classes which are compatible:

    TMainMenu - TBcBarMainMenu
    TPopupMenu - TBcBarPopupMenu

    1. Change the menu class to BarMenus class in the source code. Example:

       TForm1 = class(TForm)
         PopupMenu1: TPopupMenu;                    <-- This line
       private
       ...

       Change to:

       TForm1 = class(TForm)
         PopupMenu1: TBcBarPopupMenu;               <-- This line
       private
       ...

    2. Do the same change to the dfm source. Activate the form and press ALT-F12.
       You will now get the form in text format to the editor. Change the
       component's class which you changed in the source code. Example:

       object Form1: TForm1
         object PopupMenu1: TPopupMenu              <-- This line
           AutoLineReduction = maManual
           Images = PopupMenuImages
       ...

       Change to:

       object Form1: TForm1
         object PopupMenu1: TBcBarPopupMenu         <-- This line
           AutoLineReduction = maManual
           Images = PopupMenuImages
       ...

       After that press ALT-F12 again to see the form again. Now the menu
       component has all new properties and features!

  ----------------------------------------------------------------------------
  3.
  Q: How to use OnBeforeDrawBar and OnAfterDrawBar?

  A: As told in the description of these events in the Readme.txt and seen in
     the example Demo project these are fairly easy to use. Here is the example
     code from the Demo project for OnBeforeDrawBar event:

     procedure TForm1.BcBarPopupMenu3BeforeDrawBar(Sender: TObject;
       ACanvas: TCanvas; ARect: TRect; var DefaultDraw: Boolean);
     begin
       DefaultDraw := False; { do not allow default drawing }
       with ACanvas do
       begin
         { fill the whole bar with something }
         Brush.Bitmap := AllocPatternBitmap(clRed, clYellow);
         FillRect(ARect);
         { draw black frame rect around the bar }
         Brush.Color := clBlack;
         FrameRect(ARect);
       end;
     end;

     OnAfterDrawBar event works same way as the OnBeforeDrawBar with exception
     of that the ACanvas contains the bar which has been drawn by the component.
     Also, there is no DefaultDraw parameter in this event. Demo project shows
     code which copies the bar image to the parent forms TImage as "preview":

     procedure TForm1.BcBarPopupMenu1AfterDrawBar(Sender: TObject;
       ACanvas: TCanvas; ARect: TRect);
     begin
       with Image1.Canvas do
       begin
         { empty the image }
         Brush.Color := Form1.Color;
         FillRect(Rect(0, 0, Image1.Width, Image1.Height));
         { copy the menu bar to the image1 }
         CopyRect(ARect, ACanvas, ARect);
       end;
     end;

     You must note that the events are excuted only when the internal bar
     doublebuffer needs refresh. So, if the buffer contants valid bar, events
     are not executed. This behavior can be seen in the Demo project. Try
     testing the Enabled check item in the Toolmenu popupmenu.

  ----------------------------------------------------------------------------

⌨️ 快捷键说明

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