Esempio n. 1
0
 private void PictureBox_Click(object sender, EventArgs e)
 {
     SelectedPixel = MouseOnPixel;
     if (NewTool != null)
     {
         NewTool.SetPosition(SelectedPixel);
         theme.AddTool(NewTool); // Add new tool to collection
         Control.propertyGrid1.SelectedObject = NewTool;
         NewToolAdded();         // call method for reset NewTool and set focus on button_pointer
         NewTool = null;
         Theme_Changed();
     }
     SelectedTool = null;
     Control.PictureBox.Cursor = System.Windows.Forms.Cursors.Default;
     foreach (LB_Tools_Interface tool in theme.GetTools())
     {
         if (LB_Tools.isItToolArea(tool, SelectedPixel))
         {
             Control.propertyGrid1.SelectedObject = tool;
             SelectedTool = tool;
             Control.PictureBox.Cursor = System.Windows.Forms.Cursors.SizeAll;
         }
     }
     if (SelectedTool == null)
     {
         Control.propertyGrid1.SelectedObject = theme;
     }
     tabPage.Focus();
     Control.PictureBox.Invalidate();
 }
Esempio n. 2
0
 private void LoadAnimation()
 {
     if (AnimationPath != AnimationPathOld)
     {
         AnimationPathOld = AnimationPath;
         animationConverter.Decode(AnimationPath);
         animationConverter.SetFirstFrame();
         LbResourcePath = AnimationPathOld;
         LbResourceName = LB_Tools.GetFileName(LbResourcePath);
     }
 }
Esempio n. 3
0
        private void LoadImage()
        {
            if (ImagePath != ImagePathOld && ImagePath != "")
            {
                ImagePathOld = ImagePath;

                FileInfo f_info = new FileInfo(ImagePath);
                switch (f_info.Extension)
                {
                case ".bmp":
                    if (f_info.Extension == ".bmp")
                    {
                        Bitmap tempBitmap = new Bitmap(ImagePath);
                        if (tempBitmap.Height > MaxSize.Height || tempBitmap.Width > MaxSize.Width)
                        {
                            bitmap = new Bitmap(MaxSize.Width, MaxSize.Height);
                            Graphics g = Graphics.FromImage(bitmap);
                            g.DrawImage(tempBitmap, new Rectangle(0, 0, MaxSize.Width, MaxSize.Height));
                            tempBitmap.Dispose();
                        }
                        else
                        {
                            bitmap = new Bitmap(tempBitmap);
                            tempBitmap.Dispose();
                        }
                        animationConverter = new AnimationConverter(bitmap);
                        string bma_path = Path.GetDirectoryName(ImagePath) + "\\" + Path.GetFileNameWithoutExtension(ImagePath) + ".bma";
                        if (animationConverter.Encode(bma_path, 0, 0, AnimationConverter.ColorOrder.RGB, AnimationConverter.PixelOrder.VS_TR, AnimationConverter.DataType.Default))
                        {
                            LbResourcePath = bma_path;
                            LbResourceName = LB_Tools.GetFileName(LbResourcePath);
                        }
                    }
                    break;

                case ".jpg":
                    Stream            imageStreamSource = new FileStream(ImagePath, FileMode.Open, FileAccess.Read, FileShare.Read);
                    JpegBitmapDecoder decoder           = new JpegBitmapDecoder(imageStreamSource, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
                    BitmapSource      bitmapSource      = decoder.Frames[0];
                    bitmap = BitmapFromSource(bitmapSource);
                    break;

                default:

                    break;
                }
            }
        }
Esempio n. 4
0
 public void SetLBResourcePath(string path)
 {
     LbResourcePath = path;
     LbResourceName = LB_Tools.GetFileName(path);
 }