Example #1
0
        private void buttonX1_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "所有文件|*.*".Language();
            openFileDialog.Getpath("ftpupfile");
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                this.textBox3.Text = openFileDialog.FileName;
                openFileDialog.Putpath("ftpupfile");
            }
        }
Example #2
0
        private void buttonItem1_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter      = "zi文件|*.zi|所有文件|*.*".Language();
            openFileDialog.Multiselect = true;
            openFileDialog.Getpath("ziku");
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                openFileDialog.Putpath("ziku");
                this.Myapp.Addziku(openFileDialog.FileNames, "add", 0);
                this.Ref();
                this.zikuupdate(null, null);
            }
        }
Example #3
0
 private void buttonItem8_Click(object sender, EventArgs e)
 {
     if (this.listBox1.Items.Count > 0 && this.listBox1.SelectedIndex > -1)
     {
         OpenFileDialog openFileDialog = new OpenFileDialog();
         openFileDialog.Filter      = "zi文件|*.zi|所有文件|*.*".Language();
         openFileDialog.Multiselect = false;
         openFileDialog.Getpath("ziku");
         if (openFileDialog.ShowDialog() == DialogResult.OK)
         {
             openFileDialog.Putpath("ziku");
             this.Myapp.Addziku(openFileDialog.FileName, "tihuan", this.listBox1.SelectedIndex);
             this.Ref();
             this.zikuupdate(null, null);
         }
     }
 }
Example #4
0
 private void opensuolvtu()
 {
     try
     {
         OpenFileDialog openFileDialog = new OpenFileDialog();
         openFileDialog.Filter = "所有文件|*.*".Language();
         openFileDialog.Getpath("ftpslvtu");
         if (openFileDialog.ShowDialog() == DialogResult.OK)
         {
             openFileDialog.Putpath("ftpslvtu");
             this.pictureBox1.Load(openFileDialog.FileName);
             this.suolvtu = openFileDialog.FileName;
             if (this.linkLabel1.Visible)
             {
                 this.linkLabel1.Visible = false;
             }
         }
     }
     catch (Exception ex)
     {
         MessageOpen.Show(ex.Message);
     }
 }
Example #5
0
        private bool addpic(string lei, int index)
        {
            Bitmap         bitmap         = new Bitmap(1, 1);
            int            num            = 1;
            int            num2           = 0;
            int            num3           = 0;
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Multiselect = !(lei == "tihuan");
            openFileDialog.Filter      = "所有文件|*.*".Language();
            openFileDialog.Getpath("pic");
            bool result;

            if (openFileDialog.ShowDialog() != DialogResult.OK)
            {
                result = false;
            }
            else
            {
                openFileDialog.Putpath("pic");
                guiimagetype guiimagetype = default(guiimagetype);
                string[]     fileNames    = openFileDialog.FileNames;
                for (int i = 0; i < fileNames.Length; i++)
                {
                    string file = fileNames[i];
                    this.label1.Text = "正在转换图片".Language() + num.ToString();
                    num++;
                    Application.DoEvents();
                    bitmap = new Bitmap(1, 1);
                    if (this.openpic(ref bitmap, file))
                    {
                        num3++;
                        guiimagetype.imagebytes = new byte[bitmap.Width * bitmap.Height * 2];
                        int num4 = 0;
                        for (int j = 0; j < bitmap.Height; j++)
                        {
                            for (int k = 0; k < bitmap.Width; k++)
                            {
                                if (bitmap.GetPixel(k, j).A == 0)
                                {
                                    guiimagetype.imagebytes[num4]     = (byte)(datasize.Color_touming % 256);
                                    guiimagetype.imagebytes[num4 + 1] = 0;
                                }
                                else
                                {
                                    ushort num5 = bitmap.GetPixel(k, j).Get16Color();
                                    guiimagetype.imagebytes[num4]     = (byte)(num5 % 256);
                                    guiimagetype.imagebytes[num4 + 1] = (byte)(num5 / 256);
                                    if ((ushort)guiimagetype.imagebytes[num4] == datasize.Color_touming && guiimagetype.imagebytes[num4 + 1] == 0)
                                    {
                                        guiimagetype.imagebytes[num4] = (byte)datasize.Color_toumingtihuan;
                                    }
                                }
                                num4 += 2;
                            }
                        }
                        guiimagetype.picturexinxi.qumo = Convert.ToByte(this.Myapp.guidire + 10);
                        if (guiimagetype.picturexinxi.qumo != 10)
                        {
                            Kuozhan.getxuanzhuanimage(guiimagetype.imagebytes, ref guiimagetype.imagebytes, bitmap.Width, bitmap.Height, 0, (int)this.Myapp.guidire);
                        }
                        guiimagetype.picturexinxi.H           = (ushort)bitmap.Height;
                        guiimagetype.picturexinxi.imgbytesize = (uint)guiimagetype.imagebytes.Length;
                        guiimagetype.picturexinxi.W           = (ushort)bitmap.Width;
                        guiimagetype.imagebitbmp = guiimagetype.imagebytes.GetBitmap(guiimagetype.picturexinxi, datasize.Opentouming);
                        guiimagetype.imgxulie    = guiimagetype.imagebitbmp.ClassToBytes();
                        if (lei == "add")
                        {
                            this.Myapp.images.Add(guiimagetype);
                        }
                        else if (lei == "insert")
                        {
                            if (index >= this.Myapp.images.Count)
                            {
                                result = false;
                                return(result);
                            }
                            this.Myapp.images.Insert(index, guiimagetype);
                        }
                        else if (lei == "tihuan")
                        {
                            this.Myapp.images[index] = guiimagetype;
                        }
                    }
                    else
                    {
                        num2++;
                    }
                    if (bitmap != null)
                    {
                        bitmap.Dispose();
                    }
                }
                if (num3 > 0 && lei == "insert")
                {
                    byte[] array = ((ushort)index).structToBytes();
                    foreach (mpage current in this.Myapp.pages)
                    {
                        foreach (mobj current2 in current.objs)
                        {
                            foreach (matt current3 in current2.atts)
                            {
                                if (current3.att.attlei == attshulei.Picid.typevalue)
                                {
                                    ushort num6 = (ushort)current3.zhi.BytesTostruct(0.GetType());
                                    if (num6 != 65535 && (int)num6 >= index)
                                    {
                                        current3.zhi = ((ushort)((int)num6 + num3)).structToBytes();
                                    }
                                }
                            }
                        }
                    }
                    foreach (mpage current in this.Myapp.pages)
                    {
                        foreach (objsetcom_P current4 in current.objsetcomps)
                        {
                            foreach (objsetcom current5 in current4.objset)
                            {
                                if (current5.backobj != null)
                                {
                                    foreach (matt current3 in current5.backobj.atts)
                                    {
                                        if (current3.att.attlei == attshulei.Picid.typevalue)
                                        {
                                            ushort num6 = (ushort)current3.zhi.BytesTostruct(0.GetType());
                                            if (num6 != 65535 && (int)num6 >= index)
                                            {
                                                current3.zhi = ((ushort)((int)num6 + num3)).structToBytes();
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    foreach (mobj current2 in this.Myapp.copymobjs)
                    {
                        foreach (matt current3 in current2.atts)
                        {
                            if (current3.att.attlei == attshulei.Picid.typevalue)
                            {
                                ushort num6 = (ushort)current3.zhi.BytesTostruct(0.GetType());
                                if (num6 != 65535 && (int)num6 >= index)
                                {
                                    current3.zhi = ((ushort)((int)num6 + num3)).structToBytes();
                                }
                            }
                        }
                    }
                }
                if (num2 == 0)
                {
                    MessageOpen.Show(string.Concat(new string[]
                    {
                        "成功导入".Language(),
                        " ",
                        num3.ToString(),
                        " ",
                        "张".Language()
                    }));
                }
                else
                {
                    MessageOpen.Show(string.Concat(new string[]
                    {
                        "成功导入".Language(),
                        " ",
                        num3.ToString(),
                        " ",
                        "张,失败".Language(),
                        " ",
                        num2.ToString(),
                        " ",
                        "张".Language()
                    }));
                }
                result = true;
            }
            return(result);
        }