本文整理汇总了C#中OpenTween.OpenTweenCustomControl.DetailsListView类的典型用法代码示例。如果您正苦于以下问题:C# DetailsListView类的具体用法?C# DetailsListView怎么用?C# DetailsListView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DetailsListView类属于OpenTween.OpenTweenCustomControl命名空间,在下文中一共展示了DetailsListView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ResetColumns
private void ResetColumns(DetailsListView list)
{
using (ControlTransaction.Update(list))
using (ControlTransaction.Layout(list, false))
{
// カラムヘッダの再設定
list.ColumnClick -= MyList_ColumnClick;
list.DrawColumnHeader -= MyList_DrawColumnHeader;
list.ColumnReordered -= MyList_ColumnReordered;
list.ColumnWidthChanged -= MyList_ColumnWidthChanged;
var cols = list.Columns.Cast<ColumnHeader>().ToList();
list.Columns.Clear();
cols.ForEach(col => col.Dispose());
cols.Clear();
InitColumns(list, true);
list.ColumnClick += MyList_ColumnClick;
list.DrawColumnHeader += MyList_DrawColumnHeader;
list.ColumnReordered += MyList_ColumnReordered;
list.ColumnWidthChanged += MyList_ColumnWidthChanged;
}
}
示例2: AddNewTab
public bool AddNewTab(string tabName, bool startup, MyCommon.TabUsageType tabType, ListElement listInfo = null)
{
//重複チェック
foreach (TabPage tb in ListTab.TabPages)
{
if (tb.Text == tabName) return false;
}
//新規タブ名チェック
if (tabName == Properties.Resources.AddNewTabText1) return false;
//タブタイプ重複チェック
if (!startup)
{
if (tabType == MyCommon.TabUsageType.DirectMessage ||
tabType == MyCommon.TabUsageType.Favorites ||
tabType == MyCommon.TabUsageType.Home ||
tabType == MyCommon.TabUsageType.Mentions ||
tabType == MyCommon.TabUsageType.Related)
{
if (_statuses.GetTabByType(tabType) != null) return false;
}
}
TabPage _tabPage = new TabPage();
DetailsListView _listCustom = new DetailsListView();
int cnt = ListTab.TabPages.Count;
///ToDo:Create and set controls follow tabtypes
using (ControlTransaction.Update(_listCustom))
using (ControlTransaction.Layout(this.SplitContainer1.Panel1, false))
using (ControlTransaction.Layout(this.SplitContainer1.Panel2, false))
using (ControlTransaction.Layout(this.SplitContainer1, false))
using (ControlTransaction.Layout(this.ListTab, false))
using (ControlTransaction.Layout(this))
using (ControlTransaction.Layout(_tabPage, false))
{
/// UserTimeline関連
Label label = null;
if (tabType == MyCommon.TabUsageType.UserTimeline || tabType == MyCommon.TabUsageType.Lists)
{
label = new Label();
label.Dock = DockStyle.Top;
label.Name = "labelUser";
if (tabType == MyCommon.TabUsageType.Lists)
{
label.Text = listInfo.ToString();
}
else
{
label.Text = _statuses.Tabs[tabName].User + "'s Timeline";
}
label.TextAlign = ContentAlignment.MiddleLeft;
using (ComboBox tmpComboBox = new ComboBox())
{
label.Height = tmpComboBox.Height;
}
_tabPage.Controls.Add(label);
}
/// 検索関連の準備
Panel pnl = null;
if (tabType == MyCommon.TabUsageType.PublicSearch)
{
pnl = new Panel();
Label lbl = new Label();
ComboBox cmb = new ComboBox();
Button btn = new Button();
ComboBox cmbLang = new ComboBox();
pnl.SuspendLayout();
pnl.Controls.Add(cmb);
pnl.Controls.Add(cmbLang);
pnl.Controls.Add(btn);
pnl.Controls.Add(lbl);
pnl.Name = "panelSearch";
pnl.Dock = DockStyle.Top;
pnl.Height = cmb.Height;
pnl.Enter += SearchControls_Enter;
pnl.Leave += SearchControls_Leave;
cmb.Text = "";
cmb.Anchor = AnchorStyles.Left | AnchorStyles.Right;
cmb.Dock = DockStyle.Fill;
cmb.Name = "comboSearch";
cmb.DropDownStyle = ComboBoxStyle.DropDown;
cmb.ImeMode = ImeMode.NoControl;
cmb.TabStop = false;
cmb.AutoCompleteMode = AutoCompleteMode.None;
cmb.KeyDown += SearchComboBox_KeyDown;
if (_statuses.ContainsTab(tabName))
{
cmb.Items.Add(_statuses.Tabs[tabName].SearchWords);
cmb.Text = _statuses.Tabs[tabName].SearchWords;
}
//.........这里部分代码省略.........
示例3: ListTabSelect
private void ListTabSelect(TabPage _tab)
{
SetListProperty();
_itemCache = null;
_itemCacheIndex = -1;
_postCache = null;
_curTab = _tab;
_curList = (DetailsListView)_tab.Tag;
if (_curList.SelectedIndices.Count > 0)
{
_curItemIndex = _curList.SelectedIndices[0];
_curPost = GetCurTabPost(_curItemIndex);
}
else
{
_curItemIndex = -1;
_curPost = null;
}
_anchorPost = null;
_anchorFlag = false;
if (_iconCol)
{
((DetailsListView)_tab.Tag).Columns[1].Text = ColumnText[2];
}
else
{
for (int i = 0; i < _curList.Columns.Count; i++)
{
((DetailsListView)_tab.Tag).Columns[i].Text = ColumnText[i];
}
}
}
示例4: RestoreListViewSelection
/// <summary>
/// <see cref="SaveListViewStatus"/> によって保存された選択状態を復元します
/// </summary>
private void RestoreListViewSelection(DetailsListView listView, TabClass tab, ListViewSelection listSelection)
{
// status_id から ListView 上のインデックスに変換
int[] selectedIndices = null;
if (listSelection.SelectedStatusIds != null)
selectedIndices = tab.IndexOf(listSelection.SelectedStatusIds).Where(x => x != -1).ToArray();
var focusedIndex = -1;
if (listSelection.FocusedStatusId != null)
focusedIndex = tab.IndexOf(listSelection.FocusedStatusId.Value);
var selectionMarkIndex = -1;
if (listSelection.SelectionMarkStatusId != null)
selectionMarkIndex = tab.IndexOf(listSelection.SelectionMarkStatusId.Value);
listView.SelectedIndexChanged -= this.MyList_SelectedIndexChanged;
try
{
this.SelectListItem(listView, selectedIndices, focusedIndex, selectionMarkIndex);
}
finally
{
listView.SelectedIndexChanged += this.MyList_SelectedIndexChanged;
}
}
示例5: SelectListItem
private void SelectListItem(DetailsListView LView , int[] Index, int FocusedIndex)
{
//複数
Rectangle bnd = new Rectangle();
bool flg = false;
if (LView.FocusedItem != null)
{
bnd = LView.FocusedItem.Bounds;
flg = true;
}
int fIdx = -1;
if (Index != null && !(Index.Length == 1 && Index[0] == -1))
{
do
{
LView.SelectedIndices.Clear();
}
while (LView.SelectedIndices.Count > 0);
foreach (int idx in Index)
{
if (idx > -1 && LView.VirtualListSize > idx)
{
LView.SelectedIndices.Add(idx);
if (fIdx == -1) fIdx = idx;
}
}
}
if (FocusedIndex > -1 && LView.VirtualListSize > FocusedIndex)
{
LView.Items[FocusedIndex].Focused = true;
}
else if (fIdx > -1)
{
LView.Items[fIdx].Focused = true;
}
if (flg) LView.Invalidate(bnd);
}
示例6: AddNewTab
public bool AddNewTab(string tabName, bool startup, MyCommon.TabUsageType tabType, ListElement listInfo = null)
{
//重複チェック
foreach (TabPage tb in ListTab.TabPages)
{
if (tb.Text == tabName) return false;
}
//新規タブ名チェック
if (tabName == Properties.Resources.AddNewTabText1) return false;
//タブタイプ重複チェック
if (!startup)
{
if (tabType == MyCommon.TabUsageType.DirectMessage ||
tabType == MyCommon.TabUsageType.Favorites ||
tabType == MyCommon.TabUsageType.Home ||
tabType == MyCommon.TabUsageType.Mentions ||
tabType == MyCommon.TabUsageType.Related)
{
if (_statuses.GetTabByType(tabType) != null) return false;
}
}
TabPage _tabPage = new TabPage();
DetailsListView _listCustom = new DetailsListView();
ColumnHeader _colHd1 = new ColumnHeader(); //アイコン
ColumnHeader _colHd2 = new ColumnHeader(); //ニックネーム
ColumnHeader _colHd3 = new ColumnHeader(); //本文
ColumnHeader _colHd4 = new ColumnHeader(); //日付
ColumnHeader _colHd5 = new ColumnHeader(); //ユーザID
ColumnHeader _colHd6 = new ColumnHeader(); //未読
ColumnHeader _colHd7 = new ColumnHeader(); //マーク&プロテクト
ColumnHeader _colHd8 = new ColumnHeader(); //ソース
int cnt = ListTab.TabPages.Count;
///ToDo:Create and set controls follow tabtypes
this.SplitContainer1.Panel1.SuspendLayout();
this.SplitContainer1.Panel2.SuspendLayout();
this.SplitContainer1.SuspendLayout();
this.ListTab.SuspendLayout();
this.SuspendLayout();
_tabPage.SuspendLayout();
/// UserTimeline関連
Label label = null;
if (tabType == MyCommon.TabUsageType.UserTimeline || tabType == MyCommon.TabUsageType.Lists)
{
label = new Label();
label.Dock = DockStyle.Top;
label.Name = "labelUser";
if (tabType == MyCommon.TabUsageType.Lists)
{
label.Text = listInfo.ToString();
}
else
{
label.Text = _statuses.Tabs[tabName].User + "'s Timeline";
}
label.TextAlign = ContentAlignment.MiddleLeft;
using (ComboBox tmpComboBox = new ComboBox())
{
label.Height = tmpComboBox.Height;
}
_tabPage.Controls.Add(label);
}
/// 検索関連の準備
Panel pnl = null;
if (tabType == MyCommon.TabUsageType.PublicSearch)
{
pnl = new Panel();
Label lbl = new Label();
ComboBox cmb = new ComboBox();
Button btn = new Button();
ComboBox cmbLang = new ComboBox();
pnl.SuspendLayout();
pnl.Controls.Add(cmb);
pnl.Controls.Add(cmbLang);
pnl.Controls.Add(btn);
pnl.Controls.Add(lbl);
pnl.Name = "panelSearch";
pnl.Dock = DockStyle.Top;
pnl.Height = cmb.Height;
pnl.Enter += SearchControls_Enter;
pnl.Leave += SearchControls_Leave;
cmb.Text = "";
cmb.Anchor = AnchorStyles.Left | AnchorStyles.Right;
cmb.Dock = DockStyle.Fill;
cmb.Name = "comboSearch";
cmb.DropDownStyle = ComboBoxStyle.DropDown;
cmb.ImeMode = ImeMode.NoControl;
cmb.TabStop = false;
//.........这里部分代码省略.........
示例7: GetSelectionMarkStatusId
private long? GetSelectionMarkStatusId(DetailsListView listView, TabModel tab)
{
var selectionMarkIndex = listView.SelectionMark;
return selectionMarkIndex != -1 ? tab.GetStatusIdAt(selectionMarkIndex) : (long?)null;
}
示例8: ChangeItemStyleRead
private void ChangeItemStyleRead(bool Read, ListViewItem Item, PostClass Post, DetailsListView DList)
{
Font fnt;
//フォント
if (Read)
{
fnt = _fntReaded;
Item.SubItems[5].Text = "";
}
else
{
fnt = _fntUnread;
Item.SubItems[5].Text = "★";
}
//文字色
Color cl;
if (Post.IsFav)
cl = _clFav;
else if (Post.RetweetedId > 0)
cl = _clRetweet;
else if (Post.IsOwl && (Post.IsDm || SettingDialog.OneWayLove))
cl = _clOWL;
else if (Read || !SettingDialog.UseUnreadStyle)
cl = _clReaded;
else
cl = _clUnread;
var conv = new Func<string, string>(str => Regex.Replace(str, @"[ \r\n\t]", ""));
var newp = conv(Post.TextFromApi);
if (_cfgCommon.ShowStolenTweetWithColor && !(Post.RetweetedId > 0) && _statuses._statuses.Any(_ => conv(_.Value.TextFromApi) == newp && _.Value.CreatedAt.CompareTo(Post.CreatedAt) < 0))
{
cl = _clStolen;
}
if (DList == null || Item.Index == -1)
{
Item.ForeColor = cl;
if (SettingDialog.UseUnreadStyle)
Item.Font = fnt;
}
else
{
DList.Update();
if (SettingDialog.UseUnreadStyle)
DList.ChangeItemFontAndColor(Item.Index, cl, fnt);
else
DList.ChangeItemForeColor(Item.Index, cl);
//if (_itemCache != null) DList.RedrawItems(_itemCacheIndex, _itemCacheIndex + _itemCache.Length - 1, false);
}
}
示例9: GetSelectedStatusIds
private long[] GetSelectedStatusIds(DetailsListView listView, TabModel tab)
{
var selectedIndices = listView.SelectedIndices;
if (selectedIndices.Count > 0 && selectedIndices.Count < 61)
return tab.GetStatusIdAt(selectedIndices.Cast<int>());
else
return null;
}
示例10: GetFocusedStatusId
private long? GetFocusedStatusId(DetailsListView listView, TabModel tab)
{
var focusedItem = listView.FocusedItem;
return focusedItem != null ? tab.GetStatusIdAt(focusedItem.Index) : (long?)null;
}
示例11: SaveListViewSelection
/// <summary>
/// <see cref="ListView"/> の選択状態を <see cref="ListViewSelection"/> として返します
/// </summary>
private ListViewSelection SaveListViewSelection(DetailsListView listView, TabModel tab)
{
if (listView.VirtualListSize == 0)
{
return new ListViewSelection
{
SelectedStatusIds = new long[0],
SelectionMarkStatusId = null,
FocusedStatusId = null,
};
}
return new ListViewSelection
{
SelectedStatusIds = this.GetSelectedStatusIds(listView, tab),
FocusedStatusId = this.GetFocusedStatusId(listView, tab),
SelectionMarkStatusId = this.GetSelectionMarkStatusId(listView, tab),
};
}
示例12: GetScrollLockMode
private ScrollLockMode GetScrollLockMode(DetailsListView listView)
{
if (this._statuses.SortMode == ComparerMode.Id)
{
if (this._statuses.SortOrder == SortOrder.Ascending)
{
// Id昇順
if (this.ListLockMenuItem.Checked)
return ScrollLockMode.None;
// 最下行が表示されていたら、最下行へ強制スクロール。最下行が表示されていなかったら制御しない
// 一番下に表示されているアイテム
var bottomItem = listView.GetItemAt(0, listView.ClientSize.Height - 1);
if (bottomItem == null || bottomItem.Index == listView.VirtualListSize - 1)
return ScrollLockMode.FixedToBottom;
else
return ScrollLockMode.None;
}
else
{
// Id降順
if (this.ListLockMenuItem.Checked)
return ScrollLockMode.FixedToItem;
// 最上行が表示されていたら、制御しない。最上行が表示されていなかったら、現在表示位置へ強制スクロール
var topItem = listView.TopItem;
if (topItem == null || topItem.Index == 0)
return ScrollLockMode.FixedToTop;
else
return ScrollLockMode.FixedToItem;
}
}
else
{
return ScrollLockMode.FixedToItem;
}
}
示例13: SaveListViewScroll
/// <summary>
/// <see cref="ListView"/> のスクロール位置に関する情報を <see cref="ListViewScroll"/> として返します
/// </summary>
private ListViewScroll SaveListViewScroll(DetailsListView listView, TabModel tab)
{
var listScroll = new ListViewScroll
{
ScrollLockMode = this.GetScrollLockMode(listView),
};
if (listScroll.ScrollLockMode == ScrollLockMode.FixedToItem)
{
var topItem = listView.TopItem;
if (topItem != null)
listScroll.TopItemStatusId = tab.GetStatusIdAt(topItem.Index);
}
return listScroll;
}
示例14: RemoveSpecifiedTab
public bool RemoveSpecifiedTab(string TabName, bool confirm)
{
if (_statuses.IsDefaultTab(TabName) || _statuses.Tabs[TabName].Protected) return false;
if (confirm)
{
string tmp = string.Format(Properties.Resources.RemoveSpecifiedTabText1, Environment.NewLine);
if (MessageBox.Show(tmp, TabName + " " + Properties.Resources.RemoveSpecifiedTabText2,
MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Cancel)
{
return false;
}
}
var _tabPage = ListTab.TabPages.Cast<TabPage>().FirstOrDefault<TabPage>(tp => tp.Text == TabName);
if (_tabPage == null) return false;
SetListProperty(); //他のタブに列幅等を反映
MyCommon.TabUsageType tabType = _statuses.Tabs[TabName].TabType;
//オブジェクトインスタンスの削除
DetailsListView _listCustom = (DetailsListView)_tabPage.Tag;
_tabPage.Tag = null;
using (ControlTransaction.Layout(this.SplitContainer1.Panel1, false))
using (ControlTransaction.Layout(this.SplitContainer1.Panel2, false))
using (ControlTransaction.Layout(this.SplitContainer1, false))
using (ControlTransaction.Layout(this.ListTab, false))
using (ControlTransaction.Layout(this))
using (ControlTransaction.Layout(_tabPage, false))
{
if (this.ListTab.SelectedTab == _tabPage)
{
this.ListTab.SelectTab((this._beforeSelectedTab != null && this.ListTab.TabPages.Contains(this._beforeSelectedTab)) ? this._beforeSelectedTab : this.ListTab.TabPages[0]);
this._beforeSelectedTab = null;
}
this.ListTab.Controls.Remove(_tabPage);
// 後付けのコントロールを破棄
if (tabType == MyCommon.TabUsageType.UserTimeline || tabType == MyCommon.TabUsageType.Lists)
{
using (Control label = _tabPage.Controls["labelUser"])
{
_tabPage.Controls.Remove(label);
}
}
else if (tabType == MyCommon.TabUsageType.PublicSearch)
{
using (Control pnl = _tabPage.Controls["panelSearch"])
{
pnl.Enter -= SearchControls_Enter;
pnl.Leave -= SearchControls_Leave;
_tabPage.Controls.Remove(pnl);
foreach (Control ctrl in pnl.Controls)
{
if (ctrl.Name == "buttonSearch")
{
ctrl.Click -= SearchButton_Click;
}
else if (ctrl.Name == "comboSearch")
{
ctrl.KeyDown -= SearchComboBox_KeyDown;
}
pnl.Controls.Remove(ctrl);
ctrl.Dispose();
}
}
}
_tabPage.Controls.Remove(_listCustom);
_listCustom.SelectedIndexChanged -= MyList_SelectedIndexChanged;
_listCustom.MouseDoubleClick -= MyList_MouseDoubleClick;
_listCustom.ColumnClick -= MyList_ColumnClick;
_listCustom.DrawColumnHeader -= MyList_DrawColumnHeader;
_listCustom.DragDrop -= TweenMain_DragDrop;
_listCustom.DragEnter -= TweenMain_DragEnter;
_listCustom.DragOver -= TweenMain_DragOver;
_listCustom.DrawItem -= MyList_DrawItem;
_listCustom.MouseClick -= MyList_MouseClick;
_listCustom.ColumnReordered -= MyList_ColumnReordered;
_listCustom.ColumnWidthChanged -= MyList_ColumnWidthChanged;
_listCustom.CacheVirtualItems -= MyList_CacheVirtualItems;
_listCustom.RetrieveVirtualItem -= MyList_RetrieveVirtualItem;
_listCustom.DrawSubItem -= MyList_DrawSubItem;
_listCustom.HScrolled -= MyList_HScrolled;
var cols = _listCustom.Columns.Cast<ColumnHeader>().ToList<ColumnHeader>();
_listCustom.Columns.Clear();
cols.ForEach(col => col.Dispose());
cols.Clear();
_listCustom.ContextMenuStrip = null;
_listCustom.ColumnHeaderContextMenuStrip = null;
_listCustom.Font = null;
_listCustom.SmallImageList = null;
_listCustom.ListViewItemSorter = null;
//.........这里部分代码省略.........
示例15: RestoreListViewScroll
/// <summary>
/// <see cref="SaveListViewScroll"/> によって保存されたスクロール位置を復元します
/// </summary>
private void RestoreListViewScroll(DetailsListView listView, TabModel tab, ListViewScroll listScroll)
{
if (listView.VirtualListSize == 0)
return;
switch (listScroll.ScrollLockMode)
{
case ScrollLockMode.FixedToTop:
listView.EnsureVisible(0);
break;
case ScrollLockMode.FixedToBottom:
listView.EnsureVisible(listView.VirtualListSize - 1);
break;
case ScrollLockMode.FixedToItem:
var topIndex = listScroll.TopItemStatusId != null ? tab.IndexOf(listScroll.TopItemStatusId.Value) : -1;
if (topIndex != -1)
listView.TopItem = listView.Items[topIndex];
break;
case ScrollLockMode.None:
default:
break;
}
}