我想同步调用后台工作程序.我希望执行代码在backgroundworker完成执行时结束.我的BackgroundWorker代码在这里:
{
BackgroundWorker worker = new BackgroundWorker();
worker.DoWork += DoWork;
worker.RunWorkerCompleted += RunWorkerCompleted;
...
worker.RunWorkerAsync();
//wait for execution to end
}
Run Code Online (Sandbox Code Playgroud)
一种方法是再次检查状态,直到执行完成,但有没有其他好的方法呢?
我想整理一个整数的arraylist的arraylist,我需要帮助?
我被告知我需要实现比较器或者类比,然后使用collection.sort按顺序对列表列表进行排序......
ArrayList<ArrayList<Integer>> g = new ArrayList<ArrayList<Integer>>()
If you look at the list of list as the following example:
C1 – 5,4,10
C2 – 3,2,1
C3 – 7,8,6
First it will be sorted like this:
C1 – 4,5,10
C2 – 1,2,3
C3 – 6,7,8
Then it will be sorted like this
C1 – 1,2,3
C2 – 4,5,6
C3 – 7,8,10
Run Code Online (Sandbox Code Playgroud) 所有,
我试图使用itextsharp在pdf中添加图像水印.水印按预期显示在所有页面上,但是已经有图像.我希望我的水印图像能够显示在pdf上的现有图像之上.我正在使用以下代码添加图像
using (Stream output = new FileStream(outputFile, FileMode.Create, FileAccess.Write, FileShare.None))
{
using (PdfStamper pdfStamper = new PdfStamper(pdfReader, output))
{
for (int pageIndex = 1; pageIndex <= pdfReader.NumberOfPages; pageIndex++)
{
pdfStamper.FormFlattening = false;
iTextSharp.text.Rectangle pageRectangle = pdfReader.GetPageSizeWithRotation(pageIndex);
PdfContentByte pdfData = pdfStamper.GetUnderContent(pageIndex);
pdfData.SetFontAndSize(BaseFont.CreateFont(BaseFont.HELVETICA_BOLD, BaseFont.CP1252, BaseFont.NOT_EMBEDDED), 10);
PdfGState graphicsState = new PdfGState();
graphicsState.FillOpacity = 0.4F;
pdfData.SetGState(graphicsState);
pdfData.BeginText();
iTextSharp.text.Image jpeg = iTextSharp.text.Image.GetInstance(wtrmrkimg, BaseColor.GREEN);
float width = pageRectangle.Width;
float height = pageRectangle.Height;
jpeg.ScaleToFit(width, height);
jpeg.SetAbsolutePosition(width / 2 - jpeg.Width / 2, height / 2 …Run Code Online (Sandbox Code Playgroud) 我想从double获取小数部分,这是我的代码来获取小数部分
double decimalvalue = 23423.1234-23423.0;
0.12340000000040163
Run Code Online (Sandbox Code Playgroud)
但减法后我期待十进制值为0.1234,但我得到0.12340000000040163.请帮助我理解这种行为,以及是否有任何解决方法.
我想将一行2d数组分配给1d数组,这就是我想要做的.
int words[40][16];
int arrtemp[16];
arrtemp=words[i];
我想从getelementbyid得到div但它不适合我这是我的代码
<body onload="ErrorCheck(-1)">
<script type="text/javascript">
function ErrorCheck(var1)
{
if(var1 = -1)
{ alert("in function");
var cont = document.getElementBId('msg');
if(cont==null){
alert("null");
}
else{
alert("not null");
}
}
}
</script>
<h1 class="header">Register</h1>
<div id="msg"></div>
</body>
Run Code Online (Sandbox Code Playgroud)
在调用getElementBId之后,这个函数变得死了,因为它不会转到任何if或else.请检查我在这里做错了什么
c# ×2
c++ ×2
arraylist ×1
arrays ×1
double ×1
itextsharp ×1
java ×1
javascript ×1
subtraction ×1