//============================================================ // <T>绘制处理。</T> // // @param sender 发送者 // @param e:event 事件 //============================================================ public void Paint() { // 检查设置 if (!_setuped) { return; } // 获得设备 FDxDevice2d device = _context.Device; FDxContext2d context = _context.Context; context.TransformIdentity(); // 开始绘制 device.BeginDraw(); // 清空目标 context.Clear(); // 填充背景 if (_designBack) { context.FillRectangle(_designBackBrush.brush, 0, 0, _size.Width, _size.Height); } else { context.FillRectangle(_backBrush, 0, 0, _size.Width, _size.Height); } // 绘制预览层 DrawPreviewLayers(); // 绘制表单 SUiDrawArgs args = new SUiDrawArgs(); args.Context = context; if (_designFrame.DesignVisible) { // 绘制表单 context.TransformIdentity(); _designFrame.Draw(args); // 绘制下拉部分 if (args.DropControl != null) { context.TransformIdentity(); args.DropControl.Draw(args); } } // 绘制辅助器 if (_selection.HasFocusControl()) { // 绘制辅助线 DrawAidLines(); // 绘制辅助器 _designFrame.DrawDesign(args); } // 结束绘制 device.EndDraw(); }
//============================================================ // <T>开始绘制处理。</T> // // @param args 参数 //============================================================ public void Draw(SUiDrawArgs args) { FDxContext2d context = _context.Context; context.TransformIdentity(); // 计算坐标 _location.Assign(_control.CalculateDisplayPosition()); _size.Assign(_control.CalculateDisplaySize()); // 绘制选择区域 if (_designSelect) { // 绘制底版 context.FillRectangle(_selectBackColor.brush, _location.X, _location.Y, _size.Width, _size.Height); // 绘制边线 context.DrawRectangle(_selectForeColor.brush, _location.X, _location.Y, _size.Width, _size.Height); } // 绘制辅助点区域 if (_designFocus) { CalculatePoints(); foreach (SUiControlPoint point in _points) { DrawPoint(point); } } }
//============================================================ // <T>绘制处理。</T> // // @param sender 发送者 // @param e:event 事件 //============================================================ public void Paint() { // 获得设备 FDxDevice2d device = _context.Device; _context.TransformIdentity(); // 开始绘制 device.BeginDraw(); // 清空目标 _context.Clear(); // 绘制层 DrawLayers(); // 绘制出生点 DrawBirths(); // 结束绘制 device.EndDraw(); }
//============================================================ // <T>绘制辅助线。</T> //============================================================ public bool DrawAidLines() { // 检查状态 FUiControl focusControl = _selection.FocusControl; if (focusControl == null) { return(false); } FUiControl parent = focusControl.Parent as FUiControl; if (parent == null) { return(false); } // 获得环境 float scale = _context.Scale; FDxContext2d context = _context.Context; context.TransformIdentity(); // 绘制对齐线 SIntPoint2 location = focusControl.CalculateDisplayPosition(); SIntSize2 size = focusControl.CalculateDisplaySize(); foreach (FUiComponent component in parent.Components) { FUiControl control = component as FUiControl; // 检查变量 if (control == null) { continue; } if (control == focusControl) { continue; } // 计算坐标 SIntPoint2 findLocation = control.CalculateDisplayPosition(); SIntSize2 findSize = control.CalculateDisplaySize(); // 左辅助线 if (location.X == findLocation.X) { context.DrawLineLayer(location.X, 0, location.X, _size.Height, _lineBackBrush, _lineForeBrush, _lineWidth, _lineForeStrokeStyle); } // 上辅助线 if (location.Y == findLocation.Y) { context.DrawLineLayer(0, location.Y, _size.Width, location.Y, _lineBackBrush, _lineForeBrush, _lineWidth, _lineForeStrokeStyle); } // 右辅助线 int right = findLocation.X + findSize.Width; if (location.X + size.Width == right) { context.DrawLineLayer(right, 0, right, _size.Height, _lineBackBrush, _lineForeBrush, _lineWidth, _lineForeStrokeStyle); } // 下辅助线 int bottom = findLocation.Y + findSize.Height; if (location.Y + size.Height == bottom) { context.DrawLineLayer(0, bottom, _size.Width, bottom, _lineBackBrush, _lineForeBrush, _lineWidth, _lineForeStrokeStyle); } } return(true); }