Пример #1
0
        private void Pic_DoubleClick(object sender, EventArgs e)
        {
            string MyPath = HDLPF.OpenFileDialog("PNG Image|*.png", "Add Icons");

            if (MyPath == null || MyPath == "")
            {
                return;
            }
            Image img = Image.FromFile(MyPath);

            (sender as PictureBox).Image = img;

            if (strPath == null || strPath == "")
            {
                return;
            }
            if (Pic.Image == null)
            {
                return;
            }
            Cursor.Current = Cursors.WaitCursor;
            Byte[] data = new byte[0];
            if (Pic.Image.Width == 272 && Pic.Image.Height == 480)
            {
                data = HDLPF.BackgroundColorfulImageToByte((Bitmap)Pic.Image, Pic.Image.Height, Pic.Image.Width);
            }
            else
            {
                data = HDLPF.ColorfulImageToByte((Bitmap)Pic.Image, Pic.Image.Height, Pic.Image.Width);
            }
            System.IO.File.WriteAllBytes(strPath, data);
            Cursor.Current = Cursors.Default;
        }
Пример #2
0
 private void btnCreat_Click(object sender, EventArgs e)
 {
     if (strPath == null || strPath == "")
     {
         return;
     }
     if (Pic.Image == null)
     {
         return;
     }
     Cursor.Current = Cursors.WaitCursor;
     Byte[] data = new byte[0];
     if (Pic.Image.Width == 272 && Pic.Image.Height == 480)
     {
         data = HDLPF.BackgroundColorfulImageToByte((Bitmap)Pic.Image, Pic.Image.Height, Pic.Image.Width);
     }
     else
     {
         data = HDLPF.ColorfulImageToByte((Bitmap)Pic.Image, Pic.Image.Height, Pic.Image.Width);
     }
     System.IO.File.WriteAllBytes(strPath, data);
     Cursor.Current = Cursors.Default;
 }