コード例 #1
0
        /// <summary>
        /// Create an alpha blended form with a transparent background that is movable and responds to mouse and key inputs.
        /// </summary>
        public DockItemObject(MainForm TheParent, LanguageLoader.LanguageLoader LanguageData, SettingsLoader.SettingsLoader SettingsData,
                              DockItemSettingsLoader.DockItemSettingsLoader DockItemData, String SectionName, Size InitialSize, String Path)
        {
            Language            = LanguageData;
            DockSettings        = SettingsData;
            ParentObject        = TheParent;
            DockItemSettings    = DockItemData;
            DockItemSectionName = SectionName;
            ObjectSize          = InitialSize;

            if (DockItemSectionName != null && DockItemSectionName != "")
            {
                FileOperations = new FileOps.FileOps(@DockItemSettings.GetEntry(DockItemSectionName, "Args"));
            }
            else
            {
                FileOperations = new FileOps.FileOps(@Path);
            }

            InitializeComponent();

            TopMost       = true;
            ShowInTaskbar = false;
            AllowDrop     = true;

            LeftMouseButtonDown          = false;
            ThisObjectMovedWithLeftMouse = false;

            ObjectBitmap    = new Bitmap(1, 1, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
            OverlayBitmap   = new Bitmap(1, 1, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
            ObjectOpacity   = 255;
            PreviousOpacity = ObjectOpacity;

            SetBitmap();
        }
コード例 #2
0
        private void ChangeIconDialog_FileOk(object sender, CancelEventArgs e)
        {
            String NewImagePath;

            if (ChangeIconDialog.FileName.StartsWith(Application.StartupPath))
            {
                NewImagePath = ChangeIconDialog.FileName.Substring(Application.StartupPath.Length, ChangeIconDialog.FileName.Length - Application.StartupPath.Length);
            }
            else
            {
                NewImagePath = ChangeIconDialog.FileName;
            }

            //Console.WriteLine(NewImagePath);

            if (DockItemSectionName != null && DockItemSectionName != "")
            {
                DockItemSettings.SetEntry(DockItemSectionName, "ImagePath", NewImagePath);
                FileOperations = new FileOps.FileOps(@DockItemSettings.GetEntry(DockItemSectionName, "Args"));
            }
            //else
            //{
            //    FileOperations = new FileOps.FileOps(@Path);
            //}

            SetBitmap();
            Size ObjectSize = this.ObjectSize;

            DrawBitmapManaged(ObjectSize.Width, ObjectSize.Height, false, 0, 0, false, 0, 0, 0, 0, false, 0);
        }
コード例 #3
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);
        }