Group: Forum Members
Last Active: 11 Years Ago
Posts: 20,
Visits: 1
|
Hi, I have an NChartControl with an NGridSurface Series plotted on it. I am trying to use GDI drawing to create a rectangle on the surface of this plot. What I want is when I click the mouse on the plot, a rectangle is drawn. The problem I am having is that when I click on the NChart, I can not see the rectangle. I do not know if it is being drawn under the control or if it is being drawn at all. Here is the code I have so far: Dim rect As RectangleDim circlerect As RectangleDim MoveFlag As BooleanDim DrawCircleFlag As BooleanDim DrawRectFlag As BooleanDim ClickX As IntegerDim ClickY As Integer Private Sub NChart_PColor_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NChart_PColor.MouseDownMoveFlag = TrueClickX = e.X ClickY = e.Y If DrawRectFlag Thenrect.X = ClickX - CInt(rect.Width / 2)rect.Y = ClickY - CInt(rect.Height / 2)End IfNChart_PColor.Invalidate() End Sub Private Sub NChart_PColor_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles NChart_PColor.Paint rect = New Rectangle(5, 5, 50, 90)circlerect = New Rectangle(5, 5, 90, 90)DrawRectFlag = True Dim g As Graphics = e.Graphics If DrawRectFlag And MoveFlag Theng.DrawRectangle(Pens.Blue, rect) End IfEnd Sub
|