Esempio n. 1
0
        private void 小区信息设置ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CommunityForm MyDlg = new CommunityForm();

            MyDlg.ShowDialog();
            //StringBuilder MyTempPath = new StringBuilder(this.MyBgPhotoShow);
            this.GetCommunityInformation();
            this.Text = MySlogan;
            //this.Icon = new Icon(this.MyIcon);
        }
Esempio n. 2
0
        private void 小区信息设置ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CommunityForm MyDlg = new CommunityForm();

            MyDlg.ShowDialog();
            StringBuilder MyTempPath = new StringBuilder(this.MyBgPhotoShow);

            this.GetCommunityInformation();
            //生成系统背景图像
            if (!System.IO.File.Exists(MyBgPhotoShow))
            {
                Image    MyImage    = new Bitmap(MyBgPhoto, true);
                int      PosX       = 10;
                int      PosY       = MyImage.Height / 2 + 70;
                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.Cyan)), 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.White), 5, 10);
                MyGraphics.DrawString("服务电话:" + MyTel, new Font("宋体", 10, FontStyle.Regular), new SolidBrush(Color.White), 5, 30);
                MyGraphics.DrawString("公司网站:" + MyWeb, new Font("宋体", 10, FontStyle.Regular), new SolidBrush(Color.White), 5, 50);
                MyImage.Save(MyBgPhotoShow, System.Drawing.Imaging.ImageFormat.Jpeg);
            }
            this.BackgroundImage = new Bitmap(this.MyBgPhotoShow, true);
            this.Text            = MySlogan;
            //this.Icon = new Icon(this.MyIcon);
        }