我读过很多属于这个的问题.但我的问题没有什么不同,我需要做的只是剪切图像
并且仅显示邮件项而不是该邮件图片.我使用了以下代码,但它只是裁剪右侧而不是左侧.请帮帮我.注意:图片只是从谷歌图片获取它的一个例子
Bitmap croppedBitmap = new Bitmap("E:/my234.png");
try
{
croppedBitmap = croppedBitmap.Clone(new Rectangle(0,0,202, 17), System.Drawing.Imaging.PixelFormat.DontCare);
pictureBox1.Image = croppedBitmap;
}
catch(Exception ex)
{ string se = ex.ToString(); }
Run Code Online (Sandbox Code Playgroud)
.谢谢你提前
我正在使用Geckfx22.0
和xulrunner22.0
.由于.Net中的GeckoWebBrowser与GeckoWebBrowsers的所有其他实例共享cookie,我希望GeckoWebBrowser拥有它自己的cookie容器,该容器不共享之前在其他GeckoWebBrowsers或其他实例中创建的任何cookie.
例如,当我创建GeckoWebBrowser时,它不应该有任何cookie.当我运行2个GeckoWebBrowser实例时,他们拥有自己的cookie容器,并且不会彼此共享或冲突cookie.
怎么可能?
我通过创建不同的类和启动尝试了各种可能的方法,geckofx
但是当同时运行不同的浏览器时,它在其他浏览器之间共享cookie.如果我从一个浏览器中删除cookie,其他浏览器也会发生同样的情况.我已经在不同的时间和它的作品发起了proxy
,useragent
但不能同时为多个浏览器应用各种用户.
public void Initiate()
{
Gecko.Xpcom.Initialize(AppDomain.CurrentDomain.BaseDirectory + "/xulrunner");
if (this.IsProxySet)
{
Gecko.GeckoPreferences.User["network.proxy.http"] = this.Host;
Gecko.GeckoPreferences.User["network.proxy.http_port"] = this.Port;
Gecko.GeckoPreferences.User["network.proxy.type"] = 1;
}
if (IsUseragentSet)
{
Gecko.GeckoPreferences.User["general.useragent.override"] = this.Useragent;
}
}
Run Code Online (Sandbox Code Playgroud)
并删除cookie我正在使用以下代码:
nsICookieManager CookieMan;
CookieMan = Xpcom.GetService<nsICookieManager>("@mozilla.org/cookiemanager;1");
CookieMan = Xpcom.QueryInterface<nsICookieManager>(CookieMan);
CookieMan.RemoveAll();
Run Code Online (Sandbox Code Playgroud)
帮助将不胜感激!
所以我已经使用了很多组件进行了设置,并且我经常更新此设置,因此我的用户必须重新下载新版本并且总是遇到这个恼人的通知窗口:喜欢,
只要它很小就可以,但是当我有一个很长的组件列表,并且我经常使用它时,那么这个窗口太高了,如果有人的屏幕分辨率很低,就无法移动甚至关闭.这有一个很大的问题.
我的问题很简单:如何禁用此窗口,或使其不会从Windows桌面区域伸出?
我正在尝试加载文档NSData
(它来自Dropbox
我的应用程序中的文件,但为了简单起见,下面的示例使用.txt文件,这导致我正在尝试解决的相同问题).
问题:我实例化一个NSDictionary,并将其[NSAttributedString -initWithData:options:documentAttributes:error:]
作为out参数传递给它.
但是,NSDictionary实例被取消分配,并导致-initWithData:options:documentAttributes:error:崩溃.
当我启用时NSZombie
,我得到的错误是:[_ _ NSDictionaryI retain]:发送到解除分配的实例的消息
- initWithData:options:documentAttributes:error:
当我将NULL传递给documentAttributes时运行正常.
这是代码:
NSError* error;
NSString* path = [[NSBundle mainBundle] pathForResource:@"Forward Thinking"
ofType:@"txt"];
NSData* data = [NSData dataWithContentsOfFile:path options:NSDataReadingMappedAlways error:&error];
if (data) {
dispatch_async(dispatch_get_main_queue(), ^{
NSDictionary* documentAttributes = [[NSDictionary alloc] init];
NSAttributedString* attrStr = [[NSAttributedString alloc] initWithData:data options:nil documentAttributes:&documentAttributes error:NULL];
self.textView.attributedText = attrStr;
});
}
Run Code Online (Sandbox Code Playgroud)
任何线索都会很棒!
如何对包含不同案例类的两个列表进行分组,但两个类都有相同的字段:
case class X(a:Long, b:Long, c:Long, d:Long)
case class Y(a:Long, e:Long, f :Long)
val i = List(X(10,10,8,8))
val j = List(Y(10,10,8))
val joined = a++b
joined.groupBy(_.a)
Run Code Online (Sandbox Code Playgroud)
错误:值a不是具有Serializable的Product的成员
谢谢
我知道如何使用以下代码替换段落或文本文件中的另一个特定单词:
String output = input.Replace("oldvalue","newvalue");
Run Code Online (Sandbox Code Playgroud)
但我混淆了更换替换词组.我有近1000个单词要替换.例如:
" aback " => " ashamed ",
" abacus " => " abacus ",
" abaft " => " aback ",
" abandon " => " carelessness ",
" abandoned " => " alone ",
Run Code Online (Sandbox Code Playgroud)
因此,如果段落包含aback
我想用ashamed
每个单词替换它的单词.我们怎么做?谁能给我一个想法?