在同一命名空间下添加子窗体,选择类型为windows窗体
控件splitcontainercontrol:控件使用1 控件使用2
dock属性设置为fill可以实现窗体的填充
嵌套使用效果很不错:(三重嵌套)
Fixedpanel属性设置为None,可以窗口大小改变后保持控件分割比例
控件label常用属性参考:label常用属性
label设置文字居中方法:C# Winform label自定义大小与居中
总结分一下三步:
1.将AutoSize属性设置为False;
2.将Dock属性设置为Fill;
3.将TextAlign属性设置为居中。
控件属性总结到位:
dock停靠
anchor锚定
//设置树节点显示复选框
this.treeList1.OptionsView.ShowCheckBoxes = true;
如何使图片大小适应pictureBox的大小
if (mOrgImgCpy != null)
{
Bitmap bm = new Bitmap(mOrgImgCpy, pictureBox1.Width, pictureBox1.Height);
pictureBox1.Image = bm;
return;
}
条形码控件:control’s boundaries are too small for the barcode
利用Aspose.Pdf.Facades修改FDF,控件常用方法及属性:常用方法及属性
// adding image stamp
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(Resource1.esign_sample);
MemoryStream imagestream = new MemoryStream();
bmp.Save(imagestream, System.Drawing.Imaging.ImageFormat.Jpeg);
Aspose.Pdf.Facades.Stamp imageStamp = new Aspose.Pdf.Facades.Stamp();
imageStamp.BindImage(imagestream);
imageStamp.SetOrigin((float)lowerLeftX, (float)lowerLeftY);
imageStamp.SetImageSize((float)((xConversion * 2) / 0.9375), (float)(yConversion / 0.9375));
imageStamp.IsBackground = false;
imageStamp.Opacity = 1.0f;
stampCount++;
fileStamp.AddStamp(imageStamp);
// adding text stamp below image
Aspose.Pdf.Facades.Stamp textStamp = new Aspose.Pdf.Facades.Stamp();
Aspose.Pdf.Facades.FormattedText text = new Aspose.Pdf.Facades.FormattedText("Test text in stamp.", System.Drawing.Color.Black, System.Drawing.Color.White, Aspose.Pdf.Facades.FontStyle.TimesRoman, Aspose.Pdf.Facades.EncodingType.Cp1250, false, 12.0f);
textStamp.BindLogo(text);
textStamp.SetOrigin((float)lowerLeftX, (float)(lowerLeftY - (12.0f * stampCount) - (stampCount * 3)));
textStamp.Opacity = 1.0f;
textStamp.IsBackground = false;
stampCount++;
fileStamp.AddStamp(textStamp);
如何使图片大小适合picturebox大小?
子窗体下写一个函数:
public void picture_sizechange()
{
//一定判断一下imageSlider里面是否有图片,否则string filePath = fileName.ElementAt<string>(imageSlider1.CurrentImageIndex);这句会报索引超界的错
if (imageSlider1.CurrentImage == null)
{
pictureBox1.Image = null;
return;
}
string filePath = fileName.ElementAt<string>(imageSlider1.CurrentImageIndex);
mOrgImgCpy = Image.FromFile(@filePath);
if (mOrgImgCpy != null)
{
Bitmap bm = new Bitmap(mOrgImgCpy, pictureBox1.Width, pictureBox1.Height);
pictureBox1.Image = bm;
return;
}
}
在主窗体程序函数Form1_resize()里面调用子窗体的函数
sonForm2.picture_sizechange();
当然也不用这么麻烦,直接在picture1.resize()函数下面写也可以。之前在索引报错搞得有点烦。
通过改下图PDFVIEWER得属性来修改图片在picturebox的显示方式