View Full Version : سوال: قرار دادن آیکن برای dll
kingtak
جمعه 29 دی 1391, 16:09 عصر
سلام دوستان
میخوام یوزر کنترلهایی که به dll تبدبل میکنم آیکن داشته باشن.یعنی اگه کاربر dll رو به ToolBox اضافه کرد مثل کنترل های پیش فرض ویژوال استادیو آیکنشون نشون داده بشه.
میشه؟
plus
جمعه 29 دی 1391, 16:25 عصر
شما باید از ToolboxBitmap Attribute برای کلاس User Control ستفاده کنی:
// C#
// Specifies the bitmap associated with the Button type.
[System.Drawing.ToolboxBitmap(typeof(Button))]
class MyControl1 : UserControl
{
}
// Specifies a bitmap file.
[System.Drawing.ToolboxBitmap(@"C:\Documents and Settings\Joe\MyPics\myImage.bmp")]
class MyControl2 : UserControl
{
}
// Specifies a type that indicates the assembly to search, and the name
// of an image resource to look for.
[System.Drawing.ToolboxBitmap(typeof(MyControl), "MyControlBitmap")]
class MyControl : UserControl
{
}
ordebehesht
جمعه 29 دی 1391, 20:51 عصر
حتما باید bitmap باشن من کردم نشد
kingtak
دوشنبه 02 بهمن 1391, 12:31 عصر
این کد توی wpf هم اجرا میشه؟
چطوری ازش استفاده کنم....
همه این کد هارو باید کپی کنم توی کلاسم؟
آخه فقط یه قسمتشو کپی کردم و لی کار نکرد:(خطا نمیده ها!!!فقط آیکون نشون داده نمیشه!)
[ [System.Drawing.ToolboxBitmap(@"D:\myImage.bmp")]
اگه میشه یه ذره کمک کنید
masoud_z_65
دوشنبه 02 بهمن 1391, 12:40 عصر
دوستان این سوال منم هست توی wpf میخوام برای dll ام آیکون بزارم ممنون میشم کسی کمک کنه
plus
دوشنبه 02 بهمن 1391, 13:55 عصر
این کد توی wpf هم اجرا میشه؟
چطوری ازش استفاده کنم....
همه این کد هارو باید کپی کنم توی کلاسم؟
آخه فقط یه قسمتشو کپی کردم و لی کار نکرد:(خطا نمیده ها!!!فقط آیکون نشون داده نمیشه!)
[ [System.Drawing.ToolboxBitmap(@"D:\myImage.bmp")]
اگه میشه یه ذره کمک کنید
در مورد wpf نمیدونم احتمالا باید کار کنه ولی یک نکته ای هست که آیکن برای کلاس شما که در پروژتون هست در Toolbox نمایش داده نمیشه و فقط وقتی نمایش داده میشه که شما کلاستون رو DLL کنیدو اون DLL رو Add Reference کنید.
kingtak
دوشنبه 02 بهمن 1391, 15:53 عصر
در مورد wpf نمیدونم احتمالا باید کار کنه
نه دوست عزیز کار نکرد.
فقط وقتی نمایش داده میشه که شما کلاستون رو DLL کنیدو اون DLL رو Add Reference کنید.
من هم همین کار رو انجام دادم ولی نشد!!!:گیج:
فکر کنم توی wpf یه ذره پیچیده تره!!!من تو اینترنت سرچ زدم یه چیزایی پیدا کردم ولی سردرنیاوردم.حالا از دوستان خواهش میکنم اگه این کار رو انجام دادن کمک کنن!
kingtak
سه شنبه 10 بهمن 1391, 19:46 عصر
لطفا اگه کسی بلده کمک کنه!!!:افسرده:
ma.rad
سه شنبه 10 بهمن 1391, 20:01 عصر
سلام دوست عزیز ،ا
در اینجا توضیح می دم که چگونه به یک فایل DLL بسازید که شامل مجموعه آیکون باشد مانند "SHELL32.dll
1. باز کردن پروژه جدید Class Library
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon1.gif
2. After Opening the file will show like:
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon2.gif
3. Now open a file
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon3.gif
4. Native ResourceTemplete File
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon4.gif
5. Then Add resource
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon5.gif
6. Import Icon
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon6.gif
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon6.1.gif
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon6.2.gif
7. Now again add resource for set version Information
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon7.gif
8. The screen will like this:
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon8.gif
9. Now you add your information like,
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon9.gif
10. Now save the resource file as
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon10.gif
11. Must Select *.res file
12. Now open your main class project & chose Property
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon12.gif
13. Set resource file
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon13.gif
14. Now Build
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon14.gif
15. You can see the application information will show on your dll
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon15.gif
16. And when you browse this dll to get icon you will see like,
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon16.gif
That's it.
Now you can make a DLL which is a collection of icon.
kingtak
چهارشنبه 11 بهمن 1391, 12:43 عصر
سلام دوست عزیز ،ا
در اینجا توضیح می دم که چگونه به یک فایل DLL بسازید که شامل مجموعه آیکون باشد مانند "SHELL32.dll
1. باز کردن پروژه جدید Class Library
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon1.gif
2. After Opening the file will show like:
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon2.gif
3. Now open a file
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon3.gif
4. Native ResourceTemplete File
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon4.gif
5. Then Add resource
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon5.gif
6. Import Icon
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon6.gif
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon6.1.gif
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon6.2.gif
7. Now again add resource for set version Information
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon7.gif
8. The screen will like this:
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon8.gif
9. Now you add your information like,
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon9.gif
10. Now save the resource file as
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon10.gif
11. Must Select *.res file
12. Now open your main class project & chose Property
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon12.gif
13. Set resource file
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon13.gif
14. Now Build
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon14.gif
15. You can see the application information will show on your dll
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon15.gif
16. And when you browse this dll to get icon you will see like,
http://www.c-sharpcorner.com/UploadFile/tanmayit08/how-you-make-a-dll-file-which-contains-the-icon-set-like-shell32-dll/Images/Icon16.gif
That's it.
Now you can make a DLL which is a collection of icon.
دوست عزیز من میخوام این آیکن توی تولباکس ویژوال استادیو نشون داده بشه!!
http://kingtak.persiangig.com/Programming/Untitled-1.jpg
vBulletin® v4.2.5, Copyright ©2000-1403, Jelsoft Enterprises Ltd.