Ejemplo n.º 1
0
        public void ChangeCentreImage(String Level)
        {
            if (Level == null || Level.Length == 0)
            {
                return;
            }

            Bitmap NewBitmap;

            if (Level == ROOT_LEVEL)
            {
                try
                {
                    NewBitmap = new Bitmap(Application.StartupPath + DockSettings.CentreImage.Path);
                }
                catch (Exception)
                {
                    NewBitmap = new Bitmap(CircleDock.Properties.ImageResources.CircleDockIconCentreImage);
                }
            }
            else
            {
                String          ParsedLevel = Level.Substring(0, Level.Length - 1);
                FileOps.FileOps FileOperations;

                if (ParsedLevel != null && ParsedLevel != "")
                {
                    //Console.WriteLine(ParsedLevel + "  " + @DockItemSettings.GetEntry(ParsedLevel, "Args"));
                    String ImagePath = @DockItemSettings.GetEntry(ParsedLevel, "ImagePath");

                    try
                    {
                        if (ImagePath != null && ImagePath.Length > 0)
                        {
                            NewBitmap = new Bitmap(Application.StartupPath + @ImagePath);
                        }
                        else
                        {
                            FileOperations = new FileOps.FileOps(@DockItemSettings.GetEntry(ParsedLevel, "Args"));
                            NewBitmap      = new Bitmap(FileOperations.RepresentativeImage);
                        }
                    }
                    catch (Exception)
                    {
                        NewBitmap = new Bitmap(CircleDock.Properties.ImageResources.CircleDockIconCentreImage);
                    }
                }
                else
                {
                    NewBitmap = new Bitmap(CircleDock.Properties.ImageResources.CircleDockIconCentreImage);
                }
            }
            CentreObject.SetBitmapManaged(ref NewBitmap);
            Size ObjectSize = CentreObject.ObjectSize;

            CentreObject.DrawBitmapManaged(ObjectSize.Width, ObjectSize.Height, false, 0, 0, false, 0, 0, 0, 0, false, 0);
        }
Ejemplo n.º 2
0
        public void InitializeCentreObject()
        {
            Size tempSize = new Size(DockSettings.CentreImage.Width, DockSettings.CentreImage.Height);

            CentreObject = new BaseDockObjects.CentreObject(this, LanguageWords, DockSettings, "CentreImage", tempSize);
            //CentreObject.TopLevel = false;
            //CentreObject.Parent = BackgroundObject;
            CentreObject.Owner = BackgroundObject;

            // MainForm handles all the location and sizing of the objects
            //Size tempBackgroundObjectSize = BackgroundObject.ObjectSize;
            //CentreObject.Location = new Point(BackgroundObject.Location.X + tempBackgroundObjectSize.Width / 2 - tempSize.Width / 2,
            //  BackgroundObject.Location.Y + tempBackgroundObjectSize.Height / 2 - tempSize.Height / 2);
            CentreObject.Location = new Point(SystemInformation.VirtualScreen.Right / 2 - tempSize.Width / 2,
                                              SystemInformation.VirtualScreen.Bottom / 2 - tempSize.Height / 2);
            CentreObject.DrawBitmapManaged(tempSize.Width, tempSize.Height, false, 0, 0, false, 0, 0, 0, 0, false, 0);

            CentreObject.Show();
            CentreObject.BringToFront();
        }