listbox

ListBox AutoSizes by item height

血红的双手。 提交于 2019-12-01 18:06:02
I use TableLayoutPanel for all my elements in a form. I use Dock Fill to autosize a TextBox and a ListBox. TextBox fits perfectly in a cell of the TableLayoutPanel but not a ListBox. It autosizes by item height. How to delete this gap between the bottom of the ListBox and the bottom of the form? I know I can set the height of the ListBox by a certain value (e.g. item height in the ListBox is 16, 16 * 10 elements= 160, 160 will fit correctly), but is there any other solutions? I'm using C#. LarsTech Set the ListBox's property IntegralHeight = false; so that it won't resize the control by the

WinForms ListBox with readonly/disabled items

穿精又带淫゛_ 提交于 2019-12-01 17:56:22
Is there a way to make some of the items in a ListBox readonly/disabled so they can't be selected? Or are there any similar controls to ListBox to provide this functionality? ListBox doesn't have support for that. You can bolt something on, you could deselect a selected item. Here's a silly example that prevents even-numbered items from being selected: private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { for (int ix = listBox1.SelectedIndices.Count - 1; ix >= 0; ix--) { if (listBox1.SelectedIndices[ix] % 2 != 0) listBox1.SelectedIndices.Remove(listBox1.SelectedIndices[ix]);

How to create nested listboxes in urwid?

做~自己de王妃 提交于 2019-12-01 17:44:16
Is it possible to put ListBoxes inside of SimpleListWalkers ? I'm trying to make nested ListBoxes, but I have this error : AttributeError: 'MyListBox' object has no attribute 'rows' import urwid class MyListBox(urwid.ListBox): def focus_next(self): try: self.body.set_focus(self.body.get_next(self.body.get_focus()[1])[1]) except: pass def focus_previous(self): try: self.body.set_focus(self.body.get_prev(self.body.get_focus()[1])[1]) except: pass def handle_input(event): frame.header.set_text("key pressed %s" % event) if event == "q": raise urwid.ExitMainLoop elif event == "up": lb.focus

Hide vertical scroll bar in ListBox control

好久不见. 提交于 2019-12-01 16:41:45
I'm developing an application that requires a ListBox control. Unfortunately, when I add too many items in the ListBox , a vertical scroll bar is shown. Is there something I can do to hide the vertical scroll bar shown by the ListBox ? I can see that there's a property to hide the horizontal scroll bar but there's no property for the vertical scroll bar. Picrofo Software The problem was solved. I've simply created a new project of template a class library with the following code using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms;

Setting the scrollbar position of a ListBox

不问归期 提交于 2019-12-01 16:35:59
Can I programatically set the position of a WPF ListBox's scrollbar? By default, I want it to go in the center. Zamboni To move the vertical scroll bar in a ListBox do the following: Name your list box (x:Name="myListBox") Add Loaded event for the Window (Loaded="Window_Loaded") Implement Loaded event using method: ScrollToVerticalOffset Here is a working sample: XAML: <Window x:Class="ListBoxScrollPosition.Views.MainView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Loaded="Window_Loaded" Title="Main Window" Height=

why listbox1.Items.Add use Equals Method of my Object?

心已入冬 提交于 2019-12-01 15:31:21
i'm scrutinizing Windows Forms ListBoxCollection Add Method, during the analyzing i found that the method "add" calls Equals method in base Object why this method do this action ? I Have used "Call Stack" and I have Find This Answer : We Call :System.Windows.Forms.ListBox.ObjectCollection.Add(object item) and it will Call : System.Windows.Forms.ListBox.ObjectCollection.AddInternal(object item) and it will Call : System.Windows.Forms.ListBox.NativeAdd(object item) and it will call : System.Windows.Forms.ListControl.GetItemText(object item) and it will call : System.Windows.Forms.Formatter

WP7 Prevent ListBox scrolling

点点圈 提交于 2019-12-01 15:06:21
I have a page with two ListBox controls. The page contains a list of items based on the item's category. There is a header for a category, followed by a ListBox containing all items for that category, then another header followed a list of items for that category, etc. The issue I'm having is that each ListBox scrolls independently. I want the whole page to scroll (which it does), but not each individual ListBox. The ListBox controls grow automatically to their content, so there is no need to have them scroll. Is this possible? FluentComponents All you have to do in order to disable the scroll

ASP.NET: How to hide ListBox control vertical scrollbar?

故事扮演 提交于 2019-12-01 14:57:58
I have tried CSS: overflow: auto. It doesn't work. Any way to achieve it? Do I need to create my custom control as I have seen it on ASP.NET forum? I would go with creating a custom control like you mentioned. What is your desired goal? Creating your own scrollbar to put in the listbox? this should work: listBox1.Rows = listBox1.Items.Count; it causes all items are visible is SELECT html tag. You can place it to your own div set overflow and make your own scrollbars if you want. mayur this work for me listBox1.DataSource = .... listBox1.DataBind(); listBox1.Rows = listBox1.Items.Count + 1; .

C# Listbox.DrawItem to color each lines

眉间皱痕 提交于 2019-12-01 14:43:42
I have some code to change how listbox act. I can change the color of text, but I am unable to change the color of the background of each line. This is in a for loop for every of my lines LBLines is an array of string store in a global variable if (LBLines[e.Index] != "None") { e.Graphics.FillRectangle(new SolidBrush(Color.FromName(LBLines[e.Index])), e.Bounds.X,e.Bounds.Y,e.Bounds.Width,e.Bounds.Height); } This will color EVERY lines of the same color, even those listed as "None", thou what I need is that they stay same color as default background color. EDIT: Comparaison is not the problem,

WP7 Prevent ListBox scrolling

亡梦爱人 提交于 2019-12-01 14:42:38
问题 I have a page with two ListBox controls. The page contains a list of items based on the item's category. There is a header for a category, followed by a ListBox containing all items for that category, then another header followed a list of items for that category, etc. The issue I'm having is that each ListBox scrolls independently. I want the whole page to scroll (which it does), but not each individual ListBox. The ListBox controls grow automatically to their content, so there is no need to