public string ToString(string ttl = "") { string st = ttl + " UGLink SrNum:" + SrNum + " tfx:" + tfx.tfxToString() + "(" + tfx + ")"; if (UC != null) { st += "UCell " + UC.ToString(); } else { st += "ULink no:" + (rcBit81.no) + " Bit81 " + rcBit81.ToString(); } return(st); }
public RenderTargetBitmap CreateCellImage(UCell P, bool candDisp) { Color crFore = pColorDic["CellForeNo"]; Color crFix = pColorDic["CellFixed"]; Color crBgFix = pColorDic["CellBkgdFix"]; Brush br; var bmp = new RenderTargetBitmap(35, 35, 96, 96, PixelFormats.Default); if (P.ECrLst == null) { P.ECrLst = new List <EColor>(); } EColor EC; var drawVisual = new DrawingVisual(); using (var DC = drawVisual.RenderOpen()){ Color bgcr = Colors.Black; if (P.ECrLst != null && (EC = P.ECrLst.FindLast(p => (p.CellBgCr != Colors.Black))) != null) { bgcr = EC.CellBgCr; } if (P.FixedNo > 0) { if (P.ECrLst == null) { P.ECrLst = new List <EColor>(); } P.ECrLst.Add(new EColor((1 << (P.FixedNo - 1)), crFix)); bgcr = crBgFix; } else if (P.CancelB > 0) { if (P.ECrLst == null) { P.ECrLst = new List <EColor>(); } P.ECrLst.Add(new EColor(P.CancelB, Colors.White, crFix)); //reverse } if (bgcr != Colors.Black) { br = new SolidColorBrush(bgcr); DC.DrawRectangle(br, null, new Rect(0, 0, bmp.Width, bmp.Height)); } int dspB = 0; foreach (int no in P.FreeB.IEGet_BtoNo()) { int noB = (1 << no), noP = no + 1, x = (no % 3) * 12, y = (no / 3) * 12; Point pt = new Point(x + 3, y); List <EColor> ECrLst = P.ECrLst; if (ECrLst == null) { continue; } if (ECrLst.Any(p => p == null)) { WriteLine(P.ToString()); } EC = ECrLst.FindLast(p => (p.noB & noB) > 0); if (EC != null) { Color crF = crFore; if (EC.Nbgcr != Colors.Black) { Brush brBg = new SolidColorBrush(EC.Nbgcr); Rect re = new Rect(x + 1, y, 12, 12); // DC.DrawRectangle(brBg, null, re); crF = Colors.White; } else { crF = EC.Ncr; } br = new SolidColorBrush(crF); DC.DrawText(GF8.GFText(noP.ToString(), br), pt); dspB |= (1 << no); } } if ((dspB = (P.FreeB).DifSet(dspB)) > 0) { br = new SolidColorBrush(crFore); foreach (int no in dspB.IEGet_BtoNo()) { int noB = (1 << no), x = (no % 3) * 12, y = (no / 3) * 12; Point pt = new Point(x + 3, y); int noP = no + 1; DC.DrawText(GF8.GFText(noP.ToString(), br), pt); } } } bmp.Render(drawVisual); return(bmp); }