Dot9BitmapD2D GetDot9BitmapShadow() { if (Width == 0 || Height == 0) { return(null); } float n = ShadowRadius * 4 + CornersRadius * 2; if (Width <= n || Height <= n) { return(null); } key = CornersRadius.ToString() + ShadowRadius.ToString() + ShadowColor.ToString(); Dot9BitmapD2D dot9BitmapShadow; if (ScMgr.dot9BitmaShadowDict.ContainsKey(key)) { dot9BitmapShadow = ScMgr.dot9BitmaShadowDict[key]; } else { dot9BitmapShadow = Dot9BitmapD2D.CreateDot9BoxShadowBitmap((D2DGraphics)ScMgr.Graphics, CornersRadius, ShadowRadius, ShadowColor); ScMgr.dot9BitmaShadowDict.Add(key, dot9BitmapShadow); } return(dot9BitmapShadow); }
private void ScShadow_D2DPaint(D2DGraphics g) { Dot9BitmapD2D dot9Bitmapshadow = GetDot9BitmapShadow(); if (dot9Bitmapshadow == null) { return; } dot9Bitmapshadow.ComputeBitmapStretch((int)Width, (int)Height); dot9Bitmapshadow.DrawTo(g); }