private void UpdateTemplate() { if (this.position == DockingGuidesPosition.Center) { return; } Image background = null; IDockingGuidesTemplate template = this.owner.DockManager.DockingGuidesTemplate; switch (this.position) { case DockingGuidesPosition.Bottom: background = template.BottomImage.Image; break; case DockingGuidesPosition.Left: background = template.LeftImage.Image; break; case DockingGuidesPosition.Right: background = template.RightImage.Image; break; case DockingGuidesPosition.Top: background = template.TopImage.Image; break; } this.BackgroundImage = background; }
private void UpdateCenterRects() { this.centerPositionRects = new KeyValuePair <AllowedDockPosition, Rectangle> [5]; Rectangle bounds; IDockingGuidesTemplate template = this.owner.DockManager.DockingGuidesTemplate; int index = 0; //left rect bounds = new Rectangle(template.LeftImage.LocationOnCenterGuide, template.LeftImage.PreferredSize); this.centerPositionRects[index++] = new KeyValuePair <AllowedDockPosition, Rectangle>(AllowedDockPosition.Left, bounds); //top rect bounds = new Rectangle(template.TopImage.LocationOnCenterGuide, template.TopImage.PreferredSize); this.centerPositionRects[index++] = new KeyValuePair <AllowedDockPosition, Rectangle>(AllowedDockPosition.Top, bounds); //right rect bounds = new Rectangle(template.RightImage.LocationOnCenterGuide, template.RightImage.PreferredSize); this.centerPositionRects[index++] = new KeyValuePair <AllowedDockPosition, Rectangle>(AllowedDockPosition.Right, bounds); //bottom rect bounds = new Rectangle(template.BottomImage.LocationOnCenterGuide, template.BottomImage.PreferredSize); this.centerPositionRects[index++] = new KeyValuePair <AllowedDockPosition, Rectangle>(AllowedDockPosition.Bottom, bounds); //fill rect bounds = new Rectangle(template.FillImage.LocationOnCenterGuide, template.FillImage.PreferredSize); this.centerPositionRects[index++] = new KeyValuePair <AllowedDockPosition, Rectangle>(AllowedDockPosition.Fill, bounds); }
protected override void PaintWindow(Graphics g, Bitmap graphicsBitmap) { base.PaintWindow(g, graphicsBitmap); //Center docking position needs special handling if (this.position != DockingGuidesPosition.Center) { return; } IDockingGuidesTemplate template = this.owner.DockManager.DockingGuidesTemplate; Rectangle imageBounds; Image image; //if (template.CenterBackgroundImage != null) //{ // g.DrawImage(template.CenterBackgroundImage.Image, // new Rectangle(template.CenterBackgroundImage.LocationOnCenterGuide, template.CenterBackgroundImage.PreferredSize)); //} if ((this.allowedDockPosition & AllowedDockPosition.Left) == AllowedDockPosition.Left) { image = this.lastHitPosition == DockPosition.Left ? template.LeftImage.HotImage : template.LeftImage.Image; imageBounds = new Rectangle(template.LeftImage.LocationOnCenterGuide, template.LeftImage.PreferredSize); g.DrawImage(image, imageBounds); } if ((this.allowedDockPosition & AllowedDockPosition.Top) == AllowedDockPosition.Top) { image = this.lastHitPosition == DockPosition.Top ? template.TopImage.HotImage : template.TopImage.Image; imageBounds = new Rectangle(template.TopImage.LocationOnCenterGuide, template.TopImage.PreferredSize); g.DrawImage(image, imageBounds); } if ((this.allowedDockPosition & AllowedDockPosition.Right) == AllowedDockPosition.Right) { image = this.lastHitPosition == DockPosition.Right ? template.RightImage.HotImage : template.RightImage.Image; imageBounds = new Rectangle(template.RightImage.LocationOnCenterGuide, template.RightImage.PreferredSize); g.DrawImage(image, imageBounds); } if ((this.allowedDockPosition & AllowedDockPosition.Bottom) == AllowedDockPosition.Bottom) { image = this.lastHitPosition == DockPosition.Bottom ? template.BottomImage.HotImage : template.BottomImage.Image; imageBounds = new Rectangle(template.BottomImage.LocationOnCenterGuide, template.BottomImage.PreferredSize); g.DrawImage(image, imageBounds); } if ((this.allowedDockPosition & AllowedDockPosition.Fill) == AllowedDockPosition.Fill) { image = this.lastHitPosition == DockPosition.Fill ? template.FillImage.HotImage : template.FillImage.Image; imageBounds = new Rectangle(template.FillImage.LocationOnCenterGuide, template.FillImage.PreferredSize); g.DrawImage(image, imageBounds); } }
private void UpdateFromPosition() { Image background = null; IDockingGuidesTemplate template = this.owner.DockManager.DockingGuidesTemplate; if (this.position == DockingGuidesPosition.Center) { this.allowedDockPosition = AllowedDockPosition.All; background = template.CenterBackgroundImage.Image; this.UpdateCenterRects(); } else { switch (this.position) { case DockingGuidesPosition.Bottom: background = template.BottomImage.Image; this.allowedDockPosition = AllowedDockPosition.Bottom; break; case DockingGuidesPosition.Left: background = template.LeftImage.Image; this.allowedDockPosition = AllowedDockPosition.Left; break; case DockingGuidesPosition.Right: background = template.RightImage.Image; this.allowedDockPosition = AllowedDockPosition.Right; break; case DockingGuidesPosition.Top: background = template.TopImage.Image; this.allowedDockPosition = AllowedDockPosition.Top; break; } } this.BackgroundImage = background; }
public void Initialize(IDockingGuidesTemplate template) { this.fillColor = template.DockingHintBackColor; this.borderColor = template.DockingHintBorderColor; this.borderWidth = template.DockingHintBorderWidth; }