WinForms中的图像资源(Image Resources in WinForms)
我想将图像存储在.dll文件中,并将它们用于我的winform应用程序。 但我无法加载.dll内容
System.IO.Stream stream; System.Reflection.Assembly assembly; Image bitmap; assembly = System.Reflection.Assembly.LoadFrom(Application.ExecutablePath); stream = assembly.GetManifestResourceStream("global::template.Properties.Resources.test.png"); bitmap = Image.FromStream(stream); this.background.titleImage = bitmap; // image box
I want to store images in a .dll file and use them for my winform application. but Im not able to load .dll content
System.IO.Stream stream; System.Reflection.Assembly assembly; Image bitmap; assembly = System.Reflection.Assembly.LoadFrom(Application.ExecutablePath); stream = assembly.GetManifestResourceStream("global::template.Properties.Resources.test.png"); bitmap = Image.FromStream(stream); this.background.titleImage = bitmap; // image box
原文:https://stackoverflow.com/questions/2984763
更新时间:2023-08-08 17:08
最满意答案
在您目前的情况下,执行以下操作:
$string =' ( orange fruit OR APPLE ) AND (Kiwi OR banana pie)'; // Remove all extra characters and spaces from string $result = trim(preg_replace('#[\s\(\)]+#', ' ', $string)); // Split result by possible delimeters $result = preg_split('# (or|and) #i', $result); // Output print_r($result);
输出:
Array ( [0] => orange fruit [1] => APPLE [2] => Kiwi [3] => banana pie )
In your current case do the following:
$string =' ( orange fruit OR APPLE ) AND (Kiwi OR banana pie)'; // Remove all extra characters and spaces from string $result = trim(preg_replace('#[\s\(\)]+#', ' ', $string)); // Split result by possible delimeters $result = preg_split('# (or|and) #i', $result); // Output print_r($result);
Output:
Array ( [0] => orange fruit [1] => APPLE [2] => Kiwi [3] => banana pie )
相关问答
更多-
以下是几个准则: 布尔运算符通常用于布尔值,但按位运算符通常用于整数值。 布尔运算符是短路的,但按位运算符不短路。 短路行为在这样的表达式中很有用: if x is not None and x.foo == 42: # ... 这将无法正确使用按位&运算符,因为双方将始终被评估,给出AttributeError: 'NoneType' object has no attribute 'foo' 。 当你使用布尔and运算符时,第一个是False时,第二个表达式不被评估。 类似地or如果第一个参数 ...
-
正则表达式用“/”分隔的单词的句子得到最后一个单词?(Regex to get last word from sentence of words separated by “/“?)[2022-11-09]
您可以使用 [^/]+$ 这将匹配字符串中最后一次非斜杠字符。 You can use [^/]+$ which will match the last run of non-slash characters in a string. -
用于获取由布尔运算符分隔的多个单词的正则表达式(Regex for getting multiple words separated by boolean operators)[2023-06-02]
在您目前的情况下,执行以下操作: $string =' ( orange fruit OR APPLE ) AND (Kiwi OR banana pie)'; // Remove all extra characters and spaces from string $result = trim(preg_replace('#[\s\(\)]+#', ' ', $string)); // Split result by possible delimeters $result = preg_split( ... -
使用Regex处理布尔短语(Process boolean phrase with Regex)[2023-09-05]
尝试添加单词边界: "\\b(and|or|not|near)\\b|\"" Try adding word boundaries: "\\b(and|or|not|near)\\b|\"" -
这应该这样做: in ([az]+ ){1,3}Beijing This ought to do it: in ([a-z]+ ){1,3}Beijing
-
如果 Name Eric Brine Computer Architecture x86 手段 key: Name Eric value: Brine key: Computer Architecture value: x86 那你想要的 # Requires 5.10 if (/ ^ (?: (?
[^:=]+ (? .* ) | (? .+ (? 怎么样 ^[(Administrators)(LOCAL SERVICE)(NETWORK SERVICE),\s]+$ 要么 ^(Administrators|LOCAL SERVICE|NETWORK SERVICE|[,\s])+$ 请参阅https://regex101.com/r/oJF0aW/2/tests 两个版本基本上都说整个字符串必须只包含指定的用户名以及逗号和空格。 How about ^[(Administrators)(LOCAL SERVICE)(NETWORK SERVICE ...^([0-9a-fA-F]{2}[:-]){5}[0-9a-fA-F]{2}(,([0-9a-fA-F]{2}[:-]){5}[0-9a-fA-F]{2})*$ 有关使正则表达式与分隔列表匹配的详细信息,请参阅Regex for逗号分隔列表。 基本上你需要把正则表达式放在一个MAC地址后跟一个包含逗号的组和一个匹配零次或多次的MAC地址的正则表达式。 在您尝试的解决方案中,逗号是完全可选的。 ^([0-9a-fA-F]{2}[:-]){5}[0-9a-fA-F]{2}(,([0-9a-fA-F]{2}[:- ...是的,提供的正则表达式可以: public static final VALID_STRING = "NTC|\\?|[ACTGacgt:]+"; ... boolean valid = str.matches(VALID_STRING); 如果您删除NTC| 从正则表达式字符串NTC变得无效。 你可以在这里测试它并进行实验。 Yes the provided regex would be ok: public static final VALID_STRING = "NTC|\\?|[ACTGacgt ...布尔运算符<,>,<=等(Boolean Operators <, >, <= etc)[2022-05-14]
我自己编写了一个快速功能,可以满足您的需求。 这是你的代码有什么问题: 你需要正确地缩进它。 这种比较是错误的:(<90)和(> = 80)) 你应该有类似的东西:(注意:这是一个python 2代码) def totals(score_w, score_x, score_y, score_z): rnd = round(score_w + score_x + score_y + score_z) print "Overall percentage is: " + str(rnd) ...相关文章
更多- C#中Image.FromFile()的用法
- Python资源索引 【转载】
- 【转帖】Python 资源索引
- Android完美多语言应用,不重启应用,不改变系统语言
- 收集的英语资源(不断更新)
- 《C/C++图像处理编程》扫描版[PDF]
- 比预想严重:FireFox现图像处理漏洞
- AngularJS资源
- HTML5 Canvas 图像动画的实现
- Storm重要概念
最新问答
更多- 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
- 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
- OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
- 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
- codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
- 在计算机拍照在哪里进入
- 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
- No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
- 单页应用程序:页面重新加载(Single Page Application: page reload)
- 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
- System.StackOverflow错误(System.StackOverflow error)
- KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
- 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
- android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
- TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
- 企业安全培训的各项内容
- 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
- C#类名中允许哪些字符?(What characters are allowed in C# class name?)
- NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
- 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
- 将多个行和可变行移动到列(moving multiple and variable rows to columns)
- 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
- 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
- Angular $资源不会改变方法(Angular $resource doesn't change method)
- 在Angular 5中不是一个函数(is not a function in Angular 5)
- 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
- 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
- 常见的python rpc和cli接口(Common python rpc and cli interface)
- Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
- 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)