split-screen 相关问题


有没有办法刷新/更新Win Forms应用程序中的Screen对象?

有没有办法更新Screen对象?备注:屏幕对象如 (Screen s in Screen.AllScreens) 如果缩放或其他属性更改,则对象不会更改。很详细的


如何在SikuliX(Java)中单击当前鼠标位置?

这是我尝试过的: 屏幕 screenWithCalendarField = new Screen(); 比赛日历 = new Match(); 尝试{ 日历 = screenWithCalendarField.find(new File("D:\Sikuli\CalendarField.png").


Python 代码可让我从文本文件中查找名称和 ID

员工 = {} def load_employees(): 以 open("employees.txt") 作为文件: 对于文件中的行: id_num, full_name = line.strip().split(",") 首先...


仅从文件中读取 1 个值

Python 文件: 名称=[] 以 open("names.csv") 作为文件: 对于文件中的行: 名称、颜色 = line.rstrip().split(",") print(f"{名称}, {颜色}") CSV ...


如何从Python中的另一个类更改kivy中的标签文本?

我是Python大佬。 这是我的 python 文件: 从 kivy.app 导入 App 从 kivy.uix.screenmanager 导入 ScreenManager, Screen 从 kivy.lang 导入生成器 kv = Builder.load_file('test.kv...


VSCode 仅从 csv 文件读取 1 个值[已关闭]

Python 文件: 名称=[] 以 open("names.csv") 作为文件: 对于文件中的行: 名称、颜色 = line.rstrip().split(",") print(f"{名称}, {颜色}") CSV ...


Python 代码仅从 csv 文件读取 1 个值 [已关闭]

Python 文件: 名称=[] 以 open("names.csv") 作为文件: 对于文件中的行: 名称、颜色 = line.rstrip().split(",") print(f"{名称}, {颜色}") CSV ...


失败后如何使用检查站点重复代理服务器

我的代码在失败后不会重复 导入请求 将 open("valid_proxies.txt", "r") 作为 f: 代理 = f.read().split(" ”) site_to_check = ["https://open.


流程图 - Python

我需要为给定的流程图编写一个程序 我的代码: x,y,d=列表(map(int,input().split())) 温度=0 而 x<=y: x=temp while temp>0: 如果温度%10==d: ...


c# 某些元素未显示在列表交集处

我正在尝试获取两个列表的共同元素。示例如下: var control = "F, H, S, W".Split(',').ToList(); var 驱动器 = 新列表 {"C", "...


我无法从 Huggingface 下载数据集

从数据集导入load_dataset 数据集 = load_dataset(path='seamew/THUCNewsTitle', split='train') 我的网络没问题,但控制台总是显示: 回溯(最近一次调用最后一次): 文件“/


使用海龟图形的谢尔宾斯基三角形递归

我正在尝试编写一个程序,使用turtle用python绘制谢尔宾斯基树。这是我的想法: 进口龟 def draw_sierpinski(长度,深度): 窗口 = 海龟.Screen() t = 乌龟....


对整数中的数字进行排序的最有效方法是什么?

例如,将616转为166,或将885740转为045788。我尝试过: parseInt(n.toString().split("").sort().join("")) 它确实有效,但是有没有更高效的方法?


PIL:ImageGrab.grab() 失败 - OSError:屏幕抓取在一段时间后失败

我使用 ImageGrab.grab() 来截取屏幕截图。 我有一个功能,可以以一定的延迟无限地截取屏幕截图。然而,大约2小时左右后,出现错误OSError: screen scrap


从 Android Automotive OS 中“Screen”子类的方法获取“Activity”实例

我正在尝试在 Android (13) 汽车操作系统中制作一个简单的应用程序。我的理解非常有限,尤其是在活动方面。在onGetTemplate中,我希望请求许可,w...


为什么整数值越高,程序运行时间就越长?

我正在使用此存储库中的文本文件。 f = open("words_alpha.txt") 列表 =f.read() f.close() # word 是随机字母列表 列表 = 列表.split() 对于列表 [:] 中的 i: 如果 len(i) &...


⚡️ 类型错误:模块名称,“@capacitor/splash-screen”无法解析为有效的 URL

当我创建一个 Capacitorjs 项目并添加 iOS,然后打开 Xcode 并单击运行时,它会在 Xcode 输出中输出错误并显示白屏。它的网络版本运行良好。我已经修改了...


如何分割多个不同的字符,同时保留该字符,但又不在空白处?

尝试/失败地分割两个不同的字符,但也不分割空间。 #!/usr/bin/env perl 使用严格; 我的 $line = "-abc=123 +def=456 -ghi 789"; 我的@arr = split(/([+-]\S+)/,$line); 为我的$


Javascript 函数 openFullscreen() ,如何让它在页面上的多个 iframe 上工作

在页面上我有一个 iframe,src 中有 *.pdf 文件。 <p>在页面上我有一个 iframe,src 中有 *.pdf 文件。</p> <pre><code>&lt;div class=&#34;node--view-mode-full&#34;&gt; &lt;p&gt;&lt;iframe allow=&#34;fullscreen&#34; allowfullscreen=&#34;&#34; frameborder=&#34;0&#34; height=&#34;980&#34; scrolling=&#34;no&#34; src=&#34;https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf&#34; width=&#34;660&#34;&gt;&lt;/iframe&gt;&lt;/p&gt; &lt;p&gt;&lt;iframe allow=&#34;fullscreen&#34; allowfullscreen=&#34;&#34; frameborder=&#34;0&#34; height=&#34;980&#34; scrolling=&#34;no&#34; src=&#34;https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf&#34; width=&#34;660&#34;&gt;&lt;/iframe&gt;&lt;/p&gt; &lt;/div&gt; </code></pre> <p>浏览器中内置的 pdf 查看器现在不支持 iframe 中的全屏模式。</p> <p>我找到了解决方案<a href="https://www.w3schools.com/howto/howto_js_fullscreen.asp" rel="nofollow noreferrer">https://www.w3schools.com/howto/howto_js_fullscreen.asp</a>,解决了问题 - 以全屏模式打开 iframe。在 w3schools 的示例中,打开 iframe 的按钮已存在于 HTML <a href="https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_fullscreen" rel="nofollow noreferrer">https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_fullscreen</a>.</p> <p>在我的解决方案中,我通过 javascript 添加按钮,因为带有 iframe 的页面已经存在,但没有此类按钮:</p> <pre><code>jQuery(document).ready(function($){ $(&#34;.node--view-mode-full iframe[src*=&#39;.pdf&#39;]&#34;).each(function (index) { $(this).addClass(&#39;fullscreenframe&#39;); $(this).attr(&#39;id&#39;, &#39;fullscreen-&#39;+index); $(&#39;&lt;button onclick=&#34;openFullscreen()&#34;&gt;Open in Fullscreen Mode&lt;/button&gt;&amp;nbsp;&lt;strong&gt;Tip:&lt;/strong&gt; Press the &#34;Esc&#34; key to exit full screen.&lt;br&gt;&#39;).insertBefore(this); }); }); </code></pre> <p>然后添加一个全屏打开 iframe 的功能(与 w3schools 相同):</p> <pre><code>function openFullscreen() { var elem = document.getElementsByClassName(&#34;fullscreenframe&#34;)[0]; if (elem.requestFullscreen) { elem.requestFullscreen(); } else if (elem.webkitRequestFullscreen) { /* Safari */ elem.webkitRequestFullscreen(); } else if (elem.msRequestFullscreen) { /* IE11 */ elem.msRequestFullscreen(); } }; </code></pre> <p>当页面上只有一个带有 *.pdf 的 iframe 时,Everysing 工作正常。但是,当我在页面上有两个或多个 iframe,并且单击任何 iframe 附近的“以全屏模式打开”任何按钮时,我总是在全屏模式下只看到第一个 *.pdf...</p> <p>我知道,这是因为我只得到 elem = document.getElementsByClassName("fullscreenframe")[0]; 中的第一个 iframe;</p> <p>我知道我需要使用类似的每个或类似的东西,但我无法解决它。在搜索关于页面上一个全屏元素的所有解决方案时,没有关于页面上多个元素的解决方案...谢谢。</p> </question> <answer tick="true" vote="0"> <p>也许是这样的:</p> <pre><code>jQuery(document).ready(function($){ $(&#34;.node--view-mode-full iframe[src*=&#39;.pdf&#39;]&#34;).each(function (index) { $(this).addClass(&#39;fullscreenframe&#39;); $(this).attr(&#39;id&#39;, &#39;fullscreen-&#39;+index); $(&#39;&lt;button onclick=&#34;openFullscreen(&#39; + index + &#39;)&#34;&gt;Open in Fullscreen Mode&lt;/button&gt;&amp;nbsp;&lt;strong&gt;Tip:&lt;/strong&gt; Press the &#34;Esc&#34; key to exit full screen.&lt;br&gt;&#39;).insertBefore(this); }); }); function openFullscreen(index) { var elem = document.getElementsByClassName(&#34;fullscreenframe&#34;)[index]; if (elem.requestFullscreen) { elem.requestFullscreen(); } else if (elem.webkitRequestFullscreen) { /* Safari */ elem.webkitRequestFullscreen(); } else if (elem.msRequestFullscreen) { /* IE11 */ elem.msRequestFullscreen(); } } </code></pre> </answer> <answer tick="false" vote="0"> <p>为什么不整合 jQuery?</p> <pre><code>const fullScreen = element =&gt; element.requestFullScreen(); // all modern browsers $(function(){ $(&#34;.node--view-mode-full iframe[src*=&#39;.pdf&#39;]&#34;).each(function (index) { $(this).addClass(&#39;fullscreenframe&#39;); $(this).attr(&#39;id&#39;, &#39;fullscreen-&#39;+index); $(&#39;&lt;button class=&#34;fullScreen&#34;&gt;Open in Fullscreen Mode&lt;/button&gt;&amp;nbsp;&lt;strong&gt;Tip:&lt;/strong&gt; Press the &#34;Esc&#34; key to exit full screen.&lt;br&gt;&#39;).insertBefore(this); }); $(&#34;.fullScreen&#34;).on(&#34;click&#34;, function() { const $iFrame = $(this).closest(&#39;p&#39;).find(&#39;iframe.fullscreenframe&#39;); if ($iFrame) fullScreen($iFrame.get(0)); // pass the DOM element }); }); </code></pre> </answer> </body></html>


如何在 JavaScript 中转义 XML 实体?

在 JavaScript(服务器端 NodeJS)中,我正在编写一个生成 XML 作为输出的程序。 我通过连接字符串来构建 XML: str += '<' + key + '>'; str += 值; str += ' 在 JavaScript(服务器端 NodeJS)中,我正在编写一个生成 XML 作为输出的程序。 我通过连接字符串来构建 XML: str += '<' + key + '>'; str += value; str += '</' + key + '>'; 问题是:如果value包含'&'、'>'或'<'等字符怎么办? 逃离这些角色的最佳方法是什么? 或者是否有任何 JavaScript 库可以转义 XML 实体? 对于相同的结果,这可能会更有效一些: function escapeXml(unsafe) { return unsafe.replace(/[<>&'"]/g, function (c) { switch (c) { case '<': return '&lt;'; case '>': return '&gt;'; case '&': return '&amp;'; case '\'': return '&apos;'; case '"': return '&quot;'; } }); } HTML 编码只是将 &、"、'、< 和 > 字符替换为其实体等效项。顺序很重要,如果您不首先替换 & 字符,您将对某些实体进行双重编码: if (!String.prototype.encodeHTML) { String.prototype.encodeHTML = function () { return this.replace(/&/g, '&amp;') .replace(/</g, '&lt;') .replace(/>/g, '&gt;') .replace(/"/g, '&quot;') .replace(/'/g, '&apos;'); }; } 如@Johan B.W. de Vries 指出,这会对标签名称产生问题,我想澄清一下,我假设这是用于 value only 相反,如果您想解码 HTML 实体1,请确保在完成其他操作之后将 &amp; 解码为 &,这样就不会双重解码任何实体: if (!String.prototype.decodeHTML) { String.prototype.decodeHTML = function () { return this.replace(/&apos;/g, "'") .replace(/&quot;/g, '"') .replace(/&gt;/g, '>') .replace(/&lt;/g, '<') .replace(/&amp;/g, '&'); }; } 1只是基础知识,不包括&copy;到©或其他类似的东西 就图书馆而言。 Underscore.js(或 Lodash,如果您愿意)提供了一个 _.escape 方法来执行此功能。 如果您有 jQuery,这里有一个简单的解决方案: String.prototype.htmlEscape = function() { return $('<div/>').text(this.toString()).html(); }; 像这样使用它: "<foo&bar>".htmlEscape(); -> "&lt;foo&amp;bar&gt" 您可以使用以下方法。我已将其添加到原型中以便于访问。 我还使用了负前瞻,因此如果您调用该方法两次或更多次,它不会弄乱事情。 用途: var original = "Hi&there"; var escaped = original.EncodeXMLEscapeChars(); //Hi&amp;there 解码由 XML 解析器自动处理。 方法: //String Extenstion to format string for xml content. //Replces xml escape chracters to their equivalent html notation. String.prototype.EncodeXMLEscapeChars = function () { var OutPut = this; if ($.trim(OutPut) != "") { OutPut = OutPut.replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"); OutPut = OutPut.replace(/&(?!(amp;)|(lt;)|(gt;)|(quot;)|(#39;)|(apos;))/g, "&amp;"); OutPut = OutPut.replace(/([^\\])((\\\\)*)\\(?![\\/{])/g, "$1\\\\$2"); //replaces odd backslash(\\) with even. } else { OutPut = ""; } return OutPut; }; 注意,如果 XML 中有 XML,那么所有的正则表达式都不好。 相反,循环字符串一次,并替换所有转义字符。 这样,您就不能两次碰到同一个角色。 function _xmlAttributeEscape(inputString) { var output = []; for (var i = 0; i < inputString.length; ++i) { switch (inputString[i]) { case '&': output.push("&amp;"); break; case '"': output.push("&quot;"); break; case "<": output.push("&lt;"); break; case ">": output.push("&gt;"); break; default: output.push(inputString[i]); } } return output.join(""); } 我最初在生产代码中使用了已接受的答案,发现大量使用时它实际上非常慢。这是一个更快的解决方案(以两倍以上的速度运行): var escapeXml = (function() { var doc = document.implementation.createDocument("", "", null) var el = doc.createElement("temp"); el.textContent = "temp"; el = el.firstChild; var ser = new XMLSerializer(); return function(text) { el.nodeValue = text; return ser.serializeToString(el); }; })(); console.log(escapeXml("<>&")); //&lt;&gt;&amp; 也许你可以试试这个, function encodeXML(s) { const dom = document.createElement('div') dom.textContent = s return dom.innerHTML } 参考 添加 ZZZZBov 的答案,我发现这更干净,更容易阅读: const encodeXML = (str) => str .replace(/&/g, '&amp;') .replace(/</g, '&lt;') .replace(/>/g, '&gt;') .replace(/"/g, '&quot;') .replace(/'/g, '&apos;'); 此外,所有五个字符都可以在这里找到,例如:https://www.sitemaps.org/protocol.html 请注意,这仅对值进行编码(如其他人所述)。 现在我们有了字符串插值和其他一些现代化改进,现在是时候进行更新了。并使用对象查找,因为它确实应该这样做。 const escapeXml = (unsafe) => unsafe.replace(/[<>&'"]/g, (c) => `&${({ '<': 'lt', '>': 'gt', '&': 'amp', '\'': 'apos', '"': 'quot' })[c]};`); 从技术上讲,&、 不是有效的 XML 实体名称字符。如果您不能信任关键变量,则应该将其过滤掉。 < and >如果您希望它们作为 HTML 实体转义,您可以使用类似 http://www.strictly-software.com/htmlencode . 如果之前有东西被逃脱,你可以尝试这个,因为这不会像许多其他人那样双重逃脱 function escape(text) { return String(text).replace(/(['"<>&'])(\w+;)?/g, (match, char, escaped) => { if(escaped) { return match; } switch(char) { case '\'': return '&apos;'; case '"': return '&quot;'; case '<': return '&lt;'; case '>': return '&gt;'; case '&': return '&amp;'; } }); } 这很简单: sText = ("" + sText).split("<").join("&lt;").split(">").join("&gt;").split('"').join("&#34;").split("'").join("&#39;");


MAUI 8 - 如何更改弹出背景叠加颜色?

使用 MAUI 7.0,下一个代码允许更改弹出背景叠加颜色,但该代码不适用于 MAUI 8.0 使用 MAUI 7.0,下一个代码允许更改弹出窗口背景覆盖颜色,但该代码不适用于 MAUI 8.0 <maui:MauiWinUIApplication x:Class="TestMaui8.WinUI.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:maui="using:Microsoft.Maui" xmlns:local="using:TestMaui8.WinUI"> <maui:MauiWinUIApplication.Resources> <Color x:Key="SystemAltMediumColor">Transparent</Color> <SolidColorBrush x:Key="SystemControlPageBackgroundMediumAltMediumBrush" Color="{StaticResource SystemAltMediumColor}" /> <SolidColorBrush x:Key="ContentDialogBackgroundThemeBrush" Color="{StaticResource SystemAltMediumColor}" /> <SolidColorBrush x:Key="ContentDialogDimmingThemeBrush" Color="{StaticResource SystemAltMediumColor}" /> <StaticResource x:Key="ContentDialogBackground" ResourceKey="SystemControlPageBackgroundMediumAltMediumBrush" /> <StaticResource x:Key="PopupLightDismissOverlayBackground" ResourceKey="SystemControlPageBackgroundMediumAltMediumBrush" /> <SolidColorBrush x:Key="SliderBorderBrush" Color="#1A73E8" /> <Style TargetType="Slider"> <Setter Property="BorderBrush" Value="{StaticResource SliderBorderBrush}"/> </Style> </maui:MauiWinUIApplication.Resources> </maui:MauiWinUIApplication> 有人知道为什么它不起作用以及如何修复它吗? 更新添加一些图片 CommunityToolkit Popup 没有 Overlay color 功能。您可以在 CommunityToolkit GitHub 页面上提出功能请求。 是的,您发布的上述代码曾经可以工作,但它不适用于具有最新 CommunityToolkit.Maui nuget 的 .NET8。 但是如果您想更改叠加颜色,这里有一个解决方法。 <toolkit:Popup xmlns="http://schemas.microsoft.com/dotnet/2021/maui" ... Color="Black" xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit" > //make the size to be the full screen size <ContentView WidthRequest="1920" HeightRequest="1080"> <VerticalStackLayout WidthRequest="300" HeightRequest="300" BackgroundColor="Green"> <Image Source="dotnet_bot.png"/> <Label Text="Welcome to .NET MAUI!" VerticalOptions="Center" HorizontalOptions="Center" /> </VerticalStackLayout> </ContentView> </toolkit:Popup>


© www.soinside.com 2019 - 2024. All rights reserved.