Exemple #1
0
        public void ResizeColumns()
        {
            nameWidth = listView.Width - MyDPI.ScaleDPIDimension(typeWidth) - MyDPI.ScaleDPIDimension(sizeWidth) - MyDPI.ScaleDPIDimension(5);

            // count is fall back in case extern call doesnt work
            int nbrItems = listView.Items.Count;

            if (MyUser32_GetWindow.IsVerticalScrollbarVisible(listView.Handle) || nbrItems > 8)
            {
                nameWidth -= MyDPI.ScaleDPIDimension(20);
            }

            listView.Columns[0].Width = nameWidth;
            listView.Columns[1].Width = MyDPI.ScaleDPIDimension(typeWidth);
            listView.Columns[2].Width = MyDPI.ScaleDPIDimension(sizeWidth);
        }
Exemple #2
0
        private void buttonToggle_Click(object sender, EventArgs e)
        {
            if (textBoxTags.Visible)
            {
                textBoxTags.Hide();
            }
            else
            {
                int textBoxWidth = flowLayoutPanel.Width - MyDPI.ScaleDPIDimension(buttonToggle.Width) - MyDPI.ScaleDPIDimension(25);

                // count is fall back in case extern call doesnt work
                int nbrControls = flowLayoutPanel.Controls.Count;
                if (MyUser32_GetWindow.IsVerticalScrollbarVisible(flowLayoutPanel.Handle) || nbrControls > 8)
                {
                    textBoxWidth -= MyDPI.ScaleDPIDimension(20);
                }

                textBoxTags.Width = textBoxWidth;
                textBoxTags.Show();
            }
        }
Exemple #3
0
        /// <summary>
        /// auto adjust title column width
        /// </summary>
        public void ResizeColumns()
        {
            int titleWidth = listView.Width - MyDPI.ScaleDPIDimension(GetColumnWidth(visibleColumnIndex)) - MyDPI.ScaleDPIDimension(5);

            // count is fall back in case extern call doesnt work
            int nbrItems = listView.Items.Count;

            if (listView.Handle != null && MyUser32_GetWindow.IsVerticalScrollbarVisible(listView.Handle) || nbrItems > 24)
            {
                titleWidth -= MyDPI.ScaleDPIDimension(20);
            }


            /// set all to 0
            foreach (KeyValuePair <int, string> sortColumn in FilterEnums.sortColumn.ToList().OrderBy(s => s.Key))
            {
                listView.Columns[sortColumn.Key].Width = 0;
            }

            // now set visible columns
            listView.Columns[0].Width = titleWidth;
            listView.Columns[visibleColumnIndex].Width = MyDPI.ScaleDPIDimension(GetColumnWidth(visibleColumnIndex));
        }