public void setToolTip() { string hn = Hostname; string un = Username; // Check if the hostname is set if (hn == null || hn.Equals("")) { hn = "[NONE SET]"; } // Ignore the default username if the hostname contains an @ if (hn != null && hn.Contains("@")) { un = null; } else if (un != null && !(un.Equals(""))) { un = un + "@"; } // Set the port number to null if default for the protocol string port = ":" + Portnumber; if (Protocol != null && ((Protocol.Equals("ssh") && Portnumber == 22) || (Protocol.Equals("telnet") && Portnumber == 23) || (Protocol.Equals("rlogin") && Portnumber == 513) || Portnumber == -1)) { port = ""; } // Build the connection string String connection = Protocol + "://" + un + hn + port; // Now build the full tooltip text if (SessionDisplayText != null && !SessionDisplayText.Equals("")) { ToolTipText += "Session: " + SessionDisplayText + Environment.NewLine; } ToolTipText += connection + Environment.NewLine; if (remotecommand != null && !remotecommand.Equals("")) { ToolTipText += "Remote Command: " + remotecommand + Environment.NewLine; } if (portforwards != null && !portforwards.Equals("")) { ToolTipText += "Port Forwards: " + portforwards + Environment.NewLine; } // Strip off any trailing newline if (ToolTipText.EndsWith(Environment.NewLine)) { ToolTipText = ToolTipText.Remove(ToolTipText.LastIndexOf(Environment.NewLine)); } }
private void CreateHeaders(ResultSet resultSet) { var headerView = new SourceGrid.Cells.Views.ColumnHeader { ElementText = new DevAge.Drawing.VisualElements.TextRenderer() }; var toolTipController = new ToolTipText(); _grid.ColumnsCount = _entity.Members.Count; _grid.FixedRows = 1; _grid.Rows.Insert(0); _columnMap = ApiUtils.BuildColumnMap(resultSet); for (int i = 0; i < resultSet.FieldCount; i++) { var member = _entity.Members[resultSet.GetFieldName(i)]; _grid[0, _columnMap[i]] = new SourceGrid.Cells.ColumnHeader(HumanText.GetMemberName(member)) { View = headerView, ToolTipText = HumanText.GetMemberName(member), AutomaticSortEnabled = false }; _grid[0, _columnMap[i]].AddController(toolTipController); } }
/// <summary> /// Match tooltip template and replace fields. Need help in improving this. /// Searches for a tokein in {} and replaces with the actual value from DataSource. /// Supports only single token replacement. Need to add support for multiple token replacement. /// </summary> /// <returns></returns> public string MatchToolTipTemplate(string valueField) { //string matchExpression = @"{\w+}"; //string matchExpression = @"{field}"; //MatchEvaluator matchField = MatchEvaluatorField; return(ToolTipText.Replace("{field}", GetResolvedTemplateValue(valueField))); //return Regex.Replace(ToolTipText, matchExpression, matchField); }
public void Write(string text) { if (string.IsNullOrEmpty(ToolTipText.Trim())) { ToolTipText = text; } else { ToolTipText = text + Environment.NewLine + ToolTipText; } }
public ReportGridManager(Grid grid) { _grid = grid; var font = new Font(SystemFonts.MessageBoxFont, FontStyle.Bold); _columnHeaderView = BuildHeaderView(HeaderBackgroundColor, null, font); _lastColumHeaderView = BuildHeaderView(HeaderBackgroundColor, HeaderBorderColor, font); _rowBreakHeaderView = BuildHeaderView(Color.White, HeaderBorderColor, font); _rowHeaderView = BuildHeaderView(Color.White, null, font); _defaultView = BuildView(null, ContentAlignment.MiddleLeft); _defaultBreakView = BuildView(HeaderBorderColor, ContentAlignment.MiddleLeft); _numberView = BuildView(null, ContentAlignment.MiddleRight); _numberBreakView = BuildView(HeaderBorderColor, ContentAlignment.MiddleRight); _toolTipController = new ToolTipText(); }