//--------------------------------------------------------------------- internal SortableListView() { m_columnSorter = new ListViewColumnSorter(); ListViewItemSorter = m_columnSorter; FullRowSelect = true; ColumnClick += new ColumnClickEventHandler(PropertiesListView_ColumnClick); View = System.Windows.Forms.View.Details; }
/// <summary> /// Extends BeginInvoke so that when a state object is not needed, null does not need to be passed. /// <example> /// columnclickeventhandler.BeginInvoke(sender, e, callback); /// </example> /// </summary> public static IAsyncResult BeginInvoke(this ColumnClickEventHandler columnclickeventhandler, Object sender, ColumnClickEventArgs e, AsyncCallback callback) { if (columnclickeventhandler == null) { throw new ArgumentNullException("columnclickeventhandler"); } return(columnclickeventhandler.BeginInvoke(sender, e, callback, null)); }
public PagedListView() : base() { PageSize = DefaultPageSize; SortDirection = SortDirection.Ascending; FullRowSelect = true; MultiSelect = false; SelectedIndexChanged += new EventHandler(PagedListView_SelectedIndexChanged); ColumnClick += new ColumnClickEventHandler(PagedListView_ColumnClick); }
public ListView() { SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw, true); FullRowSelect = true; GridLines = false; HideSelection = false; ColumnClick += new ColumnClickEventHandler(OnListViewColumnClick); OwnerDraw = true; this.DrawColumnHeader += new DrawListViewColumnHeaderEventHandler(OnListViewDrawColumnHeader); this.DrawSubItem += new DrawListViewSubItemEventHandler(OnListViewDrawSubItem); }
//--------------------------------------------------------------------- internal OverrideListView() { View = System.Windows.Forms.View.Details; MultiSelect = false; GridLines = true; FullRowSelect = true; Dock = DockStyle.Fill; SetAutoSizeMode(AutoSizeMode.GrowAndShrink); m_columnSorter = new ListViewColumnSorter(); ListViewItemSorter = m_columnSorter; ColumnClick += new ColumnClickEventHandler(OverrideListView_ColumnClick); m_groupingEnabled = true; }
/// <summary> /// イベントを追加する /// </summary> /// <param name="control">イベント発生源</param> /// <param name="eventName">イベント名</param> /// <param name="function">イベント転送先</param> public Handle AddTrigger(Component control, string eventName, object function) { Delegate eh = null; if (_addEvents == null) { _addEvents = new Dictionary <string, IList <EventUnit> >(); } var eis = control.GetType().GetEvents(); foreach (var ei in eis) { if (ei.Name == eventName) { switch (eventName) { case "SelectedIndexChanged": ei.AddEventHandler(control, eh = new EventHandler(_SelectedIndexChanged)); break; case "Click": ei.AddEventHandler(control, eh = new EventHandler(_Click)); break; case "ButtonClick": ei.AddEventHandler(control, eh = new EventHandler(_ButtonClick)); break; case "DoubleClick": ei.AddEventHandler(control, eh = new EventHandler(_DoubleClick)); break; case "ColumnClick": ei.AddEventHandler(control, eh = new ColumnClickEventHandler(_ColumnClick)); break; default: System.Diagnostics.Debug.Assert(false, "未実装のイベントが " + GetType().Name + " でプログラミングされています。= " + eventName); break; } //ei.AddEventHandler(control, function); // 登録したイベントを覚えておく if (_addEvents.TryGetValue(ei.Name, out var li) == false) { _addEvents.Add(ei.Name, li = new List <EventUnit>()); } li.Add(new EventUnit(ei, control, function)); return(new Handle(ei, function, eh, control)); } } System.Diagnostics.Debug.Assert(false, control.Site.Name + "コントロール(" + control.GetType().ToString() + ")には'" + eventName + "'というイベントが存在しません"); return(null); }
public EXListView() { _cpadding = 4; _controls = new ArrayList(); _sortcol = -1; _sortcolbrush = SystemBrushes.ControlLight; _highlightbrush = SystemBrushes.Highlight; OwnerDraw = true; FullRowSelect = true; View = View.Details; MouseDown += new MouseEventHandler(This_MouseDown); MouseDoubleClick += new MouseEventHandler(This_MouseDoubleClick); DrawColumnHeader += new DrawListViewColumnHeaderEventHandler(This_DrawColumnHeader); DrawSubItem += new DrawListViewSubItemEventHandler(This_DrawSubItem); MouseMove += new MouseEventHandler(This_MouseMove); ColumnClick += new ColumnClickEventHandler(This_ColumnClick); txtbx = new TextBox() { Visible = false }; Controls.Add(txtbx); txtbx.Leave += new EventHandler(C_Leave); txtbx.KeyPress += new KeyPressEventHandler(Txtbx_KeyPress); }
public void setColumnClickHandler(ColumnClickEventHandler columnClickHandler) { _columnClickHandler = columnClickHandler; }
private void DrawCharts() { void doDrawing() { chart.BeginInit(); chart.Series.Clear(); if (listView.SelectedItems.Count == 0) { emptySelection.Visible = true; infoPanel.Visible = false; } else { ComponentResourceManager res = new ComponentResourceManager(typeof(Form1)); int mode; void updateSortMode() { lviSorter.SortDate = lviSorter.SortColumn == mode; } lviSorter.SortColumn = 0; emptySelection.Visible = false; infoPanel.Visible = true; if (listView.SelectedItems.Count == 1) { Person member = CurrentProject.FindPerson((Guid)listView.SelectedItems[0].Tag); List <Score> record = member.Record; // Record List View recordListView.BeginUpdate(); recordListView.Items.Clear(); recordListView.Columns.Clear(); recordListView.Columns.Add(res.GetString("col.Time"), 110); recordListView.Columns.Add(res.GetString("col.Reason"), 200); recordListView.Columns.Add(res.GetString("col.Score"), 40); mode = 0; updateSortMode(); Series series = chart.Series.Add(member.Name); series.ChartType = SeriesChartType.Line; record.ForEach((score) => { series.Points.AddXY(score.Time.ToShortDateString(), score.Value); var item = new ListViewItem { Text = score.DateString }; item.SubItems.Add(score.Reason); item.SubItems.Add(score.Value.ToString()); recordListView.Items.Add(item); }); recordListView.View = System.Windows.Forms.View.Details; } else { bool allSelectionsInGroup = true; List <Group> selectedGroups = new List <Group>(); void validate() { Group previousGroup = null; int previousCount = 0; foreach (ListViewItem item in listView.SelectedItems) { Person member = CurrentProject.FindPerson((Guid)item.Tag); if (previousGroup != null) { if (previousGroup != member.Group) { if (previousGroup.People.Count != previousCount) { allSelectionsInGroup = false; selectedGroups = null; break; } previousCount = 0; } } if (previousGroup != member.Group) { selectedGroups.Add(member.Group); } previousCount++; previousGroup = member.Group; } }; validate(); // Record List View recordListView.BeginUpdate(); recordListView.Items.Clear(); recordListView.Columns.Clear(); recordListView.Columns.Add(res.GetString("col.Target"), 60); recordListView.Columns.Add(res.GetString("col.Time"), 110); recordListView.Columns.Add(res.GetString("col.Reason"), 200); recordListView.Columns.Add(res.GetString("col.Score"), 40); mode = 1; updateSortMode(); if (!allSelectionsInGroup || selectedGroups.Count == 1) { bool isSameGroup = true; Group lastGroup = null; List <Person> people = new List <Person>(); foreach (ListViewItem item in listView.SelectedItems) { Person member = CurrentProject.FindPerson((Guid)item.Tag); people.Add(member); if (isSameGroup) { if (lastGroup != null && lastGroup != member.Group) { isSameGroup = false; } else { lastGroup = member.Group; } } } if (isSameGroup && lastGroup.People.Count == people.Count) { lastGroup.Record.ForEach((it) => { var viewItem = recordListView.Items.Add(it.Maker.Name); viewItem.SubItems.Add(it.DateString); viewItem.SubItems.Add(it.Reason); viewItem.SubItems.Add(it.Value.ToString()); }); } else { foreach (Person member in people) { member.Record.ForEach((it) => { var viewItem = recordListView.Items.Add(member.Name); viewItem.SubItems.Add(it.DateString); viewItem.SubItems.Add(it.Reason); viewItem.SubItems.Add(it.Value.ToString()); }); } } if (isSameGroup) { Series series = chart.Series.Add(res.GetString("col.Score")); people.ForEach((it) => series.Points.AddXY(it.Name, it.Score)); series.ChartType = SeriesChartType.Pie; } else { string score = res.GetString("col.Score"); people.ForEach((it) => chart.Series.Add(it.Name).Points.AddXY(score, it.Score)); } } else { string score = res.GetString("col.Score"); selectedGroups.ForEach((group) => { chart.Series.Add(group.Name).Points.AddXY(score, group.Score); }); } recordListView.View = System.Windows.Forms.View.Details; } if (lastColumnClickListenr != null) { recordListView.ColumnClick -= lastColumnClickListenr; } lastColumnClickListenr = (s, a) => { if (a.Column == lviSorter.SortColumn) { if (lviSorter.Order == SortOrder.Ascending) { lviSorter.Order = SortOrder.Descending; } else { lviSorter.Order = SortOrder.Ascending; } } else { lviSorter.SortColumn = a.Column; lviSorter.SortDate = a.Column == mode; lviSorter.Order = SortOrder.Ascending; } recordListView.Sort(); }; recordListView.ColumnClick += lastColumnClickListenr; recordListView.Sort(); recordListView.EndUpdate(); } chart.EndInit(); } if (chartTimer != null) { chartTimer.Dispose(); } chartTimer = new System.Windows.Forms.Timer { Interval = 100 }; chartTimer.Tick += (a, b) => { doDrawing(); chartTimer.Stop(); chartTimer.Dispose(); }; chartTimer.Start(); }
public amuleDownloadStatusList() { OwnerDraw = true; DrawColumnHeader += new DrawListViewColumnHeaderEventHandler(amuleDownloadStatusList_DrawColumnHeader); DrawSubItem += new DrawListViewSubItemEventHandler(amuleDownloadStatusList_DrawSubItem); DownloadQueueItem.InitDraw3DModifiers(FontHeight + 1); MouseClick += new MouseEventHandler(amuleDownloadStatusList_MouseClickHandler); ColumnClick += new ColumnClickEventHandler(amuleDownloadStatusList_ColumtClickHandler); m_ctx_menu.Opening += new System.ComponentModel.CancelEventHandler(cms_Opening); m_ctx_menu.Items.Add(new ToolStripLabel("Downloads")); m_ctx_menu.Items.Add(new ToolStripSeparator()); ToolStripButton it_pause = new ToolStripButton("Pause"); it_pause.Click += new EventHandler(it_pause_Click); m_ctx_menu.Items.Add(it_pause); ContextMenuStrip = m_ctx_menu; ToolStripButton it_resume = new ToolStripButton("Resume"); it_resume.Click += new EventHandler(it_resume_Click); m_ctx_menu.Items.Add(it_resume); ToolStripButton it_cancel = new ToolStripButton("Cancel"); it_cancel.Click += new EventHandler(it_cancel_Click); m_ctx_menu.Items.Add(it_cancel); m_ctx_menu.Items.Add(new ToolStripSeparator()); // // Init columns // m_column_index = new int[(int)DOWNLOAD_CTRL_COL_ID.COL_LAST_ID]; UpdateColumnIndexes(); // File name if (m_settings.FilenameVisible) { CreateColumtAt("File name", m_settings.FilenameWidth, (int)DOWNLOAD_CTRL_COL_ID.COL_FILENAME_ID); } AppendItemToCtxMenu(m_ctx_menu, "File name", DOWNLOAD_CTRL_COL_ID.COL_FILENAME_ID, m_settings.FilenameVisible, new EventHandler(column_Click)); // Status if (m_settings.StatusVisible) { CreateColumtAt("Status", m_settings.StatusWidth, (int)DOWNLOAD_CTRL_COL_ID.COL_STATUS_ID); } AppendItemToCtxMenu(m_ctx_menu, "Status", DOWNLOAD_CTRL_COL_ID.COL_STATUS_ID, m_settings.StatusVisible, new EventHandler(column_Click)); // Size if (m_settings.SizeVisible) { CreateColumtAt("Size", m_settings.SizeWidth, (int)DOWNLOAD_CTRL_COL_ID.COL_SIZE_ID); } AppendItemToCtxMenu(m_ctx_menu, "Size", DOWNLOAD_CTRL_COL_ID.COL_SIZE_ID, m_settings.SizeVisible, new EventHandler(column_Click)); // Completed size if (m_settings.CompletedVisible) { CreateColumtAt("Completed", m_settings.CompletedWidth, (int)DOWNLOAD_CTRL_COL_ID.COL_COMPLETED_ID); } AppendItemToCtxMenu(m_ctx_menu, "Completed", DOWNLOAD_CTRL_COL_ID.COL_COMPLETED_ID, m_settings.CompletedVisible, new EventHandler(column_Click)); // Speed if (m_settings.SpeedVisible) { CreateColumtAt("Speed", m_settings.SpeedWidth, (int)DOWNLOAD_CTRL_COL_ID.COL_SPEED_ID); } AppendItemToCtxMenu(m_ctx_menu, "Speed", DOWNLOAD_CTRL_COL_ID.COL_SPEED_ID, m_settings.SpeedVisible, new EventHandler(column_Click)); // Sources if (m_settings.SourcesVisible) { CreateColumtAt("Sources", m_settings.SourcesWidth, m_column_index[(int)DOWNLOAD_CTRL_COL_ID.COL_SOURCES_ID]); } AppendItemToCtxMenu(m_ctx_menu, "Sources", DOWNLOAD_CTRL_COL_ID.COL_SOURCES_ID, m_settings.SizeVisible, new EventHandler(column_Click)); ContextMenuStrip = m_ctx_menu; }