में पृष्ठभूमि ब्रश दोहराएं और धन्यवाद।WPF
यह प्रश्न इस पुराने, अनुत्तरित प्रश्न के समान है: How to paint notebook-like lines as TextBox background? हालांकि, यह वही नहीं है - बिल्कुल नहीं।
मैं एक नोटपैड, लाइन पेपर जैसी पृष्ठभूमि बनाना चाहता हूं लेकिन मैं XAML में ब्रश को दोहराने के तरीके से परिचित नहीं हूं। तुम कैसे हो?
<TextBox TextBlock.LineHeight="20"
TextBlock.LineStackingStrategy="BlockLineHeight"
Padding="20,10,20,20" TextWrapping="Wrap">
<TextBox.Background>
<DrawingBrush TileMode="Tile" Stretch="None" Viewport="0,0,20,20"
ViewportUnits="Absolute" Opacity=".07">
<DrawingBrush.Drawing>
<GeometryDrawing>
<GeometryDrawing.Pen>
<Pen Brush="RoyalBlue" />
</GeometryDrawing.Pen>
<GeometryDrawing.Geometry>
<LineGeometry StartPoint="0,0" EndPoint="20,0"/>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingBrush.Drawing>
</DrawingBrush>
</TextBox.Background>
Now is the time for all good men to come to the aid of their country.
Now is the time for all good men to come to the aid of their country.
Now is the time for all good men to come to the aid of their country.
Now is the time for all good men to come to the aid of their country.
Now is the time for all good men to come to the aid of their country.
</TextBox>
सुझाव संपादित करें के बारे में: मैं सहमत होगा, एक अलग जवाब में अपने ठोस समाधान निकालने दें। (यदि आवश्यक हो तो 'लाइनहेइट' और 'लाइनस्टैकिंगस्ट्रेटी' संरेखण समस्या को हल करने के बारे में एक नोट भी जोड़ सकते हैं) –