答案1
\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{positioning, shapes.multipart}
\begin{document}
\begin{tikzpicture}
\node[rectangle split, rectangle split parts=3, rectangle split horizontal, draw]{\nodepart{two}ReadInput};
\end{tikzpicture}
\end{document}
更新:
以下代码显示了先前代码的改进版本。它显示的字体和颜色与 OP 的示例更相似。
还提供了第二种解决方案。此解决方案使用较大的常规节点inner xsep
和一个path picture
绘制内线的选项。此解决方案避免使用\nodepart{two}
内部节点的内容,并更好地控制横向框的大小。
\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{positioning, shapes.multipart}
\begin{document}
\begin{tikzpicture}[
mynode/.style={
rectangle split,
rectangle split parts=3,
rectangle split horizontal,
font=\sffamily,
color = cyan!80!black,
draw,
top color=white,
bottom color=orange
}
]
\node[mynode]{\nodepart{two}ReadInput};
\end{tikzpicture}
\begin{tikzpicture}[
mynode/.style={
font=\sffamily,
color = cyan!80!black,
draw,
top color=white,
bottom color=orange,
inner xsep=4mm,
path picture={%
\draw ([xshift=-2mm]path picture bounding box.north east)--([xshift=-2mm]path picture bounding box.south east);
\draw ([xshift=2mm]path picture bounding box.north west)--([xshift=2mm]path picture bounding box.south west);},
}
]
\node[mynode]{ReadInput};
\end{tikzpicture}
\end{document}