解决方案 »
- 问个语法的,static
- 高手眼中的小问题
- 输入问题?
- 如果手工在资源文件中加入一些内容后,再修改这个窗体,手工加的会丢失,请问有什么好办法解决吗?
- 请问那位知道在C#中如何如用验证码?????????????????
- 怎么样让自己新生成的窗体在自己做的应用程序的最前面?
- 求助,我想请问一下CSDN这个版面如何做出来的?有源代码吗?
- unhandled exception has occurred in your application
- 有请Stdotleo近来拿分
- 做一个大的酒店管理软件,点菜的时候通过手持设备,现在想通过无线传输直接传数据,怎么实现!(100分)
- 请教大家 c#中如何建一个类可以在两个buton_click中运用?
- 在实现类继承时遇到的一个问题,大家来看看
private Image CreateImage()
{
Image img2 = null;
object o = this.Tag;
Seal.BLL.DynamicImage bllimm = new Seal.BLL.DynamicImage();
List<Seal.Model.DynamicImage> modelimglist = new List<Seal.Model.DynamicImage>();
if (o == null)
{
return img2;
}
modelimglist = bllimm.GetModelForSealID(int.Parse(o.ToString()));
Seal.BLL.SealInfo bllSealInfo = new Seal.BLL.SealInfo();
Seal.Model.SealInfo modelSeal = bllSealInfo.GetModel(int.Parse(o.ToString()));
Bitmap bit = null;
Image img = CustomControls.ImageFormat.ReturnPhoto(modelSeal.SealImage);
bit = new Bitmap(img);
Graphics g = Graphics.FromImage(bit);
//设置高质量插值法
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
//设置高质量呈现平滑程度
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
//清空画布并以透明背景色填充
g.Clear(System.Drawing.Color.Transparent);
g.DrawImage(img, new Point(0, 0)); foreach (Seal.Model.DynamicImage item in modelimglist)
{
int xpoint = int.Parse(item.SealPoint.Substring(0, item.SealPoint.LastIndexOf(",")));
int ypoint = int.Parse(item.SealPoint.Substring(item.SealPoint.LastIndexOf(",") + 1));
if (xpoint < 0)
{
xpoint = 0;
} if (ypoint < 0)
{
ypoint = 0;
}
Rectangle r = new Rectangle(xpoint, ypoint, (int)item.SealWidth, (int)item.SealHeight);
if (item.SealFontSize != null)
{
Font f = new Font(item.SealFont, (float)item.SealFontSize);
if (item.IsUp == false && item.Angle != null)
{
Point centerPoint = new Point(r.X + r.Width / 2, r.Y + r.Height / 2);
PaintOneText(g, f, centerPoint, (float)r.X, (float)r.Y, (float)item.Angle, (float)item.TopMargin, DateTime.Now.ToString("yyyy.MM.dd"), item.IsUp, (float)r.Height, (float)r.Width);
}
else
{ Random ran = new Random();
int temp = ran.Next(10000000, 99999999);
StringFormat format = new StringFormat();
format.Alignment = StringAlignment.Center;
g.DrawString(temp.ToString(), f, Brushes.Black, r, format);
} }
if (item.LineWidth > 0)
{
int num = (int)item.LineStyle;
g.DrawRectangle(new Pen(Brushes.Black, (int)item.LineWidth), r);
}
}
return ImageFormat.toBitmap(bit, 160);
}