I want to draw horizontal line (HLine)
See original GitHub issueI want to draw horizontal line (U+2500), just like the border of Window
/FrameView
, I use following code (shortened for brevity):
private Label _topSeparatorLabel;
public Window Win { get; private set; }
public void Init( Toplevel top )
{
Win = new Window( "Application Name Setup" )
{
X = 0,
Y = 0,
Width = Dim.Fill(),
Height = Dim.Fill() - 1
};
}
public void Setup()
{
_topSeparatorLabel = new Label()
{
X = 0,
Y = 5,
Width = Dim.Width( Win ) - 2,
Height = 1
};
_topSeparatorLabel.DrawContent += TopSeparatorLabel_DrawContent;
Win.Add( _topSeparatorLabel );
}
private void TopSeparatorLabel_DrawContent( Rect obj )
{
_topSeparatorLabel.Text = new string( '\u2500', _topSeparatorLabel.Bounds.Width );
}
The idea is I need some kind of Line
control which I can put anywhere to separate content in Window
.
Since there is none, I think to simply use Label
and give its Text
with repeated value of \u2500
.
Is this a good approach, or there will be a problem here? Thanks in advance.
Issue Analytics
- State:
- Created 2 years ago
- Comments:17
Top Results From Across the Web
How can I draw a horizontal line spanning only some of the ...
Here's a solution using booktabs and getting rid of of the vertical rules, which leads to a prettier result imho. Have a look...
Read more >How do you make(draw) a horizontal line in LaTeX?
Easiest way to draw horizontal lines in Latex is to use the \rule[raise-height]{length}{thickness} command. And here you can pass length and thickness in ......
Read more >python - Plot a horizontal line on a given plot
Use axhline (a horizontal axis line). For example, this plots a horizontal line at y = 0.5 : import matplotlib.pyplot as plt ...
Read more >Simple hack to draw a perfectly vertical and horizontal line in ...
With this simple trick, you can draw a perfectly horizontal and vertical line in Ms Word and PowerPoint. Steps to draw a horizontal/...
Read more >Plot a Horizontal line in Matplotlib
The axhline() function in pyplot module of matplotlib library is used to add a horizontal line across the axis. Syntax: matplotlib.pyplot.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Here is a HorizontalLineView class I just created now for you 😃 this should be much more elegant and maintainable than using
Label
.Heres some code to test it:
Sure! I prefer to use Terminal.Gui generic control/view as well! That will be excellent 👍 (For time being I will use the custom made view by @tznind 😸 )