答案1
节点建立后绘制整个边框:
\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{shapes.multipart, calc}
\begin{document}
\begin{tikzpicture}
\node[rectangle split,rectangle split parts=2, rectangle split horizontal,
align=center,
alias=othername,
append after command={\pgfextra
\draw ($(othername.one split south)!.25!(othername.south east)$)-|(othername.west)|-($(othername.one split north)!.25!(othername.north east)$);
\draw ($(othername.one split south)!.75!(othername.south east)$)-|(othername.east)|-($(othername.one split north)!.75!(othername.north east)$);
\draw[dashed] ($(othername.one split south)!.25!(othername.south east)$)--($(othername.one split south)!.75!(othername.south east)$);
\draw[dashed] ($(othername.one split north)!.25!(othername.north east)$)--($(othername.one split north)!.75!(othername.north east)$);
\draw (othername.one split north)--(othername.one split south);
\endpgfextra} ]
{foo \nodepart[text width=2cm, draw=none]{second} bar};
\end{tikzpicture}
\end{document}
答案2
尝试用白色虚线覆盖多部分节点的第二部分:
\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{shapes.multipart}
\begin{document}
\begin{tikzpicture}[
node distance = 0pt,
mpnh/.style = {% multi part node horisontal
rectangle split, rectangle split parts=2,
rectangle split horizontal,
draw, outer sep=0pt, align=center}
]
\node (mpnh) [mpnh]
{foo
\nodepart[text width=2cm]{second} bar};
\draw[white, semithick, dashed] (mpnh.two north)+(-0.5,0) -- ++ (.5,0)
(mpnh.two south)+(-0.5,0) -- ++ (.5,0);
\end{tikzpicture}
\end{document}