protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); var bounds = System.Windows.Forms.Screen.PrimaryScreen.Bounds; var monitorSize = Math.Min(bounds.Width, bounds.Height); IconSize = (int)(monitorSize * 0.09); ShadowEffect = new DropShadowEffect(); ShadowEffect.Direction = -90; ShadowEffect.ShadowDepth = IconSize * 0.3; ShadowEffect.BlurRadius = IconSize * 0.3; ShadowEffect.Opacity = 0; spContent.Margin = new Thickness(0, 0, IconSize, ShadowEffect.ShadowDepth); //spContent.Margin = new Thickness(0, 0, IconSize, 0); spContent.Children.Clear(); foreach (var file in App.Files) { var attr = File.GetAttributes(file); if ((attr & (FileAttributes.Hidden | FileAttributes.System)) == 0) { if (spContent.Children.Count < MaxItems) { var ctrl = new FanIconControl(); ctrl.IconSize = IconSize; ctrl.Filename = file; ctrl.Name = "Icon" + Convert.ToString(spContent.Children.Count); this.RegisterName(ctrl.Name, ctrl); ctrl.GridContent.Tag = "GridContent" + Convert.ToString(spContent.Children.Count); this.RegisterName((string)ctrl.GridContent.Tag, ctrl.GridContent); ctrl.BorderTitle.Tag = "BorderTitle" + Convert.ToString(spContent.Children.Count); this.RegisterName((string)ctrl.BorderTitle.Tag, ctrl.BorderTitle); spContent.Children.Add(ctrl); } else { break; } } } if (spContent.Children.Count < MaxItems) { foreach (var dir in App.Directories) { var attr = File.GetAttributes(dir); if ((attr & (FileAttributes.Hidden | FileAttributes.System)) == 0) { if (spContent.Children.Count < MaxItems) { var ctrl = new FanIconControl(); ctrl.IconSize = IconSize; ctrl.Filename = dir; ctrl.Name = "Icon" + Convert.ToString(spContent.Children.Count); this.RegisterName(ctrl.Name, ctrl); ctrl.GridContent.Tag = "GridContent" + Convert.ToString(spContent.Children.Count); this.RegisterName((string)ctrl.GridContent.Tag, ctrl.GridContent); ctrl.BorderTitle.Tag = "BorderTitle" + Convert.ToString(spContent.Children.Count); this.RegisterName((string)ctrl.BorderTitle.Tag, ctrl.BorderTitle); spContent.Children.Add(ctrl); } else { break; } } } } var rect = DockIcon.IconRect; Width = 350 + 5 + IconSize + spContent.Margin.Right + 10; Left = rect.Right - Width + spContent.Margin.Right; Height = IconSize * spContent.Children.Count + spContent.Margin.Top + spContent.Margin.Bottom + 350 * Math.Sin(Angle) / Math.Cos((90 - Angle)); Top = rect.Bottom - Height + spContent.Margin.Bottom - 4; }