我需要实现EM_SETCUEBANNER的功能,其中文本提示出现在Edit控件中:

问题是我无法使用通用控件的第6版,这是获得Microsoft提供的cue横幅实现所需的.
我已经研究过简单地改变编辑控件的文本和字体格式
Dark Gray Italic Text
Run Code Online (Sandbox Code Playgroud)
但它会抛出Change事件(由更高的组件库提供的组件包装器),我无法找到避免的方法.
所以我改为自定义绘制文本,在控件未聚焦且为空时绘制Cue Banner文本,否则依赖默认绘制.
Edit控件不能很好地公开自定义绘图机制,如ListView,TreeView和其他提供的.
其他人已经研究过它,但这似乎是一项几乎不可能完成的任务:
从事情的方式来看,我将不得不处理以下消息:
- WM_ERASEBKGND,WM_PAINT(原因很明显)
- WM_SETFOCUS,WM_KILLFOCUS(防止白条显示 - 如上所述)
- WM_CHAR(处理和更新控件中的文本)
而且我还需要找到一种在控件中显示插入符号的方法,因为我还没有找到一种方法允许Windows为我这样做而不用画我提到的白条.
这将会非常好玩.:翻白眼:
鉴于Windows Edit控件从未打算自定义绘制:有没有人知道如何自定义绘制Windows编辑控件?
注意:我也会接受解决问题的答案,而不是回答我的问题.但是其他任何想要自定义绘制编辑控件的人,遇到这个问题,都可能会有一个答案.
我想通过execve在C程序中调用一个shell:
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
main()
{
char* path = "/bin/sh";
int err = execve(path, &path, NULL);
printf("%d\n", err);
printf("%s\n", strerror(errno));
printf("%x, %x\n", path, &path);
}
Run Code Online (Sandbox Code Playgroud)
但输出是:
-1
Bad address
80485c0, bf816f4c
Run Code Online (Sandbox Code Playgroud) 我正在尝试编写一个简单的程序来比较单独文件夹中的文件.我目前正在使用LINQ to Objects来解析文件夹,并希望在我的结果集中包含从字符串中提取的信息.
这是我到目前为止所拥有的:
FileInfo[] fileList = new DirectoryInfo(@"G:\Norton Backups").GetFiles();
var results = from file in fileList
orderby file.CreationTime
select new { file.Name, file.CreationTime, file.Length };
foreach (var x in results)
Console.WriteLine(x.Name);
Run Code Online (Sandbox Code Playgroud)
这会产生:
AWS025.sv2i
AWS025_C_Drive038.v2i
AWS025_C_Drive038_i001.iv2i
AWS025_C_Drive038_i002.iv2i
AWS025_C_Drive038_i003.iv2i
AWS025_C_Drive038_i004.iv2i
AWS025_C_Drive038_i005.iv2i
...
Run Code Online (Sandbox Code Playgroud)
我想修改LINQ查询,以便:
_C_Drive038上面的示例中,但038 驱动器号可能会更改)._i0XX文件名末尾没有),我想要包含一个字段.038).001的增量(例如,将是增量编号)我相信查询的基本布局如下所示,但我不确定如何最好地完成它(我有一些关于如何做到这一点的想法,但我有兴趣听到其他人如何可能会这样做):
var results = from file in fileList
let IsMainBackup = \\ ??
let ImageNumber = \\ ??
let IncrementNumber = \\ ??
where …Run Code Online (Sandbox Code Playgroud) 我想知道如何做到这一点,我目前的标记如下:
<div id="playArea" style="position: relative;">
<div id="widget1" class="widget" style="position: absolute; left: 295px; top: -1px; width: 313px; height: 269px;">Hello</div>
<div id="widget2" class="widget" style="position: absolute; left: 63px; top: 35px; width: 80px; height: 42px;">World</div>
<div style="position: absolute; left: 534px; top: 329px; width: 183px; height: 251px;">Bye</div>
</div>
Run Code Online (Sandbox Code Playgroud)
现在,如果我在最后一个之后创建一个段落标记,则标记</div>的内容p不会出现在浏览器中的所有这些div下面.我有什么想法可以做到这一点?
多谢你们
我们正在为C#项目评估IoC容器,Unity和Castle.Windsor都很突出.我喜欢Unity的一件事(NInject和StructureMap也这样做)是明显如何构造它们的类型不必在IoC容器中注册.
有没有办法在Castle.Windsor做到这一点?我对Castle很公平.温莎要说它不这样做吗?有没有设计理由故意不这样做,或者是疏忽,还是只是没有被视为重要或有用?
我知道container.Register(AllTypes...在温莎,但这不是一回事.它不是完全自动化的,而且非常广泛.
为了说明这一点,这里有两个NUnit测试通过Unity和Castle.Windsor做同样的事情.Castle.Windsor失败了.:
namespace SimpleIocDemo
{
using NUnit.Framework;
using Castle.Windsor;
using Microsoft.Practices.Unity;
public interface ISomeService
{
string DoSomething();
}
public class ServiceImplementation : ISomeService
{
public string DoSomething()
{
return "Hello";
}
}
public class RootObject
{
public ISomeService SomeService { get; private set; }
public RootObject(ISomeService service)
{
SomeService = service;
}
}
[TestFixture]
public class IocTests
{
[Test]
public void UnityResolveTest()
{
UnityContainer container = new UnityContainer();
container.RegisterType<ISomeService, ServiceImplementation>();
// Root object needs no registration …Run Code Online (Sandbox Code Playgroud) .net castle-windsor ioc-container inversion-of-control unity-container
背景:
我将研究依赖于快速变化的API和快速变化的数据模型的工具,我将无法控制这些模型.
数据模型和API更改很常见,这里的问题是我的代码必须继续使用当前版本和所有过去的版本(即100%后缀兼容性),因为所有内容都将继续使用.
当它遇到缺失/未知功能等时,它也必须优雅地降级.
这些工具将使用WinForms在C#中编写,用于测试自定义硬件.
<Edit>
Run Code Online (Sandbox Code Playgroud)
我的目标是接近于只需要创建类来添加功能,当数据模型发生变化时,创建一组新的数据模型类,这些类将由工厂基于API版本创建.
我面临的挑战是,未来的功能可能取决于具体的数据模型,这些模型可以混合和匹配(直到达到最终的组合).你怎么会优雅地处理这件事?
<Edit2>
Run Code Online (Sandbox Code Playgroud)
当然,一旦产品发货,我想重复使用该工具,只需为新产品添加代码.在我开始之前,每个产品周期都意味着重写(从头开始)所有工具,我打算在将来防止这种工具:)
</Edit>
Run Code Online (Sandbox Code Playgroud)
问题:
为了保持与多个版本的API /数据模型的兼容性,您会建议或成功使用哪些设计技术和模式?
我应该注意哪些陷阱?
我真的很困惑.我经常使用Eclipse IDE,现在我不明白发生了什么.
我刚刚下载了最新的Eclipse分发版,无法启动它.在IDE加载之前,我收到以下消息框:
---------------------------
Eclipse
---------------------------
JVM terminated. Exit code=-1
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
-XX:MaxPermSize=256m
-Djava.class.path=D:\eclipse\plugins/org.eclipse.equinox.launcher_1.0.200.v20090520.jar
-os win32
-ws win32
-arch x86
-showsplash D:\eclipse\\plugins\org.eclipse.platform_3.3.200.v200906111540\splash.bmp
-launcher D:\eclipse\eclipse.exe
-name Eclipse
--launcher.library D:\eclipse\plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519\eclipse_1206.dll
-startup D:\eclipse\plugins/org.eclipse.equinox.launcher_1.0.200.v20090520.jar
-product org.eclipse.epp.package.jee.product
-vm C:\Program Files\Java\jre6\bin\client\jvm.dll
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
-XX:MaxPermSize=256m
-Djava.class.path=D:\eclipse\plugins/org.eclipse.equinox.launcher_1.0.200.v20090520.jar
---------------------------
??
---------------------------
Run Code Online (Sandbox Code Playgroud)
我找不到任何其他日志.我没有改变或修改任何东西.刚刚解压缩了存档.
最初我的eclipse.ini是:
-startup
plugins/org.eclipse.equinox.launcher_1.0.200.v20090520.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-product
org.eclipse.epp.package.jee.product
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
Run Code Online (Sandbox Code Playgroud)
我认为参数的名称和值之间的这个新行存在问题.所以我删除了新行(但根据这个,它实际上是一个错误的举动).所以我的eclipse.ini现在看起来像这样,我可以运行它:
-startup plugins/org.eclipse.equinox.launcher_1.0.200.v20090520.jar
--launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-product org.eclipse.epp.package.jee.product
--launcher.XXMaxPermSize 256M
-showsplash org.eclipse.platform
--launcher.XXMaxPermSize 256m …Run Code Online (Sandbox Code Playgroud) 使用Java Keytool实用程序构建密钥库时,密钥如何受到保护?我已经阅读了文档,并且我意识到每个私钥都有一个密钥密码,然后商店有一个商店密码.
但是用什么机制来保护数据呢?它是加密密码吗?如果是这样,算法是什么?我特别关注keytool在构建JKS文件时如何进行保护.
这个问题与另一个问题@SuperUser有关.
我想下载TED演讲和相应的字幕以供离线观看,例如让我们采取Richard St. John的简短演讲,高分辨率视频下载URL如下:
各个JSON编码的英文字幕可以在以下位置下载:
这是从实际字幕的开头除外:
{"captions":[{"content":"This is really a two hour presentation I give to high school students,","startTime":0,"duration":3000,"startOfParagraph":false},{"content":"cut down to three minutes.","startTime":3000,"duration":1000,"startOfParagraph":false},{"content":"And it all started one day on a plane, on my way to TED,","startTime":4000,"duration":3000,"startOfParagraph":false},{"content":"seven years ago."
Run Code Online (Sandbox Code Playgroud)
从副标题的结尾:
{"content":"Or failing that, do the eight things -- and trust me,","startTime":177000,"duration":3000,"startOfParagraph":false},{"content":"these are the big eight things that lead to success.","startTime":180000,"duration":4000,"startOfParagraph":false},{"content":"Thank you TED-sters for all your interviews!","startTime":184000,"duration":2000,"startOfParagraph":false}]}
Run Code Online (Sandbox Code Playgroud)
我想写一个应用程序,自动下载视频的高分辨率版本和所有可用的字幕,但我真的很难,因为我必须将字幕转换为(VLC或任何其他体面的视频播放器) …
我在我的应用程序中嵌入了一个字体作为EmbeddedResource,并希望在文本框中使用它.AddMemoryFont帮助说我必须将兼容的文本渲染设置为true才能使用GDI +,这样我的字体就可以使用,但不知怎的,它只是不会显示正确的字体.
在Program.cs中我明确说明:Application.SetCompatibleTextRenderingDefault(true);
那么为什么它不起作用?有人知道吗?