当前位置:编程学习 > C#/ASP.NET >>

System.Drawing 参数无效,发布项目进入平台提示此错误

private void 公司信息设置ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CompanyForm MyDlg = new CompanyForm();
            MyDlg.ShowDialog();
            StringBuilder MyTempPath = new StringBuilder(this.MyBgPhotoShow);
            this.GetCompanyInformation();
            //生成系统背景图像
            if (!System.IO.File.Exists(MyBgPhotoShow))
            {
                Image MyImage = new Bitmap(MyBgPhoto, true);
                int PosX = 10;
                int PosY = MyImage.Height / 2 + 200;
                int MyFont = 150;
                bool bMyFound = false;
                int MyWidth = MyImage.Width;
                int MyHeight = MyImage.Height;
                int MySize = MyWidth * MyHeight;
                Bitmap MyPattern = new Bitmap(MyWidth, MyHeight);
                Bitmap MyBitmap = new Bitmap(MyImage);
                Graphics g = Graphics.FromImage(MyPattern);
                Graphics MyGraphics = Graphics.FromImage(MyImage);
                g.Clear(Color.White);
                while (bMyFound == false)
                {
                    Font NewFont = new Font("宋体", MyFont, FontStyle.Bold);
                    SizeF MyString = new SizeF(MyWidth, MyHeight);
                    MyString = g.MeasureString(MySlogan, NewFont);
                    if (MyString.Width < MyPattern.Width)
                    {
                        if (MyString.Height < MyPattern.Height)
                        {
                            bMyFound = true;
                            g.DrawString(MySlogan, NewFont, new SolidBrush(Color.Black), PosX, PosY);
                        }
                    }
                    else
                        MyFont = MyFont - 1;
                }
                for (int x = 1; x < MyPattern.Width; x++)
                {
                    for (int y = 1; y < MyPattern.Height; y++)
                    {
                        int a, re, gr, bl, x1, y1, z1;
                        if (MyPattern.GetPixel(x, y).ToArgb() == Color.Black.ToArgb())
                        {
                            a = MyBitmap.GetPixel(x, y).A;
                            re = MyBitmap.GetPixel(x, y).R;
                            gr = MyBitmap.GetPixel(x, y).G;
                            bl = MyBitmap.GetPixel(x, y).B;
                            x1 = re;
                            y1 = gr;
                            z1 = bl;
                            if (bl + 25 < 255)
                                bl = bl + 25;
                            if (gr + 25 < 255)
                                gr = gr + 25;
                            if (re + 25 < 255)
                                re = re + 25;
                            if (x1 - 25 > 0)
                                x1 = x1 - 25;
                            if (y1 - 25 > 0)
                                y1 = y1 - 25;
                            if (z1 - 25 > 0)
                                z1 = z1 - 25;
                            MyGraphics.DrawEllipse(new Pen(new SolidBrush(Color.Black)), x, y + 1, 3, 3);
                            MyGraphics.DrawEllipse(new Pen(new SolidBrush(Color.FromArgb(a, x1, y1, z1))), x, y, 1, 1);
                        }
                    }
                }
                MyGraphics.DrawString("公司地址:" + MyAddress, new Font("宋体", 10, FontStyle.Regular), new SolidBrush(Color.Yellow), 10, 80);
                MyGraphics.DrawString("服务电话:" + MyTel, new Font("宋体", 10, FontStyle.Regular), new SolidBrush(Color.Yellow), 10, 100);
                MyGraphics.DrawString("公司网站:" + MyWeb, new Font("宋体", 10, FontStyle.Regular), new SolidBrush(Color.Yellow), 10, 120);
                MyImage.Save(MyBgPhotoShow,  System.Drawing.Imaging.ImageFormat.Jpeg);
            }
            this.BackgroundImage = new Bitmap(this.MyBgPhotoShow, true);
            this.Text = MySlogan;
        }
--------------------编程问答-------------------- MyBgPhotoShow这个图片在GDI+中操作错误,很可能是MyBgPhotoShow不是一个完整标准的图片
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,