Assigning an image to the composite custom control in visual studio tool box Part 117

  • دعنا نشارك هذا :
ترتيب الدرس : 117
المدة : 00:08:24
التحكم :
Text version of the video
http://csharp-video-tutorials.blogspot.com/2013/01/assigning-image-to-composite-custom.html

Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.
https://www.youtube.com/channel/UC7sEwIXM_YfAMyonQCrGfWA/?sub_confirmation1

Slides
http://csharp-video-tutorials.blogspot.com/2013/08/part-117-assigning-image-to-composite.html

All ASP .NET Text Articles
http://csharp-video-tutorials.blogspot.com/p/free-aspnet-video-tutorial.html

All ASP .NET Slides
http://csharp-video-tutorials.blogspot.com/p/aspnet-slides.html

All Dot Net and SQL Server Tutorials in English
https://www.youtube.com/user/kudvenkat/playlists?view1&sortdd

All Dot Net and SQL Server Tutorials in Arabic
https://www.youtube.com/c/KudvenkatArabic/playlists

In this video we will discuss about assigning an image to the Composite Custom calendar control in visual studio tool box. Please watch Parts 112 to 116 from the asp.net video tutorial before proceeding with this video.
http://www.youtube.com/playlist?listPL6n9fhu94yhXQS_p1i-HLIftB9Y7Vnxlo

To associate an image to the composite custom calendar control use ToolboxBitmap attribute. This attribute is present in System.Drwaing namespace. There are 2 ways we can use this attribute.

Using ToolboxBitmap attribute to associate, the image of an existing control: In this example, we are assigning the image of the asp.net calendar control to the composite custom calendar control. Please notice the usage of ToolboxBitmap attribute with "typeof" keyword.
[System.Drawing.ToolboxBitmap(typeof(Calendar))]

Rebuild the CustomControls project. Re-add the CustomCalendar control to visual studio tool box and notice that the asp.net calendar control icon is also used for the CustomCalendar control.

Using ToolboxBitmap attribute to associate a custom image: Create an image measuring 16X16 pixels in dimensions. I have used microsoft paint to come up with the custom image that you can see below.

Save this image to "C:\Images" folder or in a folder of your choice. I have gven the name of "CustomCalendarIcon.bmp" to the image.

Finally use the ToolboxBitmap attribute and specify the path to the image.
[System.Drawing.ToolboxBitmap(@"C:\Images\CustomCalendarIcon.bmp")]

Rebuild the CustomControls project. Re-add the CustomCalendar control to visual studio tool box and notice that the custom image "CustomCalendarIcon.bmp" is used for the CustomCalendar control.

In our next video, we will discuss about the differences between user controls and custom controls.

سيتم تفعيل التعليقات قريبا

y
Sep 23, 2020 07:32:26
youtube