protected override void RenderOverlay() { uint colorCursor = (uint)ColorCursor.ToArgb(); if (UpdateOverlays) { UpdateOverlays = false; UpdateDrawablePositions(); OverlayTextLabels.Clear(); OverlayVertexesUsed = 0; foreach (LabelledLine line in LabelledHorLines) { if (OverlayVertexesUsed < OverlayVertexes.Length - 2) { OverlayVertexes[OverlayVertexesUsed].PositionRhw.X = 0; OverlayVertexes[OverlayVertexesUsed].PositionRhw.Y = (float)SampleToYPos(line.Position); OverlayVertexes[OverlayVertexesUsed].PositionRhw.Z = 0.5f; OverlayVertexes[OverlayVertexesUsed].PositionRhw.W = 1; OverlayVertexes[OverlayVertexesUsed].Color = line.Color; OverlayVertexesUsed++; OverlayVertexes[OverlayVertexesUsed].PositionRhw.X = DirectXWidth; OverlayVertexes[OverlayVertexesUsed].PositionRhw.Y = (float)SampleToYPos(line.Position); OverlayVertexes[OverlayVertexesUsed].PositionRhw.Z = 0.5f; OverlayVertexes[OverlayVertexesUsed].PositionRhw.W = 1; OverlayVertexes[OverlayVertexesUsed].Color = line.Color; OverlayVertexesUsed++; /* add the labels to the label list to draw */ OverlayTextLabels.AddLast(new StringLabel(line.Label, 60, (int)SampleToYPos(line.Position) + 5, line.Color)); } } foreach (LabelledLine line in LabelledVertLines) { if (OverlayVertexesUsed < OverlayVertexes.Length - 4) { double freq = XPosFromSampleNum(line.Position); if (freq >= 0 && freq < DirectXWidth) { OverlayVertexes[OverlayVertexesUsed].PositionRhw.X = 10 + (float)XPosFromSampleNum(line.Position); OverlayVertexes[OverlayVertexesUsed].PositionRhw.Y = 0; OverlayVertexes[OverlayVertexesUsed].PositionRhw.Z = 0.5f; OverlayVertexes[OverlayVertexesUsed].PositionRhw.W = 1; OverlayVertexes[OverlayVertexesUsed].Color = line.Color; OverlayVertexesUsed++; OverlayVertexes[OverlayVertexesUsed].PositionRhw.X = (float)XPosFromSampleNum(line.Position); OverlayVertexes[OverlayVertexesUsed].PositionRhw.Y = 10; OverlayVertexes[OverlayVertexesUsed].PositionRhw.Z = 0.5f; OverlayVertexes[OverlayVertexesUsed].PositionRhw.W = 1; OverlayVertexes[OverlayVertexesUsed].Color = line.Color; OverlayVertexesUsed++; OverlayVertexes[OverlayVertexesUsed].PositionRhw.X = (float)XPosFromSampleNum(line.Position); OverlayVertexes[OverlayVertexesUsed].PositionRhw.Y = 10; OverlayVertexes[OverlayVertexesUsed].PositionRhw.Z = 0.5f; OverlayVertexes[OverlayVertexesUsed].PositionRhw.W = 1; OverlayVertexes[OverlayVertexesUsed].Color = line.Color; OverlayVertexesUsed++; OverlayVertexes[OverlayVertexesUsed].PositionRhw.X = (float)XPosFromSampleNum(line.Position); OverlayVertexes[OverlayVertexesUsed].PositionRhw.Y = DirectXHeight; OverlayVertexes[OverlayVertexesUsed].PositionRhw.Z = 0.5f; OverlayVertexes[OverlayVertexesUsed].PositionRhw.W = 1; OverlayVertexes[OverlayVertexesUsed].Color = line.Color; OverlayVertexesUsed++; /* add the labels to the label list to draw */ OverlayTextLabels.AddLast(new StringLabel(line.Label, (int)XPosFromSampleNum(line.Position) + 5, 15, line.Color)); } } } } /* draw overlay */ if (OverlayVertexesUsed > 0) { Device.DrawUserPrimitives(PrimitiveType.LineList, OverlayVertexesUsed / 2, OverlayVertexes); } foreach (StringLabel label in OverlayTextLabels) { SmallFont.DrawString(null, label.Label, label.X, label.Y, (int)label.Color); } /* draw scale lines and text */ if (ScaleVertexesUsed > 0) { Device.DrawUserPrimitives(PrimitiveType.LineList, ScaleVertexesUsed / 2, ScaleVertexes); } for (double scalePos = ScalePosMin; scalePos <= ScalePosMax; scalePos += ScaleTextDistance) { SmallFont.DrawString(null, " " + (int)(scalePos * ScaleUnitFactor) + " " + ScaleUnit, 10, (int)SampleToYPos(scalePos), (int)(colorCursor & 0x80FFFFFF)); } }
protected override void RenderAxis() { uint colorCursor = (uint)ColorCursor.ToArgb(); uint colorLimiter = (uint)LimiterColor.ToArgb(); int xPos = (int)LastMousePos.X; int yPos = (int)LastMousePos.Y; float limiterLower = (float)XPosFromSampleNum(LimiterLowerLimit); float limiterUpper = (float)XPosFromSampleNum(LimiterUpperLimit); bool mouseInLowerLimit = (xPos <= limiterLower); bool mouseInUpperLimit = (xPos >= limiterUpper); /* only recalc scale lines when axis need to get updated */ if (UpdateAxis) { UpdateAxis = false; ScaleVertexesUsed = 0; /* update bandwith limiters */ LimiterLines[0].PositionRhw.X = limiterLower; LimiterLines[0].PositionRhw.Y = 0; LimiterLines[0].PositionRhw.Z = 0.5f; LimiterLines[0].PositionRhw.W = 1; LimiterLines[0].Color = colorLimiter; LimiterLines[1].PositionRhw.X = limiterLower; LimiterLines[1].PositionRhw.Y = DirectXHeight; LimiterLines[1].PositionRhw.Z = 0.5f; LimiterLines[1].PositionRhw.W = 1; LimiterLines[1].Color = colorLimiter; LimiterLines[2].PositionRhw.X = limiterUpper; LimiterLines[2].PositionRhw.Y = 0; LimiterLines[2].PositionRhw.Z = 0.5f; LimiterLines[2].PositionRhw.W = 1; LimiterLines[2].Color = colorLimiter; LimiterLines[3].PositionRhw.X = limiterUpper; LimiterLines[3].PositionRhw.Y = DirectXHeight; LimiterLines[3].PositionRhw.Z = 0.5f; LimiterLines[3].PositionRhw.W = 1; LimiterLines[3].Color = colorLimiter; BuildStripRectangle(LimiterVertexesLeft, colorLimiter & 0x2FFFFFFF, 0, limiterLower); BuildStripRectangle(LimiterVertexesRight, colorLimiter & 0x2FFFFFFF, limiterUpper, DirectXWidth); int scaleCount = (int)Math.Round((ScalePosMax - ScalePosMin) / ScaleBarDistance); /* draw scale lines */ for (int scaleNum = 0; scaleNum <= scaleCount; scaleNum++) { float scalePos = (float)(ScalePosMin + scaleNum * ScaleBarDistance); ScaleVertexes[ScaleVertexesUsed].PositionRhw.X = 0; ScaleVertexes[ScaleVertexesUsed].PositionRhw.Y = (float)SampleToYPos(scalePos); ScaleVertexes[ScaleVertexesUsed].PositionRhw.Z = 0.5f; ScaleVertexes[ScaleVertexesUsed].PositionRhw.W = 1; ScaleVertexes[ScaleVertexesUsed].Color = colorCursor; ScaleVertexesUsed++; if (scaleNum == 0 || scaleNum == scaleCount || Math.Round(scalePos / ScaleBarDistance) == 0) { ScaleVertexes[ScaleVertexesUsed].PositionRhw.X = 50; } else if (scaleNum % 2 == 0) { ScaleVertexes[ScaleVertexesUsed].PositionRhw.X = 20; } else { ScaleVertexes[ScaleVertexesUsed].PositionRhw.X = 10; } ScaleVertexes[ScaleVertexesUsed].PositionRhw.Y = (float)SampleToYPos(scalePos); ScaleVertexes[ScaleVertexesUsed].PositionRhw.Z = 0.5f; ScaleVertexes[ScaleVertexesUsed].PositionRhw.W = 1; ScaleVertexes[ScaleVertexesUsed].Color = colorCursor & 0x00FFFFFF; ScaleVertexesUsed++; ScaleVertexes[ScaleVertexesUsed].PositionRhw.X = DirectXWidth; ScaleVertexes[ScaleVertexesUsed].PositionRhw.Y = (float)SampleToYPos(scalePos); ScaleVertexes[ScaleVertexesUsed].PositionRhw.Z = 0.5f; ScaleVertexes[ScaleVertexesUsed].PositionRhw.W = 1; ScaleVertexes[ScaleVertexesUsed].Color = colorCursor; ScaleVertexesUsed++; if (scalePos % 100 == 0) { ScaleVertexes[ScaleVertexesUsed].PositionRhw.X = DirectXWidth - 50; } else if (scalePos % 50 == 0) { ScaleVertexes[ScaleVertexesUsed].PositionRhw.X = DirectXWidth - 20; } else { ScaleVertexes[ScaleVertexesUsed].PositionRhw.X = DirectXWidth - 10; } ScaleVertexes[ScaleVertexesUsed].PositionRhw.Y = (float)SampleToYPos(scalePos); ScaleVertexes[ScaleVertexesUsed].PositionRhw.Z = 0.5f; ScaleVertexes[ScaleVertexesUsed].PositionRhw.W = 1; ScaleVertexes[ScaleVertexesUsed].Color = colorCursor & 0x00FFFFFF; ScaleVertexesUsed++; } if (XAxisVerts == null || XAxisVerts.Length < XAxisLines * 4) { XAxisVerts = new Vertex[XAxisLines * 4]; } uint color1 = 0xFF101010; uint color2 = 0xFF404040; uint color3 = 0xFFFFFFFF; for (int pos = 0; pos < XAxisLines; pos++) { float x = (float)(XAxisGridOffset * XZoomFactor - DisplayXOffset + (pos * ((XAxisUnit / PlotVertsEntries) * DirectXWidth) * XZoomFactor)); XAxisVerts[pos * 4 + 0].PositionRhw.X = x; XAxisVerts[pos * 4 + 0].PositionRhw.Y = 0; XAxisVerts[pos * 4 + 0].PositionRhw.Z = 0.5f; XAxisVerts[pos * 4 + 0].PositionRhw.W = 1; XAxisVerts[pos * 4 + 0].Color = color1; XAxisVerts[pos * 4 + 1].PositionRhw.X = x; XAxisVerts[pos * 4 + 1].PositionRhw.Y = DirectXHeight / 2; XAxisVerts[pos * 4 + 1].PositionRhw.Z = 0.5f; XAxisVerts[pos * 4 + 1].PositionRhw.W = 1; XAxisVerts[pos * 4 + 1].Color = color2; XAxisVerts[pos * 4 + 2].PositionRhw.X = x; XAxisVerts[pos * 4 + 2].PositionRhw.Y = DirectXHeight / 2; XAxisVerts[pos * 4 + 2].PositionRhw.Z = 0.5f; XAxisVerts[pos * 4 + 2].PositionRhw.W = 1; XAxisVerts[pos * 4 + 2].Color = color2; XAxisVerts[pos * 4 + 3].PositionRhw.X = x; XAxisVerts[pos * 4 + 3].PositionRhw.Y = DirectXHeight; XAxisVerts[pos * 4 + 3].PositionRhw.Z = 0.5f; XAxisVerts[pos * 4 + 3].PositionRhw.W = 1; XAxisVerts[pos * 4 + 3].Color = color1; } } if (LimiterDisplayEnabled) { Device.DrawUserPrimitives(PrimitiveType.TriangleStrip, 2, LimiterVertexesLeft); Device.DrawUserPrimitives(PrimitiveType.TriangleStrip, 2, LimiterVertexesRight); Device.DrawUserPrimitives(PrimitiveType.LineList, 2, LimiterLines); if (mouseInLowerLimit) { if (xPos > DirectXWidth / 2) { int stringWidth = SmallFont.MeasureString(null, LimiterLowerDescription, DrawTextFormat.Center).Width; SmallFont.DrawString(null, LimiterLowerDescription, xPos - 30 - stringWidth, yPos + 20, (int)(colorLimiter)); } else { SmallFont.DrawString(null, LimiterLowerDescription, xPos + 20, yPos + 20, (int)(colorLimiter)); } } if (mouseInUpperLimit) { if (xPos > DirectXWidth / 2) { int stringWidth = SmallFont.MeasureString(null, LimiterUpperDescription, DrawTextFormat.Center).Width; SmallFont.DrawString(null, LimiterUpperDescription, xPos - 30 - stringWidth, yPos + 20, (int)(colorLimiter)); } else { SmallFont.DrawString(null, LimiterUpperDescription, xPos + 20, yPos + 20, (int)(colorLimiter)); } } } if (XAxisVerts.Length > 0) { Device.DrawUserPrimitives(PrimitiveType.LineList, XAxisVerts.Length / 2, XAxisVerts); } if (YAxisVerts.Length > 0) { Device.DrawUserPrimitives(PrimitiveType.LineList, YAxisVerts.Length / 2, YAxisVerts); } }
protected override void RenderAxis() { uint colorCursor = (uint)ColorCursor.ToArgb(); uint colorLimiter = (uint)LimiterColor.ToArgb(); int xPos = (int)LastMousePos.X; int yPos = (int)LastMousePos.Y; float limiterLower = (float)(LimiterLowerLimit); float limiterUpper = (float)(LimiterUpperLimit); bool mouseInLowerLimit = (xPos <= limiterLower); bool mouseInUpperLimit = (xPos >= limiterUpper); /* only recalc scale lines when axis need to get updated */ if (UpdateAxis) { UpdateAxis = false; ScaleVertexesUsed = 0; BuildStripRectangle(LimiterVertexesLeft, colorLimiter & 0x2FFFFFFF, 0, limiterLower); BuildStripRectangle(LimiterVertexesRight, colorLimiter & 0x2FFFFFFF, limiterUpper, DirectXWidth); int scaleCount = (int)Math.Round((ScalePosMax - ScalePosMin) / ScaleBarDistance); /* draw scale lines */ for (int scaleNum = 0; scaleNum <= scaleCount; scaleNum++) { float scalePos = (float)(ScalePosMin + scaleNum * ScaleBarDistance); ScaleVertexes[ScaleVertexesUsed].PositionRhw.X = 0; ScaleVertexes[ScaleVertexesUsed].PositionRhw.Y = scalePos; ScaleVertexes[ScaleVertexesUsed].PositionRhw.Z = 0.5f; ScaleVertexes[ScaleVertexesUsed].PositionRhw.W = 1; ScaleVertexes[ScaleVertexesUsed].Color = colorCursor; ScaleVertexesUsed++; if (scaleNum == 0 || scaleNum == scaleCount || Math.Round(scalePos / ScaleBarDistance) == 0) { ScaleVertexes[ScaleVertexesUsed].PositionRhw.X = 50; } else if (scaleNum % 2 == 0) { ScaleVertexes[ScaleVertexesUsed].PositionRhw.X = 20; } else { ScaleVertexes[ScaleVertexesUsed].PositionRhw.X = 10; } ScaleVertexes[ScaleVertexesUsed].PositionRhw.Y = scalePos; ScaleVertexes[ScaleVertexesUsed].PositionRhw.Z = 0.5f; ScaleVertexes[ScaleVertexesUsed].PositionRhw.W = 1; ScaleVertexes[ScaleVertexesUsed].Color = colorCursor & 0x00FFFFFF; ScaleVertexesUsed++; ScaleVertexes[ScaleVertexesUsed].PositionRhw.X = DirectXWidth; ScaleVertexes[ScaleVertexesUsed].PositionRhw.Y = scalePos; ScaleVertexes[ScaleVertexesUsed].PositionRhw.Z = 0.5f; ScaleVertexes[ScaleVertexesUsed].PositionRhw.W = 1; ScaleVertexes[ScaleVertexesUsed].Color = colorCursor; ScaleVertexesUsed++; if (scalePos % 100 == 0) { ScaleVertexes[ScaleVertexesUsed].PositionRhw.X = DirectXWidth - 50; } else if (scalePos % 50 == 0) { ScaleVertexes[ScaleVertexesUsed].PositionRhw.X = DirectXWidth - 20; } else { ScaleVertexes[ScaleVertexesUsed].PositionRhw.X = DirectXWidth - 10; } ScaleVertexes[ScaleVertexesUsed].PositionRhw.Y = scalePos; ScaleVertexes[ScaleVertexesUsed].PositionRhw.Z = 0.5f; ScaleVertexes[ScaleVertexesUsed].PositionRhw.W = 1; ScaleVertexes[ScaleVertexesUsed].Color = colorCursor & 0x00FFFFFF; ScaleVertexesUsed++; } } if (LimiterDisplayEnabled) { Device.DrawUserPrimitives(PrimitiveType.TriangleStrip, 2, LimiterVertexesLeft); Device.DrawUserPrimitives(PrimitiveType.TriangleStrip, 2, LimiterVertexesRight); Device.DrawUserPrimitives(PrimitiveType.LineList, 2, LimiterLines); if (mouseInLowerLimit) { if (xPos > DirectXWidth / 2) { int stringWidth = SmallFont.MeasureString(null, LimiterLowerDescription, DrawTextFormat.Center).Width; SmallFont.DrawString(null, LimiterLowerDescription, xPos - 30 - stringWidth, yPos + 20, (int)(colorLimiter)); } else { SmallFont.DrawString(null, LimiterLowerDescription, xPos + 20, yPos + 20, (int)(colorLimiter)); } } if (mouseInUpperLimit) { if (xPos > DirectXWidth / 2) { int stringWidth = SmallFont.MeasureString(null, LimiterUpperDescription, DrawTextFormat.Center).Width; SmallFont.DrawString(null, LimiterUpperDescription, xPos - 30 - stringWidth, yPos + 20, (int)(colorLimiter)); } else { SmallFont.DrawString(null, LimiterUpperDescription, xPos + 20, yPos + 20, (int)(colorLimiter)); } } } if (XAxisVerts.Length > 0) { Device.DrawUserPrimitives(PrimitiveType.LineList, XAxisVerts.Length / 2, XAxisVerts); } if (YAxisVerts.Length > 0) { Device.DrawUserPrimitives(PrimitiveType.LineList, YAxisVerts.Length / 2, YAxisVerts); } }
protected override void RenderCursor() { uint colorCursor = (uint)ColorCursor.ToArgb(); uint colorCursorBox = (uint)CursorBoxColor.ToArgb(); float stubLength = (float)DirectXHeight / 10.0f; float xPos = (float)LastMousePos.X; float yPos = (float)LastMousePos.Y; float unit = (float)(SampleFromYPos(yPos) * ScaleUnitFactor); if (UpdateCursor) { UpdateCursor = false; /* draw vertical cursor line */ if (xPos > DirectXWidth / 2) { CursorVertexesVert[0].PositionRhw.X = xPos - 30; } else { CursorVertexesVert[0].PositionRhw.X = xPos + 30; } CursorVertexesVert[1].PositionRhw.X = xPos; CursorVertexesVert[2].PositionRhw.X = xPos; CursorVertexesVert[3].PositionRhw.X = xPos; /* horizontal line */ CursorVertexesHor[0].PositionRhw.X = xPos - 30; CursorVertexesHor[0].PositionRhw.Y = yPos; CursorVertexesHor[1].PositionRhw.X = xPos; CursorVertexesHor[1].PositionRhw.Y = yPos; CursorVertexesHor[2].PositionRhw.X = xPos + 30; CursorVertexesHor[2].PositionRhw.Y = yPos; /* recalc lines (this is needed just once btw.) */ CursorVertexesVert[0].PositionRhw.Y = 20; CursorVertexesVert[0].PositionRhw.Z = 0.5f; CursorVertexesVert[0].PositionRhw.W = 1; CursorVertexesVert[0].Color = colorCursor & 0x00FFFFFF; CursorVertexesVert[1].PositionRhw.Y = 20 + stubLength; CursorVertexesVert[1].PositionRhw.Z = 0.5f; CursorVertexesVert[1].PositionRhw.W = 1; CursorVertexesVert[1].Color = colorCursor; CursorVertexesVert[2].PositionRhw.Y = DirectXHeight - stubLength; CursorVertexesVert[2].PositionRhw.Z = 0.5f; CursorVertexesVert[2].PositionRhw.W = 1; CursorVertexesVert[2].Color = colorCursor; CursorVertexesVert[3].PositionRhw.Y = DirectXHeight; CursorVertexesVert[3].PositionRhw.Z = 0.5f; CursorVertexesVert[3].PositionRhw.W = 1; CursorVertexesVert[3].Color = colorCursor; CursorVertexesHor[0].PositionRhw.Z = 0.5f; CursorVertexesHor[0].PositionRhw.W = 1; CursorVertexesHor[0].Color = colorCursor & 0x00FFFFFF; CursorVertexesHor[1].PositionRhw.Z = 0.5f; CursorVertexesHor[1].PositionRhw.W = 1; CursorVertexesHor[1].Color = colorCursor; CursorVertexesHor[2].PositionRhw.Z = 0.5f; CursorVertexesHor[2].PositionRhw.W = 1; CursorVertexesHor[2].Color = colorCursor & 0x00FFFFFF; } if (MouseHovering || ShowVerticalCursor) { string signalPower = unit + " " + ScaleUnit; string positionLabel; if (OverviewMode) { positionLabel = XLabelFromSampleNum(xPos); } else { positionLabel = XLabelFromCursorPos(xPos); } int signalPowerWidth = SmallFont.MeasureString(null, signalPower, DrawTextFormat.Center).Width; int positionLabelWidth = SmallFont.MeasureString(null, positionLabel, DrawTextFormat.Center).Width; int signalPowerHeight = SmallFont.MeasureString(null, signalPower, DrawTextFormat.Center).Height; int positionLabelHeight = SmallFont.MeasureString(null, positionLabel, DrawTextFormat.Center).Height; int boxWidth = 10 + Math.Max(signalPowerWidth, positionLabelWidth); int boxHeight = 10 + signalPowerHeight + positionLabelHeight; int boxY = 20; int boxX = (int)xPos; if (xPos > DirectXWidth / 2) { boxX -= boxWidth + 25; } else { boxX += 25; } BuildStripRectangle(CursorRectVertexes, colorCursorBox & 0x3FFFFFFF, boxX, boxX + boxWidth, boxY + boxHeight, boxY); Device.DrawUserPrimitives(PrimitiveType.TriangleStrip, 2, CursorRectVertexes); Device.DrawUserPrimitives(PrimitiveType.LineStrip, 3, CursorVertexesVert); if (MouseHovering) { /* draw the strength into box */ SmallFont.DrawString(null, signalPower, boxX + 5, boxY + 5, ColorFG.ToArgb()); Device.DrawUserPrimitives(PrimitiveType.LineStrip, 2, CursorVertexesHor); } /* draw the horizontal into box */ SmallFont.DrawString(null, positionLabel, boxX + 5, boxY + 5 + signalPowerHeight, ColorFG.ToArgb()); } }
protected void DrawBit(int bitNum, uint color1, uint color2, uint colorText) { float stubLength = (float)DirectXHeight / 3; float bitStartPos = (float)(XAxisGridOffset * XZoomFactor - DisplayXOffset + ((bitNum - 0.5f) * ((XAxisUnit / PlotVertsEntries) * DirectXWidth) * XZoomFactor)); float bitEndPos = (float)(XAxisGridOffset * XZoomFactor - DisplayXOffset + ((bitNum + 0.5f) * ((XAxisUnit / PlotVertsEntries) * DirectXWidth) * XZoomFactor)); //float bitStartPos = (float)(XAxisGridOffset * XZoomFactor - DisplayXOffset + ((bitNum - 0.5f) * XAxisUnit * XZoomFactor * (DirectXWidth / PlotVertsEntries))); //float bitEndPos = (float)(XAxisGridOffset * XZoomFactor - DisplayXOffset + ((bitNum + 0.5f) * XAxisUnit * XZoomFactor * (DirectXWidth / PlotVertsEntries))); float yPos = DirectXHeight / 2; if (bitNum >= 0 && bitNum < BurstBits.Length) { yPos = BurstBits[bitNum] ? stubLength : (DirectXHeight - stubLength); } else { return; } /* draw bit margins */ CursorVertexes[0].PositionRhw.X = bitStartPos; CursorVertexes[0].PositionRhw.Y = DirectXHeight / 2; CursorVertexes[0].PositionRhw.Z = 0.5f; CursorVertexes[0].PositionRhw.W = 1; CursorVertexes[0].Color = color2; CursorVertexes[1].PositionRhw.X = bitStartPos; CursorVertexes[1].PositionRhw.Y = yPos; CursorVertexes[1].PositionRhw.Z = 0.5f; CursorVertexes[1].PositionRhw.W = 1; CursorVertexes[1].Color = color1; CursorVertexes[2].PositionRhw.X = bitEndPos; CursorVertexes[2].PositionRhw.Y = DirectXHeight / 2; CursorVertexes[2].PositionRhw.Z = 0.5f; CursorVertexes[2].PositionRhw.W = 1; CursorVertexes[2].Color = color2; CursorVertexes[3].PositionRhw.X = bitEndPos; CursorVertexes[3].PositionRhw.Y = yPos; CursorVertexes[3].PositionRhw.Z = 0.5f; CursorVertexes[3].PositionRhw.W = 1; CursorVertexes[3].Color = color1; Device.DrawUserPrimitives(PrimitiveType.LineList, 2, CursorVertexes); /* horizontal top line */ CursorVertexes[0].PositionRhw.X = (float)bitStartPos; CursorVertexes[0].PositionRhw.Y = yPos; CursorVertexes[0].PositionRhw.Z = 0.5f; CursorVertexes[0].PositionRhw.W = 1; CursorVertexes[0].Color = color1; CursorVertexes[1].PositionRhw.X = (float)bitEndPos; CursorVertexes[1].PositionRhw.Y = yPos; CursorVertexes[1].PositionRhw.Z = 0.5f; CursorVertexes[1].PositionRhw.W = 1; CursorVertexes[1].Color = color1; Device.DrawUserPrimitives(PrimitiveType.LineList, 1, CursorVertexes); SmallFont.DrawString(null, (bitNum + 1).ToString(), (int)(bitStartPos + bitEndPos) / 2, (int)DirectXHeight / 2, (int)colorText); }