public virtual void PaintSelectionMarks(MNPageContext context) { int x = RelativeArea.X; int y = RelativeArea.Y; int r = RelativeArea.Right; int b = RelativeArea.Bottom; int markWidth = context.PhysicalToLogical(3); if (Dock == SMControlSelection.None || Dock == SMControlSelection.Bottom) { context.g.FillRectangle(Brushes.DarkBlue, (x + r) / 2 - markWidth, y - markWidth, 2 * markWidth, 2 * markWidth); } if (Dock == SMControlSelection.None || Dock == SMControlSelection.Top) { context.g.FillRectangle(Brushes.DarkBlue, (x + r) / 2 - markWidth, b - markWidth, 2 * markWidth, 2 * markWidth); } if (Dock == SMControlSelection.None || Dock == SMControlSelection.Right) { context.g.FillRectangle(Brushes.DarkBlue, x - markWidth, (y + b) / 2 - markWidth, 2 * markWidth, 2 * markWidth); } if (Dock == SMControlSelection.None || Dock == SMControlSelection.Left) { context.g.FillRectangle(Brushes.DarkBlue, r - markWidth, (y + b) / 2 - markWidth, 2 * markWidth, 2 * markWidth); } if (Dock == SMControlSelection.None) { context.g.FillRectangle(Brushes.DarkBlue, x - markWidth, y - markWidth, 2 * markWidth, 2 * markWidth); context.g.FillRectangle(Brushes.DarkBlue, r - markWidth, y - markWidth, 2 * markWidth, 2 * markWidth); context.g.FillRectangle(Brushes.DarkBlue, x - markWidth, b - markWidth, 2 * markWidth, 2 * markWidth); context.g.FillRectangle(Brushes.DarkBlue, r - markWidth, b - markWidth, 2 * markWidth, 2 * markWidth); } }
public override void Paint(MNPageContext context) { Rectangle rect = Area.GetBounds(context); //SizeF offset = SizeF.Empty; SMStatusLayout layout = PrepareBrushesAndPens(); Font usedFont = GetUsedFont(); CalcCells(context.g, usedFont, rect); if (DrawnObjects.Count < Objects.Count) { MixObjects(context.drawSelectionMarks); } bool enabledBorder = true; List <int> drw = DrawnObjects; if (moveTapIndex >= 0) { drw = new List <int>(); drw.AddRange(DrawnObjects); int a = drw[startTapIndex]; drw.RemoveAt(startTapIndex); drw.Insert(moveTapIndex, a); } float floating_offset = 0; Rectangle r, showRect; int j = 0; Point lastPoint = context.PhysicalToLogical(context.lastClientPoint); for (int i = 0; i < drw.Count; i++, j++) { int objectIndex; if (moveTapIndex >= 0 && moveTapIndex == j) { objectIndex = startObjectIndex; } else { objectIndex = drw[j]; if (objectIndex == startObjectIndex) { j++; objectIndex = drw[j]; } } StringItem obj = Objects[objectIndex]; r = obj.Rectangle; r.Location = rect.Location; if (Orientation == SMTextDirection.Horizontal) { r.X += (int)floating_offset; } else { r.Y += (int)floating_offset; } r.Inflate(-3, -3); showRect = r; showRect.Inflate(-3, -3); // draw object DrawListItem(context, layout, usedFont, showRect, i == 0, obj); // move floating offset if (Orientation == SMTextDirection.Horizontal) { floating_offset += obj.ItemWidth; } else { floating_offset += obj.ItemHeight; } // draw a border Brush br; if (objectIndex == i && enabledBorder && startTapIndex < 0) { if (objectIndex == startObjectIndex) { br = Brushes.BlueViolet; } else { br = Brushes.Green; } } else { if (objectIndex == startObjectIndex) { br = Brushes.BlueViolet; } else { br = Brushes.Gainsboro; } enabledBorder = false; } context.g.FillRectangle(br, r.X, r.Y, 3, r.Height); context.g.FillRectangle(br, r.X, r.Y, r.Width, 3); context.g.FillRectangle(br, r.Right - 3, r.Y, 3, r.Height); context.g.FillRectangle(br, r.X, r.Bottom - 3, r.Width, 3); } if (startObjectIndex >= 0) { showRect = new Rectangle(lastPoint.X - startObjectWidth, lastPoint.Y - startObjectHeight, startObjectWidth * 2, startObjectHeight * 2); context.g.DrawRectangle(Pens.BlueViolet, showRect); DrawListItem(context, layout, usedFont, showRect, false, Objects[startObjectIndex]); } base.Paint(context); }