更新

更新

我希望电压和电流源内部填充颜色,就像在和中一样,v_s通过\beta{}v_{\pi}在序言中定义宏来自动填充。有人能建议我怎么做吗?默认情况下,它们不会填充颜色,如果我有许多依赖和独立源,按照我下面所做的方式着色只会使文件变得更大,代码也更多:

\documentclass[border=2pt]{standalone}[2015/09/17]
\usepackage{tikz}
\usetikzlibrary{arrows, circuits.ee.IEC, positioning}
\usepackage[american voltages, american currents,siunitx]{circuitikz}

\begin{document}
\begin{tikzpicture}[circuit ee  IEC, x=3.5cm, y=3.5cm, color=blue!50!black]
    \fill [cyan!40, opacity=0.4] (0,0.4) circle (2.7ex); % color fill v_s
    \draw (1.8,0.4) node[rectangle,draw,xscale=2.8,yscale=2.8,rotate=45,fill=cyan!40,opacity=0.5]{}; % cI

    \draw (2.8,0.0) to (0.0,0.0) to [V, l=$v_s$, color=blue!50!black] (0.0,0.8);
    \draw (0.0,0.8) to [R, l=300<\milli\ohm>, color=blue!50!black] (0.8,0.8) node[circ]{};
    \draw (0.8,0.8) to [cV, l_=$\alpha{}v_{oc}$, color=blue!50!black] (0.8,0.0) node[circ]{};
    \draw (0.8,0.8) to (1.3,0.8) to [R, l_=5<\kilo\ohm>, color=blue!50!black] (1.3,0.0) node[circ]{};
    \draw (2.8,0.8) node[ocirc]{} to (1.8,0.8) to [cI, l=$\beta{}v_{\pi}$, color=blue!50!black] (1.8,0.0) node[circ]{};
    \draw (2.4,0.8) node[circ]{} to [R, l=1<\kilo\ohm>, color=blue!50!black] (2.4,0.0) node[circ]{}
        to (2.8,0.0) node[ocirc]{};

    \draw (1.45,0.6) node[magenta]{$+$};
    \draw (1.45,0.4) node[magenta]{$v_{\pi}$};
    \draw (1.45,0.2) node[magenta]{$-$};

    \draw (2.8,0.7) node[magenta]{$+$};
    \draw (2.8,0.4) node[magenta]{$v_{oc}$};
    \draw (2.8,0.1) node[magenta]{$-$};
\end{tikzpicture}
\end{document}

在此处输入图片描述

我最终从Gonzalo的提示中发现:

\documentclass[border=2pt]{standalone}[2015/09/17]
\usepackage{tikz}
\usetikzlibrary{arrows, circuits.ee.IEC, positioning}
\usepackage[american voltages, american currents,siunitx]{circuitikz}
\usetikzlibrary{backgrounds}

\makeatletter
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/vsourceam/height}}{vsourceAM}              {\ctikzvalof{bipoles/vsourceam/height}}{\ctikzvalof{bipoles/vsourceam/width}}{%
\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}

\pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}

\pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{$+$}
   \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{$-$}

\begin{pgfonlayer}{background}
      \pgfsetfillcolor{vsourceAMcolor}
      \pgfusepath{stroke,draw,fill}
\end{pgfonlayer} 
}


\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/isourceam/height}}{isourceAM}              {\ctikzvalof{bipoles/vsourceam/height}}{\ctikzvalof{bipoles/isourceam/width}}{%

\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}

\pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}

\begin{pgfonlayer}{background}
     \pgfsetfillcolor{isourceAMcolor}
     \pgfusepath{stroke,draw,fill}
\end{pgfonlayer}

     \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
     \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}}
     \pgfusepath{draw,fill}
     \pgfscope
     \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
     \pgfnode{currarrow}{center}{}{}{\pgfusepath{draw}}
     \endpgfscope
}


\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/cvsourceam/height}}{cvsourceAM}       {\ctikzvalof{bipoles/cisourceam/height}}{\ctikzvalof{bipoles/cvsourceam/width}}{%

\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}

    \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
    \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
    \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
    \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
    \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}

\begin{pgfonlayer}{background}
    \pgfsetfillcolor{cvsourceAMcolor}
    \pgfusepath{stroke,draw,fill}
\end{pgfonlayer}

\pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@down]{$+$}
\pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@up]{$-$}
}


\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/cisourceam/height}}{cisourceAM}       {\ctikzvalof{bipoles/cisourceam/height}}{\ctikzvalof{bipoles/cisourceam/width}}{%

\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}

   \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
   \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
   \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
   \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
   \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}

\begin{pgfonlayer}{background}
     \pgfsetfillcolor{cisourceAMcolor}
     \pgfusepath{stroke,draw,fill}
\end{pgfonlayer}

    \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
    \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}}
    \pgfusepath{draw,fill}
    \pgfscope
    \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
    \pgfnode{currarrow}{center}{}{}{\pgfusepath{draw}}
    \endpgfscope
}
\makeatother

\colorlet{vsourceAMcolor}{red!10}
\colorlet{isourceAMcolor}{red!10}
\colorlet{cvsourceAMcolor}{cyan!10}
\colorlet{cisourceAMcolor}{cyan!10}

\begin{document}
\begin{tikzpicture}[circuit ee  IEC, x=3.5cm, y=3.5cm, color=blue!50!black]
    \draw (2.8,0.0) to (0.0,0.0) to [V, l=$v_s$, color=blue!50!black] (0.0,0.8);
    \draw (0.0,0.8) to [R, l=300<\milli\ohm>, color=blue!50!black] (0.8,0.8) node[circ]{};
    \draw (0.8,0.0) to [cV, l=$\alpha{}v_{oc}$, color=blue!50!black] (0.8,0.8) node[circ]{};
    \draw (0.8,0.8) to (1.3,0.8) to [R, l_=5<\kilo\ohm>, color=blue!50!black] (1.3,0.0) node[circ]{};
    \draw (2.8,0.8) node[ocirc]{} to (1.8,0.8) to [cI, l=$\beta{}v_{\pi}$, color=blue!50!black] (1.8,0.0) node[circ]{};
    \draw (2.4,0.8) node[circ]{} to [I, l=1<\ampere>, color=blue!50!black] (2.4,0.0) node[circ]{}
        to (2.8,0.0) node[ocirc]{};

    \draw (1.45,0.6) node[magenta]{$+$};
    \draw (1.45,0.4) node[magenta]{$v_{\pi}$};
    \draw (1.45,0.2) node[magenta]{$-$};

    \draw (2.8,0.7) node[magenta]{$+$};
    \draw (2.8,0.4) node[magenta]{$v_{oc}$};
    \draw (2.8,0.1) node[magenta]{$-$};
\end{tikzpicture}
\end{document}

在此处输入图片描述

我还要感谢 Harish,尽管不透明度对电路元件/标签/信息的可见性/清晰度造成了一点问题,但他还是迅速做出了回应。

最后,我可以这样做:谢谢

\documentclass[border=2pt]{standalone}[2015/09/18]
\usepackage{tikz}
\usetikzlibrary{arrows, circuits.ee.IEC, positioning}
\usepackage[american voltages, american currents,siunitx]{circuitikz}
\usetikzlibrary{backgrounds}

% default color
\colorlet{vsourceAMcolorfill}{white}
\colorlet{vsourceAMcolordraw}{black}
\colorlet{cvsourceAMcolorfill}{white}
\colorlet{cvsourceAMcolordraw}{black}
\colorlet{isourceAMcolorfill}{white}
\colorlet{isourceAMcolordraw}{black}
\colorlet{cisourceAMcolorfill}{white}
\colorlet{cisourceAMcolordraw}{black}

\makeatletter
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/vsourceam/height}}{vsourceAM}              {\ctikzvalof{bipoles/vsourceam/height}}{\ctikzvalof{bipoles/vsourceam/width}}{%
\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}

\pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}

\pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{$+$}
   \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{$-$}

\begin{pgfonlayer}{background}
    \pgfsetfillcolor{vsourceAMcolorfill}
    \pgfsetstrokecolor{vsourceAMcolordraw}
    \pgfusepath{stroke,fill}
\end{pgfonlayer} 
}


\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/isourceam/height}}{isourceAM}              {\ctikzvalof{bipoles/vsourceam/height}}{\ctikzvalof{bipoles/isourceam/width}}{%

\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}

\pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}

\begin{pgfonlayer}{background}
    \pgfsetfillcolor{isourceAMcolorfill}
    \pgfsetstrokecolor{isourceAMcolordraw}
    \pgfusepath{stroke,fill}
\end{pgfonlayer}

     \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
     \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}}
     \pgfusepath{draw,fill}
     \pgfscope
     \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
     \pgfnode{currarrow}{center}{}{}{\pgfusepath{draw}}
     \endpgfscope
}


\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/cvsourceam/height}}{cvsourceAM}       {\ctikzvalof{bipoles/cisourceam/height}}{\ctikzvalof{bipoles/cvsourceam/width}}{%

\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}

    \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
    \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
    \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
    \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
    \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}

\begin{pgfonlayer}{background}
    \pgfsetfillcolor{cvsourceAMcolorfill}
    \pgfsetstrokecolor{cvsourceAMcolordraw}
    \pgfusepath{stroke,fill}
\end{pgfonlayer}

\pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@down]{$+$}
\pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@up]{$-$}
}


\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/cisourceam/height}}{cisourceAM}       {\ctikzvalof{bipoles/cisourceam/height}}{\ctikzvalof{bipoles/cisourceam/width}}{%

\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}

   \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
   \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
   \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
   \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
   \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}

\begin{pgfonlayer}{background}
    \pgfsetfillcolor{cisourceAMcolorfill}
    \pgfsetstrokecolor{cisourceAMcolordraw}
    \pgfusepath{stroke,fill}
\end{pgfonlayer}

    \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
    \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}}
    \pgfusepath{draw,fill}
    \pgfscope
    \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
    \pgfnode{currarrow}{center}{}{}{\pgfusepath{draw}}
    \endpgfscope
}
\makeatother

\begin{document}
\begin{tikzpicture}[circuit ee  IEC, x=3.5cm, y=3.5cm]
    \draw 
        (0,0) to [V, l=$v_s$] (0,1)
        (0.6,0) to [cV, l=$\alpha{}v_x$] (0.6,1)
        (1.1,0) to [I, l=$I_s$] (1.1,1)
        (1.7,0) to [cI, l=$\alpha{}i_{sc}$] (1.7,1);
\end{tikzpicture}

\colorlet{vsourceAMcolorfill}{red!20}
\colorlet{vsourceAMcolordraw}{red}
\colorlet{cvsourceAMcolorfill}{olive!20}
\colorlet{cvsourceAMcolordraw}{olive}
\colorlet{isourceAMcolorfill}{red!20}
\colorlet{isourceAMcolordraw}{red}
\colorlet{cisourceAMcolorfill}{olive!20}
\colorlet{cisourceAMcolordraw}{olive} 

\begin{tikzpicture}[circuit ee  IEC, x=3.5cm, y=3.5cm]
    \draw 
        (0,0) to [V, l=$v_s$] (0,1)
        (0.6,0) to [cV, l=$\alpha{}v_x$] (0.6,1)
        (1.1,0) to [I, l=$I_s$] (1.1,1)
        (1.7,0) to [cI, l=$\alpha{}i_{sc}$] (1.7,1);
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案1

更新

现在可以控制填充绘图颜色:

\documentclass[dvipsnames,x11names,svgnames]{article}
\usepackage{pgfplots}
\usetikzlibrary{arrows, circuits.ee.IEC, positioning}
\usepackage[american voltages, american currents,siunitx]{circuitikz}
\usetikzlibrary{backgrounds}

\colorlet{vsourceAMcolorfill}{cyan!50}
\colorlet{vsourceAMcolordraw}{black!50!black}
\colorlet{cisourceAMcolorfill}{cyan!50}
\colorlet{cisourceAMcolordraw}{black!50!black}

\makeatletter
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/vsourceam/height}}{vsourceAM}{\ctikzvalof{bipoles/vsourceam/height}}{\ctikzvalof{bipoles/vsourceam/width}}{

    \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}

    \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}

\pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{$+$}
    \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{$-$}

\begin{pgfonlayer}{background}
    \pgfsetfillcolor{vsourceAMcolorfill}
    \pgfsetstrokecolor{vsourceAMcolordraw}
    \pgfusepath{stroke,fill}
\end{pgfonlayer}
}


\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/cisourceam/height}}{cisourceAM}{\ctikzvalof{bipoles/cisourceam/height}}{\ctikzvalof{bipoles/cisourceam/width}}{

    \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}

            \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
            \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
            \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
            \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
            \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}

\begin{pgfonlayer}{background}
    \pgfsetfillcolor{cisourceAMcolorfill}
    \pgfsetstrokecolor{cisourceAMcolordraw}
    \pgfusepath{stroke,fill}
\end{pgfonlayer}

    \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
    \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}}
    \pgfusepath{draw}
    \pgfscope
        \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
        \pgfnode{currarrow}{center}{}{}{\pgfusepath{draw}}
    \endpgfscope
}
\makeatother

\begin{document}

\begin{tikzpicture}[circuit ee  IEC,color=blue!50!black]
    \draw 
    (0,0) to [V, l=$v_s$] (0,3)
    (2,3) to [cI, l=$\beta{}v_{\pi}$] (2,0);
\colorlet{vsourceAMcolorfill}{red!20}
\colorlet{vsourceAMcolordraw}{red}
\colorlet{cisourceAMcolorfill}{olive!20}
\colorlet{cisourceAMcolordraw}{olive}
    \draw 
    (5,0) to [V, l=$v_s$, color=blue!50!black] (5,3)
    (7,3) to [cI, l=$\beta{}v_{\pi}$,color=blue!50!black] (7,0);
\end{tikzpicture}

\end{document}

在此处输入图片描述

这里有一种方法可以做到;使用\definecolor\colorlet声明要使用的颜色(vsourceAMcolor对于电压源和cisourceAMcolor电流源):

\documentclass[dvipsnames,x11names,svgnames]{article}
\usepackage{pgfplots}
\usetikzlibrary{arrows, circuits.ee.IEC, positioning}
\usepackage[american voltages, american currents,siunitx]{circuitikz}
\usetikzlibrary{backgrounds}

\colorlet{vsourceAMcolor}{cyan!50}
\colorlet{cisourceAMcolor}{cyan!50}

\makeatletter
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/vsourceam/height}}{vsourceAM}{\ctikzvalof{bipoles/vsourceam/height}}{\ctikzvalof{bipoles/vsourceam/width}}{

    \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}

    \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}

\pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{$+$}
    \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{$-$}
    
\begin{pgfonlayer}{background}
    \pgfsetfillcolor{vsourceAMcolor}
    \pgfusepath{stroke,draw,fill}
\end{pgfonlayer}
}


\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/cisourceam/height}}{cisourceAM}{\ctikzvalof{bipoles/cisourceam/height}}{\ctikzvalof{bipoles/cisourceam/width}}{

    \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
    
            \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
            \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
            \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
            \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
            \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}

\begin{pgfonlayer}{background}
    \pgfsetfillcolor{cisourceAMcolor}
    \pgfusepath{stroke,draw,fill}
\end{pgfonlayer}

    \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
    \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}}
    \pgfusepath{draw,fill}
    \pgfscope
        \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
        \pgfnode{currarrow}{center}{}{}{\pgfusepath{draw}}
    \endpgfscope
}
\makeatother

\begin{document}

\begin{tikzpicture}[circuit ee  IEC,color=blue!50!black]
    \draw 
    (0,0) to [V, l=$v_s$, color=blue!50!black] (0,3)
    (2,3) to [cI, l=$\beta{}v_{\pi}$,color=blue!50!black] (2,0);
\colorlet{vsourceAMcolor}{red!20}
\colorlet{cisourceAMcolor}{olive!50}
    \draw 
    (5,0) to [V, l=$v_s$, color=blue!50!black] (5,3)
    (7,3) to [cI, l=$\beta{}v_{\pi}$,color=blue!50!black] (7,0);
\end{tikzpicture}

\end{document}

结果:

在此处输入图片描述

问题在于,对于这些形状,包使用了,\pgfpath{draw}因此它绘制了形状,但没有提供填充的可能性。我重新定义了形状,以允许在背景层中进行填充。

相关内容