public ScGridViewCoreContainer(ScMgr scmgr) : base(scmgr) { IsUseDebugPanitCode = true; seletorScreen = new ScLayer(scmgr); seletorScreen.Name = "seletorScreen"; seletorScreen.IsUseDebugPanitCode = true; gridViewPack = new ScLayer(scmgr); gridViewPack.Name = "gridViewPack"; gridViewPack.IsUseDebugPanitCode = true; Add(gridViewPack); gridViewCore = new ScGridViewCore(scmgr); gridViewCore.Name = "gridViewCore"; gridViewCore.IsUseDebugPanitCode = true; gridViewCore.ItemDirectClipLayer = seletorScreen; gridViewCore.HeaderItemValueChangedEvent += GridViewContainer_HeaderItemValueChangedEvent; gridViewCore.ContentSizeChangedEvent += GridViewContainer_ContentSizeChangedEvent; gridViewCore.HeaderItemHitEvent += GridViewContainer_HeaderItemHitEvent; gridViewCore.CreateHeaderItemDataLayerEvent += GridViewContainer_CreateHeaderItemDataLayerEvent; gridViewCore.CreateDataItemDataLayerEvent += GridViewContainer_CreateDataItemDataLayerEvent; gridViewCore.ItemDataSetValueEvent += GridViewContainer_ItemDataSetValueEvent; gridViewCore.UserLayerValueChangedEvent += GridViewContainer_UserLayerValueChangedEvent; gridViewCore.ViewerItemMouseEnterEvent += GridViewContainer_ViewerItemMouseEnterEvent; gridViewCore.ViewerItemMouseDownEvent += GridViewContainer_ViewerItemMouseDownEvent; gridViewCore.ViewerItemMouseLeaveEvent += GridViewContainer_ViewerItemMouseLeaveEvent; gridViewCore.ViewerItemMouseDoubleDownEvent += GridViewContainer_ViewerItemMouseDoubleDownEvent; gridViewPack.Add(gridViewCore); Add(seletorScreen); // scrollBarVertical = new ScScrollBarEx(scmgr); scrollBarVertical.ScrollOrientation = ScScrollOrientation.VERTICAL_SCROLL; scrollBarVertical.Visible = false; scrollBarVertical.SliderMoveEvent += ScrollBarVertical_SliderMoveEvent; Add(scrollBarVertical); scrollBarHorizontal = new ScScrollBarEx(scmgr); scrollBarHorizontal.ScrollOrientation = ScScrollOrientation.HORIZONTAL_SCROLL; scrollBarHorizontal.Visible = false; scrollBarHorizontal.SliderMoveEvent += ScrollBarHorizontal_SliderMoveEvent; Add(scrollBarHorizontal); // shadow = new ScShadow(scmgr); shadow.CornersRadius = ShadowCornersRadius; shadow.ShadowRadius = ShadowRange; shadow.ShadowColor = ShadowColor; ShadowLayer = shadow; SizeChanged += ScGridView_SizeChanged; LocationChanged += ScGridView_LocationChanged; D2DPaint += ScGridView_D2DPaint; }
public ScButton(ScMgr scmgr = null) : base(scmgr) { D2DPaint += ScButton_D2DPaint; shadow = new ScShadow(scmgr); shadow.CornersRadius = 6; shadow.ShadowRadius = 3; shadow.ShadowColor = Color.FromArgb(15, 0, 0, 0); ShadowLayer = shadow; this.MouseDown += ScButton_MouseDown; this.MouseUp += ScButton_MouseUp; this.MouseEnter += ScButton_MouseEnter; this.MouseLeave += ScButton_MouseLeave; this.D2DPaint += ScButton_D2DPaint; scAnim = new ScAnimation(this, animMS, true); scAnim.AnimationEvent += ScAnim_AnimationEvent; scFontColorAnim = new ScAnimation(this, animMS, true); scFontColorAnim.AnimationEvent += ScFontColorAnim_AnimationEvent; IsUseOrgHitGeometry = false; SizeChanged += ScButton_SizeChanged; LocationChanged += ScButton_LocationChanged; }
private void ScGridView_LocationChanged(object sender, PointF oldLocation) { if (ShadowLayer != null) { ScShadow shadow = (ScShadow)ShadowLayer; shadow.Location = new PointF(DirectionRect.X - shadow.ShadowRadius, DirectionRect.Y + shadow.ShadowRadius); } }
private void ScButton_SizeChanged(object sender, SizeF oldSize) { if (ShadowLayer != null) { ScShadow shadow = (ScShadow)ShadowLayer; shadow.DirectionRect = new RectangleF(DirectionRect.X - shadow.ShadowRadius, DirectionRect.Y + shadow.ShadowRadius + 2, DirectionRect.Width + shadow.ShadowRadius * 2, DirectionRect.Height); } }
private void ScPanel_SizeChanged(object sender, SizeF oldSize) { if (Width == 0 || Height == 0) { return; } if (ShadowLayer != null) { ScShadow shadow = (ScShadow)ShadowLayer; shadow.DirectionRect = new RectangleF(DirectionRect.X - shadow.ShadowRadius, DirectionRect.Y - shadow.ShadowRadius, DirectionRect.Width + shadow.ShadowRadius * 2, DirectionRect.Height + shadow.ShadowRadius * 2); } }
private void ScPanel_LocationChanged(object sender, PointF oldLocation) { if (Width == 0 || Height == 0) { return; } if (ShadowLayer != null) { ScShadow shadow = (ScShadow)ShadowLayer; shadow.Location = new PointF(DirectionRect.X - shadow.ShadowRadius, DirectionRect.Y - shadow.ShadowRadius); } }
public ScPanel(ScMgr scmgr = null) : base(scmgr) { ScShadow shadow = new ScShadow(scmgr); shadow.CornersRadius = 4; shadow.ShadowRadius = 5; shadow.ShadowColor = Color.FromArgb(25, 0, 0, 0); ShadowLayer = shadow; LocationChanged += ScPanel_LocationChanged; SizeChanged += ScPanel_SizeChanged; D2DPaint += ScPanel_D2DPaint; }
void SetScroll() { SizeF contentSize = gridViewCore.GetContentSize(); float viewportWidth = gridViewCore.GetViewportWidth(); float viewportHeight = gridViewCore.GetViewportHeight(); float spacingW = SideSpacing.left + SideSpacing.right; float spacingH = SideSpacing.top + SideSpacing.bottom; float packWidth; float packHeight; float n = IsUseInside ? 1 : 0; packWidth = Width - spacingW - n; packHeight = Height - spacingH - n; float headerH = gridViewCore.HeaderHeight + gridViewCore.HeaderSpacing; if (contentSize.Height > gridViewCore.GetViewportHeight()) { scrollBarVertical.Width = VerScrollSize; scrollBarVertical.Height = Height; scrollBarVertical.Visible = true; gridViewPack.Width = packWidth - scrollBarVertical.Width; seletorScreen.Width = packWidth + SelectorMargin.left + SelectorMargin.right - scrollBarVertical.Width; gridViewCore.Width = packWidth - scrollBarVertical.Width; } else { scrollBarVertical.Visible = false; gridViewPack.Width = packWidth; seletorScreen.Width = packWidth + SelectorMargin.left + SelectorMargin.right; gridViewCore.Width = packWidth; } if (contentSize.Width > gridViewCore.GetViewportWidth()) { scrollBarHorizontal.Width = Width; scrollBarHorizontal.Height = HorScrollSize; scrollBarHorizontal.Visible = true; gridViewPack.Height = packHeight - scrollBarHorizontal.Height; seletorScreen.Height = Height - spacingH - headerH + SelectorMargin.top + SelectorMargin.bottom - scrollBarHorizontal.Height; gridViewCore.Height = packHeight - scrollBarHorizontal.Height; } else { scrollBarHorizontal.Visible = false; gridViewPack.Height = packHeight; seletorScreen.Height = Height - spacingH - headerH + SelectorMargin.top + SelectorMargin.bottom; gridViewCore.Height = packHeight; } if (scrollBarVertical.Visible && scrollBarHorizontal.Visible) { scrollBarHorizontal.Width = Width - scrollBarVertical.Width; scrollBarVertical.Height = Height - scrollBarHorizontal.Height; } if (scrollBarVertical.Visible) { scrollBarVertical.SetSliderRatio(contentSize.Height, gridViewCore.GetViewportHeight()); scrollBarVertical.Location = new PointF(Width - scrollBarVertical.Width, scrollBarVertical.Location.Y); scrollBarVertical.SetSliderLocationByViewport(gridViewCore.GetContentShowPos()); } if (scrollBarHorizontal.Visible) { PointF screenLoctain = gridViewCore.GetScreenLoaction(); scrollBarHorizontal.SetSliderRatio(contentSize.Width, gridViewCore.Width); scrollBarHorizontal.Location = new PointF(scrollBarHorizontal.Location.X, Height - scrollBarHorizontal.Height); scrollBarHorizontal.SetSliderLocationByViewport(-screenLoctain.X); } if (ShadowLayer != null) { ScShadow shadow = (ScShadow)ShadowLayer; switch (ShadowStyle) { case 0: shadow.DirectionRect = new RectangleF( DirectionRect.X - shadow.ShadowRadius, DirectionRect.Y + shadow.ShadowRadius, DirectionRect.Width + shadow.ShadowRadius * 2, DirectionRect.Height); break; case 1: shadow.DirectionRect = new RectangleF( DirectionRect.X + gridViewPack.DirectionRect.X - shadow.ShadowRadius, DirectionRect.Y + gridViewPack.DirectionRect.Y + shadow.ShadowRadius, gridViewPack.Width + shadow.ShadowRadius * 2, gridViewPack.Height); break; case 2: shadow.DirectionRect = new RectangleF( DirectionRect.X - shadow.ShadowRadius, DirectionRect.Y - shadow.ShadowRadius, DirectionRect.Width + shadow.ShadowRadius * 2, DirectionRect.Height + shadow.ShadowRadius * 2); break; case 3: shadow.DirectionRect = new RectangleF( DirectionRect.X + gridViewPack.DirectionRect.X - shadow.ShadowRadius, DirectionRect.Y + gridViewPack.DirectionRect.Y - shadow.ShadowRadius, gridViewPack.Width + shadow.ShadowRadius * 2, gridViewPack.Height + shadow.ShadowRadius * 2); break; } } }