乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      如何:定義工具欄按鈕的圖標(biāo)

       嘿嘿天亮了 2012-06-14

      如何:定義工具欄按鈕的圖標(biāo)


      Note注意

      ToolStrip 控件替換了 ToolBar 控件并添加了功能;但是也可選擇保留 ToolBar 控件以備向后兼容和將來使用。

      ToolBar 按鈕能夠在其中顯示圖標(biāo),以便于用戶標(biāo)識。具體的實現(xiàn)方法是,向 ImageList 組件(Windows 窗體)組件添加圖像,然后將 ImageList 組件與 ToolBar 控件關(guān)聯(lián)起來。

      以編程方式設(shè)置工具欄按鈕的圖標(biāo)

      1. 在過程中,實例化 ImageList 組件和 ToolBar 控件。

      2. 在同一過程中,向 ImageList 組件分配一個圖像。

      3. 在同一過程中,向 ToolBar 控件分配 ImageList 控件,然后分配各個工具欄按鈕的 ImageIndex 屬性。

        在下面的代碼示例中,圖標(biāo)位置的路徑設(shè)置是“My Documents”文件夾。這樣做是因為可假定大多數(shù)運行 Windows 操作系統(tǒng)的計算機都包含此目錄。這還將允許具有最低系統(tǒng)訪問級別的用戶安全地運行應(yīng)用程序。下面的示例假定一個已添加了 PictureBox 控件的窗體。

        按照上述步驟,您應(yīng)該已經(jīng)編寫出類似于下面顯示的代碼。

        Public Sub InitializeMyToolBar()
        ' Instantiate an ImageList component and a ToolBar control.
           Dim ToolBar1 as New ToolBar
           Dim ImageList1 as New ImageList
        ' Assign an image to the ImageList component.
        ' You should replace the bold image
        ' in the sample below with an icon of your own choosing.
           Dim myImage As System.Drawing.Image = _ 
              Image.FromFile Image.FromFile _
              (System.Environment.GetFolderPath _
              (System.Environment.SpecialFolder.Personal) _
              & "\Image.gif")
           ImageList1.Images.Add(myImage)
        ' Create a ToolBarButton.
           Dim ToolBarButton1 As New ToolBarButton()
        ' Add the ToolBarButton to the ToolBar.
           ToolBar1.Buttons.Add(toolBarButton1)
        ' Assign an ImageList to the ToolBar.
           ToolBar1.ImageList = ImageList1
        ' Assign the ImageIndex property of the ToolBarButton.
           ToolBarButton1.ImageIndex = 0
        End Sub
        
        

        public void InitializeMyToolBar()
        {
           // Instantiate an ImageList component and a ToolBar control.
           ToolBar toolBar1 = new  ToolBar(); 
           ImageList imageList1 = new ImageList();
           // Assign an image to the ImageList component.
           // You should replace the bold image 
           // in the sample below with an icon of your own choosing.
           // Note the escape character used (@) when specifying the path.
           Image myImage = Image.FromFile
           (System.Environment.GetFolderPath
           (System.Environment.SpecialFolder.Personal)
           + @"\Image.gif");
           imageList1.Images.Add(myImage);
           // Create a ToolBarButton.
           ToolBarButton toolBarButton1 = new ToolBarButton();
           // Add the ToolBarButton to the ToolBar.
           toolBar1.Buttons.Add(toolBarButton1);
           // Assign an ImageList to the ToolBar.
           toolBar1.ImageList = imageList1;
           // Assign ImageIndex property of the ToolBarButton.
           toolBarButton1.ImageIndex = 0;
        }
        
        

        public:
           void InitializeMyToolBar()
           {
              // Instantiate an ImageList component and a ToolBar control.
              ToolBar ^ toolBar1 = gcnew  ToolBar(); 
              ImageList ^ imageList1 = gcnew ImageList();
              // Assign an image to the ImageList component.
              // You should replace the bold image 
              // in the sample below with an icon of your own choosing.
              Image ^ myImage = Image::FromFile(String::Concat
                 (System::Environment::GetFolderPath
                 (System::Environment::SpecialFolder::Personal),
                 "\\Image.gif"));
              imageList1->Images->Add(myImage);
              // Create a ToolBarButton.
              ToolBarButton ^ toolBarButton1 = gcnew ToolBarButton();
              // Add the ToolBarButton to the ToolBar.
              toolBar1->Buttons->Add(toolBarButton1);
              // Assign an ImageList to the ToolBar.
              toolBar1->ImageList = imageList1;
              // Assign ImageIndex property of the ToolBarButton.
              toolBarButton1->ImageIndex = 0;
           }
        

      請參見

        本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
        轉(zhuǎn)藏 分享 獻花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多