void Control_Events(Texture_Info TexInfo)
        {
            Texture_Property_Info PInfo = TexInfo.Property;

            PInfo.Opacity.ValueChanged += delegate
            {
                TexInfo.Texture_Image.Texture_Image.Opacity = PInfo.Opacity.Value;
            };
            PInfo.ChangeCheckBox += delegate(bool IsVisibility)
            {
                if (IsVisibility)
                {
                    TexInfo.Texture_Image.Texture_Image.Visibility = Visibility.Visible;
                }
                else
                {
                    TexInfo.Texture_Image.Texture_Image.Visibility = Visibility.Hidden;
                }
            };
        }
Exemplo n.º 2
0
 public Texture_Info Add_Texture(string File, System.Drawing.Point Init_Position, int Property_Position, bool IsCenterMode)
 {
     if (!IsInited)
     {
         return(null);
     }
     try
     {
         int         ID          = Sub_Code.r.Next(0, int.MaxValue);
         Bitmap      Texture_BMP = null;
         BitmapImage Texture     = null;
         if (Path.GetExtension(File) == ".dds")
         {
             //Texture_BMP = DDS_Format.Load_To_Bitmap(File);
             //Texture = Sub_Code.Bitmap_To_BitmapImage(Texture_BMP);
         }
         else
         {
             Texture     = new BitmapImage(new Uri(File));
             Texture_BMP = new Bitmap(File);
         }
         Canvas Parent = new Canvas();
         Parent.Name = "Property_Parent_" + ID;
         Parent.VerticalAlignment   = VerticalAlignment.Top;
         Parent.HorizontalAlignment = HorizontalAlignment.Left;
         Parent.Width      = 399;
         Parent.Height     = 95;
         Parent.Focusable  = false;
         Parent.Background = System.Windows.Media.Brushes.Transparent;
         Parent.Margin     = new Thickness(0, 95 * Property_Position, 0, 0);
         Slider Opacity = new Slider();
         Opacity.Name = "Opacity_Slider_" + ID;
         Opacity.VerticalAlignment   = VerticalAlignment.Top;
         Opacity.HorizontalAlignment = HorizontalAlignment.Left;
         Opacity.Width     = 200;
         Opacity.Height    = 25;
         Opacity.Focusable = false;
         Opacity.Style     = Slider_Style_Yoko;
         Opacity.Maximum   = 1;
         Opacity.Minimum   = 0;
         Opacity.Value     = 1;
         Opacity.Margin    = new Thickness(150, 70, 0, 0);
         TextBlock File_Name = new TextBlock();
         File_Name.Name = "Texture_Name_" + ID;
         File_Name.Text = Path.GetFileName(File);
         File_Name.VerticalAlignment   = VerticalAlignment.Top;
         File_Name.HorizontalAlignment = HorizontalAlignment.Left;
         File_Name.Width         = 260;
         File_Name.Height        = 70;
         File_Name.Focusable     = false;
         File_Name.Foreground    = System.Windows.Media.Brushes.Aqua;
         File_Name.FontSize      = 25;
         File_Name.TextWrapping  = TextWrapping.Wrap;
         File_Name.TextAlignment = TextAlignment.Center;
         File_Name.Margin        = new Thickness(125, 0, 0, 0);
         System.Windows.Controls.Image Check = new System.Windows.Controls.Image();
         Check.Name                = "Visibility_Image_" + ID;
         Check.Margin              = new Thickness(10, 32.5, 0, 0);
         Check.Width               = 30;
         Check.Height              = 30;
         Check.Stretch             = System.Windows.Media.Stretch.Fill;
         Check.HorizontalAlignment = HorizontalAlignment.Left;
         Check.VerticalAlignment   = VerticalAlignment.Top;
         Check.Focusable           = false;
         Check.Source              = Sub_Code.Check_03;
         System.Windows.Controls.Image Texture_Icon = new System.Windows.Controls.Image();
         Texture_Icon.Name                = "Texture_Icon_" + ID;
         Texture_Icon.Margin              = new Thickness(75, 27.5, 0, 0);
         Texture_Icon.Width               = 50;
         Texture_Icon.Height              = 50;
         Texture_Icon.Stretch             = System.Windows.Media.Stretch.UniformToFill;
         Texture_Icon.HorizontalAlignment = HorizontalAlignment.Left;
         Texture_Icon.VerticalAlignment   = VerticalAlignment.Top;
         Texture_Icon.Focusable           = false;
         Texture_Icon.Source              = Texture;
         Border Texture_Border = new Border();
         Texture_Border.Name                = "Texture_Border_" + ID;
         Texture_Border.Margin              = new Thickness(74, 26.5, 0, 0);
         Texture_Border.Width               = 52;
         Texture_Border.Height              = 52;
         Texture_Border.BorderThickness     = new Thickness(1);
         Texture_Border.BorderBrush         = System.Windows.Media.Brushes.Aqua;
         Texture_Border.HorizontalAlignment = HorizontalAlignment.Left;
         Texture_Border.VerticalAlignment   = VerticalAlignment.Top;
         Texture_Border.Focusable           = false;
         Parent.Children.Add(Opacity);
         Parent.Children.Add(File_Name);
         Parent.Children.Add(Check);
         Parent.Children.Add(Texture_Icon);
         Parent.Children.Add(Texture_Border);
         System.Windows.Controls.Image Texture_Image = new System.Windows.Controls.Image();
         Texture_Image.Name                = "Texture_Image_" + ID;
         Texture_Image.Width               = Texture_BMP.Width;
         Texture_Image.Height              = Texture_BMP.Height;
         Texture_Image.VerticalAlignment   = VerticalAlignment.Top;
         Texture_Image.HorizontalAlignment = HorizontalAlignment.Left;
         Texture_Image.Focusable           = false;
         Texture_Image.Source              = Texture;
         Texture_Image.Stretch             = Stretch.Uniform;
         System.Drawing.Point Set_Position = Init_Position;
         if (IsCenterMode)
         {
             Set_Position = Position_To_Center(Init_Position, (int)Texture.Width, (int)Texture.Height);
         }
         Texture_Image.Margin = new Thickness(Set_Position.X, Set_Position.Y, 0, 0);
         Texture_Property_Info Property_Info = new Texture_Property_Info(Parent, Opacity, File_Name, Check, Texture_Icon, Texture_Border);
         Texture_Image_Info    Image_Info    = new Texture_Image_Info(Texture_BMP, Texture_Image, Set_Position, Property_Position);
         Texture_Info          Info          = new Texture_Info(Property_Info, Image_Info, ID);
         Check.MouseEnter += delegate
         {
             if (Property_Info.IsVisibility)
             {
                 Check.Source = Sub_Code.Check_04;
             }
             else
             {
                 Check.Source = Sub_Code.Check_02;
             }
         };
         Check.MouseLeave += delegate
         {
             if (Property_Info.IsVisibility)
             {
                 Check.Source = Sub_Code.Check_03;
             }
             else
             {
                 Check.Source = Sub_Code.Check_01;
             }
         };
         All_Textures.Add(Info);
         Move_Texture(Info, Set_Position);
         return(Info);
     }
     catch (Exception e)
     {
         Sub_Code.Error_Log_Write(e.Message);
         return(null);
     }
 }
Exemplo n.º 3
0
 public Texture_Info(Texture_Property_Info Property, Texture_Image_Info Texture_Image, int ID)
 {
     this.Property      = Property;
     this.Texture_Image = Texture_Image;
     this.ID            = ID;
 }