How to use Visual Studio to add an icon to your Web Part in SharePoint development

Source: Internet
Author: User

How to use Visual Studio to add an icon to your Web Part in SharePoint development goes straight to the chase. Take Hello world for example. 1. Open vs as Administrator and create a new blank SharePoint project. Click OK. Deployed as a farm solution. 2. Right-click the item to add a new item--web part, name Helloworldwebpart. 3. Edit code: Before deployment, here I want to add an icon to the Web Part. Each Web Part has two icons: one identifies the Web Part in the Web Part gallery, and one identifies the Web Part on the page.        Using an icon is a simple trick that can enhance your Web parts and often requires little code. The Web Part definition contains two properties that specify the icon, and one is CatalogIconImageUrl, which specifies the URL location of the icon file. Must be a 16x16 pixel picture, png/gif or JPEG format.        This icon identifies the Web Part in the Web Part gallery, and it is strongly recommended to use the icon here, which will help your users discover this Web Part and give a professional impression. The second icon is Titleiconimageurl, which you can use to display to the left of the Web Part title bar. Can be the same size as the first icon. In fact, it is not recommended to use the icon here. Typically, it affects the visual effects of Web Parts.       If no other Web Part has an icon, it has a negative effect. You can specify an icon in a. webpart file, or overwrite it in a Web Part class.        Of course, the simplest thing to do is to modify it in a. webpart file. First you want to add an icon to the project. Right-click the project and select Add--sharepoint Picture Map folder. VS will add folders to the project, create subfolders, and name your project name. Here you want to add the icon picture file.
Then you want to edit the. WebPart file: 4. Click Build--Deploy the solution. 5. Add a Web Part to a SharePoint page to see:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.