/** * Will set the Rectangle currently used for the background to the given Rectangle * @param newBackGround this paramiter can not be null */ protected void setBackgroundRectangle(DrawRectangle newBackGround) { if (newBackGround != null) { Background = newBackGround; } }
public override void Draw(Graphics g) { Pen pen = new Pen(Color, PenWidth); Brush brushout = new SolidBrush(Color.FromArgb(255, 0, 255, 255)); g.SmoothingMode = SmoothingMode.AntiAlias; if (!_flag) { Rectangle frect = new Rectangle(Rectangle.X, Rectangle.Y, Rectangle.Width, Rectangle.Height); g.FillRectangle(brushout, frect); //填充区域 g.DrawRectangle(pen, Rectangle); //画外框 } else { g.DrawRectangle(pen, DrawRectangle.GetNormalizedRectangle(Rectangle)); } Brush brushin0 = new SolidBrush(Color.Red); StringFormat style = new StringFormat(); style.Alignment = StringAlignment.Near; if (_showProperty) { g.DrawString( LogicIDTail, new Font("宋体", 9, FontStyle.Regular), brushin0, Rectangle, style); } pen.Dispose(); }
public override void OnMouseUp(Designer designer, System.Windows.Forms.MouseEventArgs e) { //如果是区域选择,选中在此区域的对像 if (selectmode == SelectionMode.NetSelection) { designer.Items.SelectInRectangle(designer.SelectRectangle); selectmode = SelectionMode.None; designer.IsDrawSelectRectangle = false; } //如果是改变大小则结束改变 if (resizeObject != null) { resizeObject.Normalize(); //如果改变对像的尺寸大小 if (designer.SelectDrawText != null && (resizeObject.GetType().Name == designer.SelectDrawText.GetType().Name)) { Rectangle rectangle = DrawRectangle.GetNormalizedRectangle((resizeObject as DrawText).Rectangle); designer.textBox.Location = new Point(rectangle.X + 8, rectangle.Y + 7); designer.textBox.Size = new Size(rectangle.Width - 10, rectangle.Height - 10); // designer.textBox.Focus(); //设置当前选中的文本编辑器 //在多个编辑切换时,可以知道当前编辑的是哪一个 } resizeObject = null; } designer.Capture = false; designer.Refresh(); }
/// <summary> /// Right mouse button is released /// </summary> /// <param name="drawArea"></param> /// <param name="e"></param> public override void OnMouseUp(DrawArea drawArea, MouseEventArgs e) { if (selectMode == SelectionMode.NetSelection) { // Remove old selection rectangle ControlPaint.DrawReversibleFrame( drawArea.RectangleToScreen(DrawRectangle.GetNormalizedRectangle(startPoint, lastPoint)), Color.Black, FrameStyle.Dashed); // Make group selection drawArea.GraphicsList.SelectInRectangle( DrawRectangle.GetNormalizedRectangle(startPoint, lastPoint)); selectMode = SelectionMode.None; } if (resizedObject != null) { // after resizing resizedObject.Normalize(); resizedObject = null; } drawArea.Capture = false; drawArea.Refresh(); if (commandChangeState != null && wasMove) { // Keep state after moving/resizing and add command to history commandChangeState.NewState(drawArea.GraphicsList); drawArea.AddCommandToHistory(commandChangeState); commandChangeState = null; } }
public void Draw(SpriteBatch spriteBatch) { if (DrawRectangle.Intersects(Camera.Rectangle)) { spriteBatch.Draw(spritesheet, Camera.RelativeRectangle(DrawRectangle), animation.Frame, Color.White); } }
/** * will set the max Segment of the bar * @param newmaxSegments * @return whether or not changes were made */ public bool setMaxSegments(int newmaxSegments) { if (newmaxSegments >= 0) { if (maxSegments != newmaxSegments) { maxSegments = newmaxSegments; if (filledSegments > maxSegments) { filledSegments = maxSegments; } else { while (maxSegments > barSegments.Count) { DrawRectangle newSegment = new DrawRectangle(); newSegment.edgeColor = Color.Black; newSegment.edgeWidth = 0.2f; barSegments.Add(newSegment); } } segmentsOutdated = true; } return(true); } return(false); }
private void DrawGizmos2() { //Draw land bounds DrawRectangle.ForGizmo(_target.LayoutBounds, Color.gray); //Get intersection points if (Application.isPlaying) { if (IsMapMode()) { //Draw cursor-map intersection var mapInter = GetMapIntersection(); if (mapInter.HasValue) { Gizmos.color = Color.red; Gizmos.DrawSphere(mapInter.Value, 0.05f); DrawChunkAndBlock(Convert(mapInter.Value)); if (IsLayoutMode()) { DrawSelectedZone(Convert(mapInter.Value)); } } } else if (IsLayoutMode()) { var layoutHit = GetLayoutIntersection(); if (layoutHit.HasValue) { DrawSelectedZone(layoutHit.Value); DrawChunkAndBlock(layoutHit.Value); } } } }
private void DrawSelectedZone(Vector2 worldPosition) { //Calc zone under cursor if (_main.LandLayout != null && _main.LandLayout.Zones.Any() && _main.LandLayout.Bounds.Contains((Vector2i)worldPosition)) { var selectedZone = _main.LandLayout.Zones.OrderBy(z => Vector2.SqrMagnitude(z.Center - worldPosition)).First(); var zoneColor = _target[selectedZone.Type].LandColor; Gizmos.color = zoneColor; //Draw zone bounds //foreach (var chunk in selectedZone.ChunkBounds) //DrawRectangle.ForGizmo(Chunk.GetBounds(chunk), zoneColor); foreach (var chunk in _main.LandLayout.GetChunks(selectedZone)) { DrawRectangle.ForGizmo(Chunk.GetBounds(chunk), zoneColor); } foreach (var block in selectedZone.GetBlocks2()) { var blockBounds = new Bounds2i(block, 1, 1); DrawRectangle.ForGizmo(blockBounds, zoneColor); } } }
public UiElement() { InputManager.MousePosition.Subscribe(pos => { if (DrawRectangle.Contains(pos)) { IsHovered = true; hover.OnNext(new UiEvent() { Source = this }); } else { IsHovered = false; } }); InputManager.LeftMouseButtonState.DistinctUntilChanged().Subscribe(mouseEvent => { if (DrawRectangle.Contains(mouseEvent.Position)) { if (mouseEvent.Pressed) { click.OnNext(new UiEvent() { Source = this }); } } }); font = ContentLoader.GetFont("x32"); }
public void setPercent(float value) { fillBarBackground.setCenter(base.getCenterX(), base.getCenterY()); fillBarBackground.setSize(base.getWidth() - (edgeSize * 2.0f), base.getHeight() - (edgeSize * 2.0f)); percent = value; if (fillBar == null) { fillBar = new DrawRectangle(); fillBar.fillColor = Color.Chartreuse; fillBar.edgeColor = Color.FromArgb(0, 0, 0, 0); } if (percent <= 0.0f) { percent = 0.0f; fillBar.rectangleVisible = false; } else { if (percent > 1.0f) { percent = 1.0f; } fillBar.rectangleVisible = true; } float bufferSizeX = edgeSize; float bufferSizeY = edgeSize; float barSizeX = base.getWidth() - (bufferSizeX * 2.0f); float barSizeY = base.getHeight() - (bufferSizeY * 2.0f); if (fillOnX) { barSizeX *= percent; fillBar.setWidth(barSizeX); fillBar.setHeight(barSizeY); fillBar.setCenterX(base.getCenterX() - (base.getWidth() * 0.5f) + bufferSizeX + (barSizeX * 0.5f)); fillBar.setCenterY(base.getCenterY()); } else { barSizeY *= percent; fillBar.setWidth(barSizeX); fillBar.setHeight(barSizeY); fillBar.setCenterX(base.getCenterX()); fillBar.setCenterY(base.getCenterY() + (base.getHeight() * 0.5f) - bufferSizeY - (barSizeY * 0.5f)); } }
public bool checkPlayerCollision(Rectangle rect) { if (DrawRectangle.Intersects(rect)) { return(true); } return(false); }
protected void initializeWeb() { if (web == null) { web = new DrawRectangle(); web.fillColor = Color.Black; web.visible = false; } hangTop.X = base.getCenterX(); hangTop.Y = base.getCenterY(); }
public void Update(float dt) { MouseState input = Mouse.GetState(); Point mousePosition = new Point(input.X, input.Y); if (DrawRectangle.Contains(mousePosition) && input.LeftButton == ButtonState.Pressed) { Console.WriteLine("clicked"); // change color of button or text? } }
public PowerBar() { base.fillColor = Color.Black; base.edgeColor = Color.FromArgb(0, 0, 0, 0); fillBarBackground = new DrawRectangle(); fillBarBackground.fillColor = Color.DarkGray; fillBarBackground.edgeColor = Color.FromArgb(0, 0, 0, 0); setPercent(1.0f); }
void Awake() { _instance = this; CheckCount = 0; MoveCount = 0; isMoveMap = false; Shader shader = Shader.Find("Hidden/Internal-Colored"); lineColor = new Material(shader); isOnUI = false; }
public BaseEnemy(ResourceLibrary library) : base() { hostSet = null; hostNode = null; base.setCenterY(-5); base.setSize(5f, 5f); base.rectangleVisible = false; base.spriteVisible = true; base.visible = true; unrevealedSprite = (Sprite)BaseCode.activeLibrary.getResource("GhostLight/GhostLight/resources/unrevealed.png"); selected = new DrawRectangle(); selected.visible = false; selected.setSprite((Sprite)BaseCode.activeLibrary.getResource("GhostLight/GhostLight/resources/glow.png")); selected.rectangleVisible = false; updateSelected(); highLight = new DrawRectangle(); highLight.visible = true; highLight.setSprite((Sprite)BaseCode.activeLibrary.getResource("GhostLight/GhostLight/resources/sparcle/sparcle1.png")); highLight.rectangleVisible = false; updateHighLight(); highLight.visible = false; displayedScore = new Text(); displayedScore.targetFont = (LoadableFont)BaseCode.activeLibrary.getResource(LoadableFont.createFontID("Comic Sans MS", 1.5f, FontStyle.Italic)); displayedScore.textColor = Color.White; displayedScore.visible = false; updateDisplayedScore(); health.setMaxSegments(2); health.setMaxSegments(health.getMaxSegments()); health.visible = false; health.setWidth(base.getWidth()); health.setHeight(1.4f); health.setColor(Color.LightGreen); infectBar.setColor(Color.FromArgb(10, 80, 40)); infectBar.visible = false; infectCloud = new DrawRectangle(); infectCloud.setSprite((Sprite)library.getResource("GhostLight/GhostLight/resources/infected.png")); infectCloud.rectangleVisible = false; infectCloud.visible = false; base.setPriority(2); updateImage(); }
void OnDrawGizmos() { if (_handle1 && _handle2) { Gizmos.color = Color.white; Gizmos.DrawLine(_handle1.transform.position, _handle2.transform.position); //var p1 = new Vector2i(_handle1.transform.position.x, _handle1.transform.position.z); //var p2 = new Vector2i(_handle2.transform.position.x, _handle2.transform.position.z); var p1 = new Vector2(_handle1.transform.position.x, _handle1.transform.position.z); var p2 = new Vector2(_handle2.transform.position.x, _handle2.transform.position.z); var pi1 = (Vector2i)p1; var pi2 = (Vector2i)p2; //var points = Rasterization.DDA(p1, p2, true).ToArray(); Debug.Log("Rasterization.DDA conservative"); var pointsDDA = Rasterization.DDA(p1, p2, false).ToArray(); //var points = Rasterization.lineNoDiag(pi1.X, pi1.Z, pi2.X, pi2.Z).ToArray(); Debug.Log("Rasterization.lineNoDiag"); var pointsBresInt = Rasterization.BresenhamInt(pi1, pi2).ToArray(); var pointsBresFloat = Rasterization.BresenhamFloat(p1.X, p1.Y, p2.X, p2.Y).ToArray(); Assert.IsTrue(pointsDDA.Length == pointsDDA.Distinct().Count()); Assert.IsTrue(pointsBresInt.Length == pointsBresInt.Distinct().Count()); Assert.IsTrue(pointsBresFloat.Length == pointsBresFloat.Distinct().Count()); if (counter % 20 < 10) { foreach (var p in pointsDDA) { DrawRectangle.ForGizmo(new Bounds2i(p, 1, 1), Color.white); } } /* * else if (counter % 21 < 14) * foreach (var p in pointsBresInt) * DrawRectangle.ForGizmo(new Bounds2i(p, 1, 1), Color.red); */ else //if (counter % 21 >= 14) { foreach (var p in pointsBresFloat) { DrawRectangle.ForGizmo(new Bounds2i(p, 1, 1), Color.green); } } counter++; } }
private void DrawChunkAndBlock(Vector2 worldPosition) { const float yOffset = 0.01f; if (IsMapMode()) { var chunkPos = Chunk.GetPosition(worldPosition); Chunk chunk; if (_main.Map.Map.TryGetValue(chunkPos, out chunk)) { //Draw chunk bounds var chunkBounds = (Bounds)Chunk.GetBounds(chunkPos); var r1 = new Vector3(chunkBounds.min.x, chunk.HeightMap[0, 0] + yOffset, chunkBounds.min.z); var r2 = new Vector3(chunkBounds.max.x, chunk.HeightMap[chunk.GridSize - 1, 0] + yOffset, chunkBounds.min.z); var r3 = new Vector3(chunkBounds.min.x, chunk.HeightMap[0, chunk.GridSize - 1] + yOffset, chunkBounds.max.z); var r4 = new Vector3(chunkBounds.max.x, chunk.HeightMap[chunk.GridSize - 1, chunk.GridSize - 1] + yOffset, chunkBounds.max.z); DrawPolyline.ForGizmo(GetChunkPolyBound(chunk, yOffset), Color.red); //Draw block bounds var blockPos = (Vector2i)worldPosition; var localPos = Chunk.GetLocalPosition(worldPosition); r1 = new Vector3(blockPos.X, chunk.HeightMap[localPos.X, localPos.Z] + yOffset, blockPos.Z); r2 = new Vector3(blockPos.X + 1, chunk.HeightMap[localPos.X + 1, localPos.Z] + yOffset, blockPos.Z); r3 = new Vector3(blockPos.X, chunk.HeightMap[localPos.X, localPos.Z + 1] + yOffset, blockPos.Z + 1); r4 = new Vector3(blockPos.X + 1, chunk.HeightMap[localPos.X + 1, localPos.Z + 1] + yOffset, blockPos.Z + 1); DrawRectangle.ForDebug(r1, r2, r4, r3, Color.red); //Draw block normal var n1 = chunk.NormalMap[localPos.X, localPos.Z]; var blockCenter = (r1 + r2 + r3 + r4) / 4; DrawArrow.ForDebug(blockCenter, n1, Color.red); } } else //Layout mode { //Draw chunk bounds var chunkPos = Chunk.GetPosition(worldPosition); var chunkBounds = Chunk.GetBounds(chunkPos); DrawRectangle.ForGizmo(chunkBounds, Color.red); //Draw block bounds DrawRectangle.ForGizmo(new Bounds2i((Vector2i)worldPosition, 1, 1), Color.red); } }
public override void OnMouseUp(Designer designer, MouseEventArgs e) { //当添加文本编辑时用文本框进行输入编辑内容 Rectangle rectangle = DrawRectangle.GetNormalizedRectangle((designer.Items[0] as DrawText).Rectangle); designer.textBox.Location = new Point(rectangle.X + 8, rectangle.Y + 7); designer.textBox.Size = new Size(rectangle.Width - 14, rectangle.Height - 14); designer.textBox.Enabled = true; designer.textBox.Visible = true; designer.textBox.Text = ""; designer.textBox.Font = (designer.Items[0] as DrawText).TextFont; designer.textBox.Focus(); //设置当前选中的文本编辑器 //在多个编辑切换时,可以知道当前编辑的是哪一个 designer.SelectDrawText = designer.Items[0] as DrawText; }
protected override Quad ComputeScreenSpaceDrawQuad() { if (EdgeSmoothness == Vector2.Zero) { inflationAmount = Vector2.Zero; return(base.ComputeScreenSpaceDrawQuad()); } Debug.Assert( EdgeSmoothness.X <= MAX_EDGE_SMOOTHNESS && EdgeSmoothness.Y <= MAX_EDGE_SMOOTHNESS, $@"May not smooth more than {MAX_EDGE_SMOOTHNESS} or will leak neighboring textures in atlas."); Vector3 scale = DrawInfo.MatrixInverse.ExtractScale(); inflationAmount = new Vector2(scale.X * EdgeSmoothness.X, scale.Y * EdgeSmoothness.Y); return(ToScreenSpace(DrawRectangle.Inflate(inflationAmount))); }
void OnDrawGizmos() { if (ShowChunksValue) { foreach (var valuableChunk in ValuableChunkPos(Range)) { DrawRectangle.ForGizmo( Chunk.GetBounds(valuableChunk.Position), Color.Lerp(Color.black, Color.red, valuableChunk.Value), true); } } if (DebugDraw) { DrawArrow.ForGizmo(transform.position, transform.forward * 10, Color.magenta, 3); } }
protected override Quad ComputeScreenSpaceDrawQuad() { if (EdgeSmoothness == Vector2.Zero) { inflationAmount = Vector2.Zero; return(base.ComputeScreenSpaceDrawQuad()); } if (EdgeSmoothness.X > MAX_EDGE_SMOOTHNESS || EdgeSmoothness.Y > MAX_EDGE_SMOOTHNESS) { throw new InvalidOperationException($"May not smooth more than {MAX_EDGE_SMOOTHNESS} or will leak neighboring textures in atlas. Tried to smooth by ({EdgeSmoothness.X}, {EdgeSmoothness.Y})."); } Vector3 scale = DrawInfo.MatrixInverse.ExtractScale(); inflationAmount = new Vector2(scale.X * EdgeSmoothness.X, scale.Y * EdgeSmoothness.Y); return(ToScreenSpace(DrawRectangle.Inflate(inflationAmount))); }
/// <inheritdoc /> /// <summary> /// Gets the click area of the slider. /// </summary> /// <returns></returns> protected override bool IsMouseInClickArea() { // The RectY increase of the click area. const int offset = 40; DrawRectangle clickArea; if (IsVertical) { clickArea = new DrawRectangle(ScreenRectangle.X - offset / 2f, ScreenRectangle.Y, ScreenRectangle.Width + offset, ScreenRectangle.Height); } else { clickArea = new DrawRectangle(ScreenRectangle.X, ScreenRectangle.Y - offset / 2f, ScreenRectangle.Width, ScreenRectangle.Height + offset); } return(GraphicsHelper.RectangleContains(clickArea, MouseManager.CurrentState.Position)); }
/** * Will set the center of this objects position to the appropriate position in the animation and increment animPos * Changes animation to move to drop down two rows eating the Enemies in the way when revealed */ protected override void setCenterToAnimatedPosition() { if (dropping && dropTime > 0) { //Moving Spider //if moved down one row successfully if (dropPos >= dropTime) { EatVictem(base.currentRow + dropDistance, currentCollumn); setMoveTarget(); } //Updating Position if target was reset successfully if (dropping) { base.setCenterX((float)(((dropTarget.X - dropStart.X) / 2f) * (1f + Math.Cos((((Math.PI / 2f) * (float)dropPos) - ((Math.PI / 2) * (float)dropTime)) / ((float)dropTime / 2f))) + dropStart.X)); base.setCenterY((float)(((dropTarget.Y - dropStart.Y) / 2f) * (1f + Math.Cos((((Math.PI / 2f) * (float)dropPos) - ((Math.PI / 2) * (float)dropTime)) / ((float)dropTime / 2f))) + dropStart.Y)); dropPos++; //Updating Web //creating new web if nessesary if (web != null && hangTop != null) { //updating web position and length setWebPositionSize(); } } //Moving to position and filling row else { hostSet.moveEnemy(this, currentRow + dropDistance, currentCollumn); fillRowWithEnemies(currentRow); this.setAnimationTarget(currentRow, currentCollumn); } } else { dropping = false; if (web != null) { web.visible = false; } web = null; base.setCenterToAnimatedPosition(); } }
public int checkProjectileCollision(Projectile[] projs) { int damage = 0; for (int i = 0; i < projs.Length; i++) { if (projs[i].IsActive()) { if (DrawRectangle.Intersects(projs[i].DrawRectangle)) { projs[i].DeActivate(); damage = 40; break; } } } return(damage); }
/// <summary> Get the shape implementing Interface.</summary> /// <param name="shapeType">Type of the shape.</param> /// <returns>Shape</returns> public IDrawShape getShape(string shapeType) { IDrawShape shape = null; switch (shapeType) { case "CIRCLE": shape = new DrawCircle(); break; case "RECTANGLE": shape = new DrawRectangle(); break; case "TRIANGLE": shape = new DrawTriangle(); break; } return(shape); }
public void enemyHealthUpdate() { Enemy[] enemies = Controller.getEnemies(); if (enemies != null) { for (int i = 0; i < enemies.Length; i++) { if (enemies[i].IsActive() == true) { if (DrawRectangle.Intersects(enemies[i].DrawRectangle)) { if (enemies[i].timeForTermination == false) { Health -= 50; enemies[i].Health = 0; } } } } } }
/// <summary> /// 在对应的DrawArea上画点或矩形 /// </summary> /// <param name="drawArea">绘画的区域</param> /// <param name="x">矩形或点的x</param> /// <param name="y">矩形或点的y</param> /// <param name="width">宽度</param> /// <param name="height">高度</param> /// <param name="color">颜色</param> /// <param name="isRectangle">是否是矩形</param> private void Draw(DrawArea drawArea, Color color, int x, int y, int width = 2, int height = 2, bool isRectangle = false) { DrawObject o; if (isRectangle) { o = new DrawRectangle(x, y, width, height, Color.Red, Color.Green, drawArea.DrawFilled, drawArea.LineWidth); } else { o = new DrawPoint(x, y, color, drawArea.LineWidth); } int al = drawArea.TheLayers.ActiveLayerIndex; drawArea.TheLayers[al].Graphics.UnselectAll(); o.Selected = true; o.Dirty = true; o.ID = DrawObject.sCurrentDrawObjectId++; drawArea.TheLayers[al].Graphics.Add(o); drawArea.Invalidate(); }
public bool checkPlayerCollision(Rectangle[] rect) { /*if() * { * if(timeForTermination == false) * player.Health -= 50; * * return true; * } * * return false;*/ bool returnValue = false; foreach (Rectangle r in rect) { if (DrawRectangle.Intersects(r)) { returnValue = true; } } return(returnValue); }
/// <summary> /// Left mouse button is pressed /// </summary> /// <param name="drawArea"></param> /// <param name="e"></param> public override void OnMouseDown(DrawArea drawArea, MouseEventArgs e) { commandChangeState = null; wasMove = false; selectMode = SelectionMode.None; Point point = new Point(e.X, e.Y); // Test for resizing (only if control is selected, cursor is on the handle) foreach (DrawObject o in drawArea.GraphicsList.Selection) { int handleNumber = o.HitTest(point); if (handleNumber > 0) { selectMode = SelectionMode.Size; // keep resized object in class member resizedObject = o; resizedObjectHandle = handleNumber; // Since we want to resize only one object, unselect all other objects drawArea.GraphicsList.UnselectAll(); o.Selected = true; commandChangeState = new CommandChangeState(drawArea.GraphicsList); break; } } // Test for move (cursor is on the object) if (selectMode == SelectionMode.None) { int n1 = drawArea.GraphicsList.Count; DrawObject o = null; for (int i = 0; i < n1; i++) { if (drawArea.GraphicsList[i].HitTest(point) == 0) { o = drawArea.GraphicsList[i]; break; } } if (o != null) { selectMode = SelectionMode.Move; // Unselect all if Ctrl is not pressed and clicked object is not selected yet if ((Control.ModifierKeys & Keys.Control) == 0 && !o.Selected) { drawArea.GraphicsList.UnselectAll(); } // Select clicked object o.Selected = true; commandChangeState = new CommandChangeState(drawArea.GraphicsList); drawArea.Cursor = Cursors.SizeAll; } } // Net selection if (selectMode == SelectionMode.None) { // click on background if ((Control.ModifierKeys & Keys.Control) == 0) { drawArea.GraphicsList.UnselectAll(); } selectMode = SelectionMode.NetSelection; } lastPoint.X = e.X; lastPoint.Y = e.Y; startPoint.X = e.X; startPoint.Y = e.Y; drawArea.Capture = true; drawArea.Refresh(); if (selectMode == SelectionMode.NetSelection) { // Draw selection rectangle in initial position ControlPaint.DrawReversibleFrame( drawArea.RectangleToScreen(DrawRectangle.GetNormalizedRectangle(startPoint, lastPoint)), Color.Black, FrameStyle.Dashed); } }
private void DrawBorder(Graphics g,MultiHeader multiHeader,Body body) { //����߿���� RectangleF mrecGridBorder; float x,y,width,height; width = body.RectangleF.Width; height = body.RectangleF.Height; if (multiHeader != null) { x = multiHeader.RectangleF.X; y = multiHeader.RectangleF.Y; height += multiHeader.RectangleF.Height; } else { x = body.RectangleF.X; y = body.RectangleF.Y; } if (this.IsSubTotalPerPage) { DayReport.MultiHeader m = new MultiHeader(1, 1); height += m.RowHeight; m = null; } mrecGridBorder = new RectangleF(x,y,width,height); Pen pen = new Pen(Color.Black,1); GoldPrinter.DrawRectangle dr = new DrawRectangle(); dr.Graphics = g; dr.RectangleF = mrecGridBorder; dr.Pen = pen; switch (GridBorder) { case GridBorderFlag.Single: dr.Draw(); break; case GridBorderFlag.SingleBold: dr.Pen.Width = 2; dr.Draw(); if (multiHeader != null) { dr.RectangleF = body.RectangleF; dr.DrawTopLine(); } break; case GridBorderFlag.Double: dr.Draw(); mrecGridBorder = new RectangleF(x-2,y-2,width+4,height+4); dr.RectangleF = mrecGridBorder; dr.Draw(); break; case GridBorderFlag.DoubleBold: dr.Draw(); mrecGridBorder = new RectangleF(x-2,y-2,width+4,height+4); dr.RectangleF = mrecGridBorder; dr.Pen.Width = 2; dr.Draw(); break; } }