resources

Reading string from resource file and editing it programmatically

≡放荡痞女 提交于 2019-12-17 20:27:21
问题 How can I read string resource file? I have tried this already but I couldn't get the value. For editing it later I couldn't do anything. How can I edit it later programmaticaly? I want to edit its value with a string that I get from textbox. Assembly assembly = this.GetType().Assembly; manager = new ResourceManager("StringResources.Strings", assembly); value = manager.GetString("Name"); For changing its value I tried to do this but it gives me an error does not contain a definition for

C# Resource Array

时间秒杀一切 提交于 2019-12-17 20:25:11
问题 I have a bunch of pictures I'm using in a C# project, and I'm trying to initialize them all for later use. There are over 50 of them and they all have the same name format Properties.Resources._#, where # is the picture number. What I'm trying to do is something like: for(int i = 0; i < 100; i++) { pics[i] = Properties.Resources._i; } How would I go about embedding the index into the name? Thanks, and happy holidays. EDIT: Just realized that if I had a way to embed the index in the name, I

How to get Resource(int) from String - Android [duplicate]

喜夏-厌秋 提交于 2019-12-17 19:27:59
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Android, getting resource ID from string? String res = "R.drawable.image1"; I need to get it's INT id. Please help me! 回答1: Use this to get resource id: int picId = getResources().getIdentifier(picName, "drawable", getApplicationContext().getPackageName()); 回答2: If you want to get the integer then simply remove the quotes. int id = R.drawable.image1; // instead of "R.drawable.image1" That will give you the

How to add PNG resource in Visual Studio 2010?

半城伤御伤魂 提交于 2019-12-17 18:48:25
问题 I have a PNG (i.e. a compressed image) that I'd like to include in my assembly (i.e. application). How to do it? Additional information: I tried adding a PNG resource to my assembly in Visual Studio 2010: But that didn't work, as Visual Studio converts it to an uncompressed bitmap: Except I want to add a PNG. Otherwise my 1MB application becomes 8MB: ]=== 1MB file size ==> ]=== 8MB file size ======================================================================================================

Howto embed images in Actionscript 3 / Flex 3 the right way?

时光总嘲笑我的痴心妄想 提交于 2019-12-17 18:37:48
问题 I'm creating a game where a lot of images are being used in Actionscript / Flex 3 (Flash). Now that I've reached the designer stage, I have to work out a structural way of using embedded images (which have to be manipulated with rotation, color, etc.). Unfortunately, after investigating a bit, it looks like you have to manually embed images before you can use them. I currently have it setup like this: Resource.as class file: package { public final class Resource { [Embed (source="/assets

Any easy way to use icons from resources?

…衆ロ難τιáo~ 提交于 2019-12-17 18:33:55
问题 I have an C# app. I need to add an icon to that app so i added an icon resource. Adding resource went fine, but is there any way to use my (resource) icon as form icon WITHOUT adding additional code? When i try to use design-time "icon" property of form it seems i have to choose a file, but i want to use embedded icon... Any help? 回答1: choosing that file, will embed the icon in the executable. 回答2: Add the icon to the project resources and rename to icon. Open the designer of the form you

Change PictureBox's image to image from my resources?

孤人 提交于 2019-12-17 18:27:10
问题 How do I set a PictureBox image to an image from my resources? (I tried this without success: pictuerbox.Image = "img_location"; ) 回答1: If you loaded the resource using the visual studio UI, then you should be able to do this: picturebox.Image = project.Properties.Resources.imgfromresource 回答2: Ken has the right solution, but you don't want to add the picturebox.Image.Load() member method. If you do it with a Load and the ImageLocation is not set, it will fail with a "Image Location must be

Is there any way to use not public android resources in my application?

心不动则不痛 提交于 2019-12-17 18:26:05
问题 I need to use the following resources in my widget: pressed_application_background_static focused_application_background_static I hope that usage of these resources will allow me to have orange background on standard android and green on HTC. But they are not public, so usage of android:drawable="@android:drawable/pressed_application_background_static" is not allowed. Is still there any way to use them? 回答1: You can reference them like this android:drawable="@*android:drawable/pressed

What's the difference between a Resource and an Embedded Resource in a C# application?

我怕爱的太早我们不能终老 提交于 2019-12-17 17:42:06
问题 When should I use one or the other? I'd like all of the files I use in my app (images, sound, xml file, etc.) to be inside of the .exe file so I don't deploy with a bunch of folders and files. Thanks for the info. 回答1: “Resource” and “Content” build actions are to access the WPF resources using the Uris. However “Embedded Resource” is for prior technologies. However both options embed the resource in assembly but “Resource” option to be used for WPF. MSDN provides full explanation here. 回答2:

Correct way to quit a Qt program?

匆匆过客 提交于 2019-12-17 17:25:30
问题 How should I quit a Qt Program, e.g when loading a data file, and discovered file corruption, and user need to quit this app or re-initiate data file? Should I: call exit(EXIT_FAILURE) call QApplication::quit() call QCoreApplication::quit() And difference between (2) and (3)? 回答1: QApplication is derived from QCoreApplication and thereby inherits quit() which is a public slot of QCoreApplication , so there is no difference between QApplication::quit() and QCoreApplication::quit() . As we can