コード例 #1
0
        private void toolTipController1_GetActiveObjectInfo(object sender, DevExpress.Utils.ToolTipControllerGetActiveObjectInfoEventArgs e)
        {
            if (e.SelectedControl is DevExpress.XtraTreeList.TreeList)
            {
                TreeList        tree = (TreeList)e.SelectedControl;
                TreeListHitInfo hit  = tree.CalcHitInfo(e.ControlMousePosition);
                if (hit.HitInfoType == HitInfoType.Cell)
                {
                    object cellInfo = new TreeListCellToolTipInfo(hit.Node, hit.Column, null);

                    string name    = (string)hit.Node[hit.Column];
                    string toolTip = "";
                    if (name.Length >= 18)
                    {
                        string dayOfYearStr = name.Substring(15, 3);    //截取天数
                        string yearStr      = name.Substring(13, 2);    //截取年份
                        int    dayOfYear    = 0;
                        int    year         = 0;
                        if (int.TryParse(dayOfYearStr, out dayOfYear))
                        {
                            if (int.TryParse(yearStr, out year))
                            {
                                DateTime date    = new DateTime(2000 + year, 1, 1).AddDays(dayOfYear - 1);
                                string   dateStr = date.ToString("yyyy年MM月dd日");
                                toolTip = string.Format("{0} ({1})", hit.Node[hit.Column], dateStr);
                            }
                        }
                    }
                    else
                    {
                        toolTip = string.Format("{0}", hit.Node[hit.Column]);
                    }
                    e.Info = new DevExpress.Utils.ToolTipControlInfo(cellInfo, toolTip);
                }
            }
        }
コード例 #2
0
ファイル: ucFileNavPanel.cs プロジェクト: AgentWord/SiPing
        private void toolTipController1_GetActiveObjectInfo(object sender, DevExpress.Utils.ToolTipControllerGetActiveObjectInfoEventArgs e)
        {
            if (e.SelectedControl is DevExpress.XtraTreeList.TreeList)
            {
                TreeList tree = (TreeList)e.SelectedControl;
                TreeListHitInfo hit = tree.CalcHitInfo(e.ControlMousePosition);
                if (hit.HitInfoType == HitInfoType.Cell)
                {
                    object cellInfo = new TreeListCellToolTipInfo(hit.Node, hit.Column, null);

                    string name = (string)hit.Node[hit.Column];
                    string toolTip = "";
                    if (name.Length >= 18)
                    {
                        string dayOfYearStr = name.Substring(15, 3);    //截取天数
                        string yearStr = name.Substring(13, 2);         //截取年份
                        int dayOfYear = 0;
                        int year = 0;
                        if (int.TryParse(dayOfYearStr, out dayOfYear))
                        {
                            if (int.TryParse(yearStr, out year))
                            {
                                DateTime date = new DateTime(2000 + year, 1, 1).AddDays(dayOfYear - 1);
                                string dateStr = date.ToString("yyyy年MM月dd日");
                                toolTip = string.Format("{0} ({1})", hit.Node[hit.Column], dateStr);
                            }
                        }
                    }
                    else
                    {
                        toolTip = string.Format("{0}", hit.Node[hit.Column]);
                    }
                    e.Info = new DevExpress.Utils.ToolTipControlInfo(cellInfo, toolTip);
                }
            }
        }
コード例 #3
0
		private void toolTipController1_GetActiveObjectInfo(
			object sender,
			ToolTipControllerGetActiveObjectInfoEventArgs e)
		{
			// http://www.devexpress.com/Support/Center/KB/p/A474.aspx

			if (e.SelectedControl is TreeList)
			{
				var tree = (TreeList)e.SelectedControl;
				var hit = tree.CalcHitInfo(e.ControlMousePosition);

				if (hit.HitInfoType == HitInfoType.Cell)
				{
					var cellInfo = new TreeListCellToolTipInfo(hit.Node, hit.Column, null);

					var fg = hit.Node.Tag as FileGroup;
					var fsi = hit.Node.Tag as ZlpFileInfo;

					string tt;
					if (fg != null)
					{
						tt = fg.GetFullNameIntelligent(Project);
					}
					else if (fsi != null)
					{
						tt = fsi.FullName;
					}
					else
					{
						tt = null;
					}

					if (tt != null)
					{
						e.Info = new ToolTipControlInfo(cellInfo, tt);
					}
				}
			}
		}