LiveChart.WinForms.CartesianChart scrollable - c#

I am developing a C# WinForm application.
I am using cartesianchart from LiveChar.Winforms.I want to do a scrollable graph.
I added too many items on chart and the chart fit all items to area. I want to put scroll bar bottom of cartesianchart thus items not to be stuck viewing area.

Related

Resize chart areas to fit to chart

I have a chart with multiple chart areas. There is also a button that when pressed deletes ( chart1.ChartAreas.Remove(chart1.ChartAreas[select]);) a selected chart area, as you can see below :
How can I resize the other chart Areas in order to take over the free area when one chart area is deleted?

panel with scrollbar in c#

i am trying to create a POS system, and there will be buttons creating dynamically, wondering what is the best way to create or layout the buttons.
I am currently using Metro Framework for C# window form, is there a way to create a pannel to have fixed amount of rows, and x columns of buttons so that if it has more than x columns, it will generate a scroll bar for you to slide to the rest of the buttons.
thank you

Adding a vertical scrollbar to a panel if drawn area is too large

I'm using WinForms and C#.
The application I am developing draws rows of rectangles (using g.DrawRectangle()) inside of a panel. The panel can hold 6 rectangles in width (I don't want to have horizontal scrolling). I control this within the application by counting the rectangles in the row, and then adding to the y value after the sixth rectangle.
Vertically, I want to be able to add infinite rectangles and scroll down to see them. Right now, the rectangles are being added, but the Panel doesn't scroll (they are just added off screen).
Is there a way to add a vertical scrollbar? I have tried setting the AutoScroll property to true, but that doesn't do anything.
The problem is that you are using graphics to draw on the panel. These are not controls, so they don't cause the panel to grow. you should create two panels - PanelA contains PanelB. PanelA has AutoScroll=true, but you draw on PanelB. As you draw, you also set the height of PanelB, so that when it gets bigger than PanelA, PanelA gets a scroll bar.

C# List of Panels

I would like to create panels with detailed information regarding an item (including a thumbnail image on the left hand side) and then add these to a scrollable list. Much like how iTunes on the iPhone displays the lists of applications available.
I have done some searching but have thus far been unable to find any assistance.
Does anyone have any ideas or links to samples they would like to share with me.
Thanks in advance,
Rob
In sum, the following creates a series of panels within a container that scroll in and out of view using a vertical scroll bar.
You did not list ASP.NET in your tags, so I assume this is Windows form-based, not web based. I'll get you started:
Create a panel called GrandChildPanel. Inside it, put an image box on the left side and labels with the information you want to display next to the image. This panel will be duplicated for every item (i.e., iTunes song).
Put that panel inside another, equal-width, equal-height panel called ChildPanel.
Create another panel called ParentPanel and set its width to the size of the other panels plus enough room for a vertical scroll bar. Set the height equal to however tall you want the scrollable area to be.
Put ChildPanel in the top-right corner of ParentPanel and add a vertical scroll bar to the far right edge of ParentPanel. Set the scroll bar's height to takeup the entire height of ParentPanel.
You probably want to add a border to ParentPanel to show its boundaries.
You also probably want to add a 1 or 2 pixel line across the bottom of your GrandChildPanel to show where the panel ends.
That's the setup. Here are the requirements for your code: Each time you 'add an item to the list' (e.g., every song in your iTunes list), you do the following:
Clone the GrandChildPanel.
Assign the clone to be a child of the ChildPanel.
Set the clone's Top to be equal to the previous clone's Top plus its Height.
Set ChildPanel's Height equal to any given GrandChildPanel's height multiplied by the number of clones.
Set the scroll bar's maximum value to equal ChildPanel's height.
Now, all you have to do to make this scrollable is perform the following on the scrolling or changing events of the vertical scroll bar: Set ChildPanel's Top to be equal to the verticle scroll bar's value ("position") multiplied by -1.

Datagrid scrolling in Windows s Mobile way to get rid of scroll bar?

I have a very simple form using the compact framework. I have two search fields a search button and a datagrid. The button sets the DataSource for a DataGrid on the form. I know that I can set the height and width on the DataGrid but I don't want the user to have to use the scroll bars on the DataGrid as it has a few hundred records. I just want the user to use the scroll bar on the form to scroll. How do I accomplish this?
I am assuming that the behavior you want is for a vertical scroll bar that spans the total height of the form to navigate through the records of the DataGrid. This DataGrid does not take up all the space on the form.
You could add a VScrollBar to the side of the form and set its Maximum to the total row count of your DataGrid. Then attach to the ValueChanged event of the scroll bar and manipulate the selected row of your DataGrid. This in effect would be mimicking the scrolling behavior of the DataGrid.
The tricky part is hiding the scroll bar of the DataGrid, as there is no property to hide it. You can extend its width so that the scroll bar is rendered off screen, but remember to set the Form's AutoScroll property to false so that it does not render a Horizontal scroll bar that would reveal the DataGrid kludge.
Based on your application, you may want to look into using a ListView with the View property set to Details. The ListView is much easier to manipulate in the compact framework and might fit your application better. You can still use the same VScrollBar technique above and apply it to the ListView if you wish.
You must get the rowcount from the DataSource. Cast it like the enclosed example to produce the row count: (rsMissingItems is a SqlCEResultSet object)
Dim intRecCnt As Int32 = DirectCast(rsMissingItems.ResultSetView, ICollection).Count

Categories

Resources