public override void Draw(CustomGraphics g) { base.Draw(g); /* BC required for highlighting */ drawLead(mPoint1, mPoint2); g.FillPolygon(NeedsHighlight ? CustomGraphics.SelectColor : CustomGraphics.GrayColor, mArrowPoly); doDots(); setBbox(mPoint1, mPoint2, 3); string s = "A"; switch (mMeter) { case AM_VOL: s = Utils.UnitTextWithScale(mCurrent, "A", mScale); break; case AM_RMS: s = Utils.UnitTextWithScale(mRmsI, "A(rms)", mScale); break; } if (mNameV) { g.DrawRightVText(s, mTextPos.X, mTextPos.Y); } else { g.DrawRightText(s, mTextPos.X, mTextPos.Y); } drawPosts(); }
/// <summary> /// draw component values (number of resistor ohms, etc). /// </summary> /// <param name="s"></param> protected void drawValues(string s, int offsetX = 0, int offsetY = 0) { if (s == null) { return; } var textSize = Context.GetTextSize(s); int xc, yc; if ((this is RailElm) || (this is SweepElm)) { xc = P2.X; yc = P2.Y; } else { xc = (P2.X + P1.X) / 2; yc = (P2.Y + P1.Y) / 2; } Context.DrawRightText(s, xc + offsetX, (int)(yc - textSize.Height + offsetY)); }
public override void Draw(CustomGraphics g) { setBbox(P1, P2); draw2Leads(); if (waveform == WAVEFORM.DC) { int hs = 12; setBbox(mPoint1, mPoint2, hs); interpLeadAB(ref mPs1, ref mPs2, 0, hs * 0.5); drawLead(mPs1, mPs2); interpLeadAB(ref mPs1, ref mPs2, 1, hs); drawLead(mPs1, mPs2); string s = Utils.UnitText(mMaxVoltage, "V"); g.DrawRightText(s, mTextPos.X, mTextPos.Y); } else { setBbox(mPoint1, mPoint2, BODY_LEN); interpLead(ref mPs1, 0.5); drawWaveform(g, mPs1); string inds; if (0 < mBias || (0 == mBias && WAVEFORM.PULSE == waveform)) { inds = "+"; } else { inds = "*"; } drawCenteredLText(inds, mTextPos, true); } updateDotCount(); if (CirSim.Sim.DragElm != this) { if (waveform == WAVEFORM.DC) { drawDots(mPoint1, mPoint2, mCurCount); } else { drawDots(mPoint1, mLead1, mCurCount); drawDots(mPoint2, mLead2, -mCurCount); } } drawPosts(); }
public override void Draw(CustomGraphics g) { draw2Leads(); g.DrawCircle(mCenter, BODY_LEN / 2); drawLead(mAshaft1, mAshaft2); g.FillPolygon(NeedsHighlight ? CustomGraphics.SelectColor : CustomGraphics.GrayColor, mArrow); setBbox(mPoint1, mPoint2, BODY_LEN); doDots(); if (ControlPanel.ChkShowValues.Checked) { string s = Utils.UnitText(mCurrentValue, "A"); g.DrawRightText(s, mTextPos.X, mTextPos.Y); } drawPosts(); }