Esempio n. 1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            comboBox1.Items.Clear();
            comboBox1.Items.Add(new WorkPath("ClarityHUD", System.AppDomain.CurrentDomain.BaseDirectory + @"\works\Clarity"));
            comboBox1.Items.Add(new WorkPath("OLD", System.AppDomain.CurrentDomain.BaseDirectory + @"\works\Normal", true));
            Statik.frm1 = this;
            foreach (var fl in Directory.GetFiles(System.AppDomain.CurrentDomain.BaseDirectory + "\\Textures\\", "*.dds"))
            {
                try
                {
                    ImageSourceConverter c   = new ImageSourceConverter();
                    DDSImage             dds = new DDSImage(File.ReadAllBytes(fl), true);
                    BitmapSource         src = Statik.ToWpfBitmap(dds.BitmapImage);

                    FileInfo fi = new FileInfo(fl);
                    Statik.textures.Add(new Ctexture()
                    {
                        Name = fi.Name.Replace(fi.Extension, ""), img = src
                    });
                }
                catch (Exception exx)
                {
                    MessageBox.Show(exx.Message);
                }
            }

            panel1.PreviewMouseLeftButtonDown += Panel1_PreviewMouseLeftButtonDown;
            panel1.OnChangeElement            += Panel1_OnChangeElement;
            var window = Window.GetWindow(this);

            window.KeyDown += Panel1_KeyDown;
        }
Esempio n. 2
0
        public void renderBackground()
        {
            gdi.Bitmap img = new gdi.Bitmap(1024, 768);

            using (var g = gdi.Graphics.FromImage(img))
            {
                gdi.Brush sl = new gdi.SolidBrush(gdi.Color.FromArgb(234, 234, 234));
                g.FillRectangle(sl, 0, 0, 1024, 768);
                foreach (var item in backElements)
                {
                    Rect rc = new Rect(item.getLeft(), item.getTop(), item.getWidth(), item.getHeight());
                    if (rc.Width == 0 || rc.Height == 0)
                    {
                        continue;
                    }
                    ImageSource si = item.getImage();
                    if (si == null)
                    {
                        continue;
                    }

                    //dc.DrawImage(CreateResizedImage(img, item.getWidth(), item.getHeight()), rc);
                    gdi.Image gi = Statik.CroppedBitmapToBitmap(si as CroppedBitmap);

                    g.DrawImage(gi, item.getLeft(), item.getTop(), item.getWidth(), item.getHeight());
                }
            }

            ImageBrush ib = new ImageBrush(Statik.ToWpfBitmap(img));

            this.Background = ib;
        }
Esempio n. 3
0
        private void removeBackImage_Click(object sender, RoutedEventArgs e)
        {
            panel1.Background = null;
            gdi.Bitmap img = new gdi.Bitmap(1024, 768);

            using (var g = gdi.Graphics.FromImage(img))
            {
                gdi.Brush sl = new gdi.SolidBrush(gdi.Color.FromArgb(234, 234, 234));
                g.FillRectangle(sl, 0, 0, 1024, 768);
            }
            ImageBrush ib = new ImageBrush(Statik.ToWpfBitmap(img));

            panel1.Background = ib;
        }