我在c#中开发windowform应用程序.
在我的应用程序中,我写了下面的代码来从本地机器获取所有图像并打印它.
files = Directory.GetFiles(@"C:\temp", "*.jpeg");
foreach (var i in files)
{
var objPrintDoc = new PrintDocument();
objPrintDoc.PrintPage += (obj, eve) =>
{
System.Drawing.Image img = System.Drawing.Image.FromFile(i);
Point loc = new Point(100, 100);
eve.Graphics.DrawImage(img, loc);
};
objPrintDoc.Print();
}
Run Code Online (Sandbox Code Playgroud)
现在我想检查该打印是否已成功完成,然后我想删除我手动创建的临时文件夹以存储图像.
我试过下面的代码,但它对我不起作用.
PrintServer myPrintServer;
PrintQueueCollection myPrintQueues = myPrintServer.GetPrintQueues();
String printQueueNames = "My Print Queues:\n\n";
foreach (PrintQueue pq in myPrintQueues)
{
printQueueNames += "\t" + pq.Name + "\n";
}
Run Code Online (Sandbox Code Playgroud)
请让我们知道我的问题,并做所需.
谢谢,PRASHANT
我正在为我的网站使用第三方支付网关.
一旦客户填写了金额详细信息和联系人详细信息,页面将被重定向到其他.asp页面.
在那个asp页面中,我写了下面的代码.
Dim pipe
Set pipe = Server.CreateObject("e24PaymentPipe.e24PaymentPipe.1")
pipe.ResourcePath=resourcePath 'mandatory
pipe.Alias=aliasName 'mandatory
pipe.Action=action 'mandatory
pipe.ResponseURL=receiptURL 'mandatory
pipe.ErrorURL=errorURL 'mandatory
pipe.Amt=amount 'mandatory
pipe.Currency=curr
pipe.Language=language
pipe.TrackId=trackId
pipe.Udf1=donateamt
pipe.Udf2=email
pipe.Udf3=phone
pipe.Udf4=baddress
pipe.Udf5=fname
Run Code Online (Sandbox Code Playgroud)
但我只在第二行得到错误.错误说,无法创建Activex对象.
我已经成功注册了e24paymentpipe.dll,但我仍然收到错误.
谁能帮帮我吗..?
我想使用c#从多个图像创建动画gif图像,因此我在github解决方案下使用了该方法。
https://github.com/DataDink/Bumpkit
我正在使用下面的代码来做到这一点
using (var gif = File.OpenWrite(@"C:\IMG_TEST.gif"))
using (var encoder = new GifEncoder(gif))
for (int i = 0, count = imageFilePaths.Length; i < count; i++)
{
Image image = Image.FromFile(imageFilePaths[i]);
encoder.AddFrame(image,0,0);
}
Run Code Online (Sandbox Code Playgroud)
它的工作原理就像一种魅力,但它创建的gif大小为45 MB。如果我检查我的实际图像大小,则总共11张图像只有11MB。但是以某种方式生成的gif尺寸很大。
现在,我想压缩使用c#创建的gif图像的大小。
所以有什么办法可以压缩gif图像的大小?
我已将 GitHub 解决方案用于URLshortener并将其部署在我的 Azure 租户上。现在突然我收到一个错误:
"Exception while executing function: Functions.UrlIngest.
Microsoft.Azure.WebJobs.Host: Error while handling parameter keyTable after
function returned:. Microsoft.WindowsAzure.Storage: The remote server
returned an error: (412) Precondition Failed."
Run Code Online (Sandbox Code Playgroud)
在研究这个问题时,我找到了一个链接,上面写着:
"If the entity's ETag differs from that specified with the update request,
the update operation fails with status code 412 (Precondition Failed). This
error indicates that the entity has been changed on the server since it was
retrieved. To resolve this error, retrieve the entity again …Run Code Online (Sandbox Code Playgroud) azure optimistic-concurrency azure-table-storage azure-functions
我想使用客户端对象模型(C#)在SharePoint文档库上创建文件夹.下面是执行此操作的代码.
ContentTypeCollection listContentTypes = list.ContentTypes;
clientContext.Load(listContentTypes, types => types.Include
(type => type.Id, type => type.Name,
type => type.Parent));
var result = clientContext.LoadQuery(listContentTypes.Where(c => c.Name == "Folder"));
clientContext.ExecuteQuery();
ContentType folderContentType = result.FirstOrDefault();
ListItemCreationInformation newItemInfo = new ListItemCreationInformation();
newItemInfo.UnderlyingObjectType = FileSystemObjectType.Folder;
newItemInfo.LeafName = Foldername;
ListItem newListItem = list.AddItem(newItemInfo);
newListItem["ContentTypeId"] = folderContentType.Id.ToString();
newListItem["Title"] = Foldername;
ewListItem.Update();
clientContext.Load(list);
clientContext.ExecuteQuery();
Run Code Online (Sandbox Code Playgroud)
现在我在库上创建了数千个文件夹.那么有什么其他方法我可以使用批量操作来做到这一点,所以客户端到服务器的连接只会被调用一次.
问题是创建文件夹需要花费太多时间,因为对于每个文件夹,它都会调用SharePoint对象.
我正在开发Excel 2013的加载项,我在Excel加载项中创建了一个函数,如下所示
public string ExcelReturnString()
{
return "This is the string: hi";
}
Run Code Online (Sandbox Code Playgroud)
我使用下面的代码来调用函数,但它会抛出一个错误.
Application.Run(ExcelReturnString)
Run Code Online (Sandbox Code Playgroud)
如何在宏中调用外接功能?
我想使用C#将活动目录用户从一个组织单位移动到另一个组织单位。
我在下面提到了链接
并尝试下面的代码,但会引发错误
DirectoryEntry eLocation = new DirectoryEntry("LDAP://CN=Test User,OU=Users,OU=Development,DC=domain,DC=com");
DirectoryEntry nLocation = new DirectoryEntry("LDAP://OU=Users,OU=QC,DC=domain,DC=com");
eLocation.MoveTo(nLocation);
Run Code Online (Sandbox Code Playgroud)
上面的代码抛出错误
A referral was returned from the server.
Error code: -2147016661
Extended Error Message 0000202B: RefErr: DSID-0310082F, data 0, 1 access points
ref 1: 'domain.com'
Run Code Online (Sandbox Code Playgroud) 您好我是使用以下代码从ASP页面发送邮件
Dim MyMail
Set MyMail = Server.CreateObject("JMail.SMTPMail")
MyMail.ServerAddress = ""
MyMail.Sender = "senderemail"
MyMail.AddRecipient "mail@mail.com"
MyMail.Subject = "Inquiry "
MyMail.Body = "<p>This is a response</p>"
MyMail.ContentType = "text/html"
MyMail.Execute
Set MyMail=nothing
Run Code Online (Sandbox Code Playgroud)
但它没有用.我收到了以下错误
Microsoft VBScript运行时错误"800a01ad"ActiveX组件无法创建对象
谁能帮帮我吗
我有一个包含一些数据的表,如下所示.

我想从表中获取唯一数据,我尝试了下面的代码
SELECT
sa.EMPID,
sa.EMPNAME,
sa.DEPTID
FROM dbo.Sample AS sa
LEFT OUTER JOIN dbo.Sample AS se ON sa.EMPID = se.EMPID
Run Code Online (Sandbox Code Playgroud)
但无法得到结果.
我希望查询得到以下数据

任何人都可以帮我解决这个问题..?
c# ×5
asp-classic ×2
.net ×1
animated-gif ×1
animation ×1
azure ×1
excel ×1
excel-addins ×1
excel-vba ×1
gif ×1
image ×1
jmail ×1
printing ×1
sharepoint ×1
sql ×1
sql-server ×1
vba ×1
vbscript ×1
winforms ×1