C#圖片選取器

來源:互聯網
上載者:User

      明天就要放假回家了,哈哈,忙了一個多月的B/S項目也終於告一段落了。過年來以後又可以自己繼續研究GDI和GIS,哈哈,在放假回家之前還是來寫寫部落格,要不又要過很長時間才能過來了。

      用過CAD投影片功能的人都知道,其中有個圖片管理器,可以圖片顯示.sld格式的檔案,說白了,就是和QQ的頭像選擇功能類似,哈哈,很早以前就覺得這功能很不錯,可以加以利用。

      用C#自訂了一個功能類似的控制項。哈哈,看看圖吧。

    

     的時候顯示稍微有點問題,哈哈,湊合可以看。

     後台添加圖片的代碼也很容易。簡單的看看。

代碼

       private void InitImageSelector()
        {
            Bitmap bit1 = new Bitmap(@"F:\Images\163.png");
            Bitmap bit2 = new Bitmap(@"F:\Images\明信科技.png");
            Bitmap bit3 = new Bitmap(@"F:\Images\parents_logo.png");
            Bitmap bit4 = new Bitmap(@"F:\Images\Alert_11.png");
            Bitmap bit5 = new Bitmap(@"F:\Images\3-11.png");
            this.selectorMain1.AddItem(bit1, "圖片1");
            this.selectorMain1.AddItem(bit2, "圖片2");
            this.selectorMain1.AddItem(bit3, "圖片3");
            this.selectorMain1.AddItem(bit4, "圖片4");
            this.selectorMain1.AddItem(bit5, "圖片5");
        }

       至於控制項的代碼就不貼上來了,哈哈,有需要的可以郵箱發。哈哈哈!!

       補充:

       感覺上面的用按鈕不太美觀,雙擊的時候就顯示圖片資訊感覺可能更實用。就像下面這樣。

      

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.