本文整理汇总了C#中System.Windows.Forms.DataGridView.Focus方法的典型用法代码示例。如果您正苦于以下问题:C# System.Windows.Forms.DataGridView.Focus方法的具体用法?C# System.Windows.Forms.DataGridView.Focus怎么用?C# System.Windows.Forms.DataGridView.Focus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.DataGridView
的用法示例。
在下文中一共展示了System.Windows.Forms.DataGridView.Focus方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: drawTags
//private Dictionary<String, int> parseText(String text, int width)
//{
// String line = String.Empty;
// String returnString = String.Empty;
// //String[] wordArray = text.Split(' ');
// //count records how many rows it has.
// int count = 1;
// Dictionary<String, int> result = new Dictionary<String, int>();
// for (int i = 0; i < text.Length; i++)
// {
// char word = text[i];
// if (ResourceManager.font_.MeasureString(line + word).X > width)
// {
// int tempAddwidth = 0;
// while (i < text.Length && text[i] != ' ' && ((text[i] >= 'a' && text[i] <= 'z') || (text[i] >= 'A' && text[i] <= 'Z')))
// {
// word = text[i];
// line = line + word;
// tempAddwidth += (int)ResourceManager.font_.MeasureString(word.ToString()).X;
// i++;
// }
// if (tempAddwidth > addwidth)
// addwidth = tempAddwidth;
// if (i < text.Length)
// {
// returnString = returnString + line + '\n';
// count++;
// line = String.Empty;
// }
// }
// if(i < text.Length)
// line = line + text[i];
// }
// result[returnString + line] = count;
// return result;
//}
//left 2; right 2; up & down 4; alignment
public Vector2 drawTags(int startX, int startY, float angleDisplay, int height, float scale)
{
//int YOffset = 0;
//int resultWidth = 0;
if (allTags.Count > 1 && wallLabel == null)
{
//string result = String.Empty;
wallLabel = new System.Windows.Forms.DataGridView();
wallLabel.ColumnCount = 1;
wallLabel.ColumnHeadersVisible = false;
wallLabel.RowHeadersVisible = false;
//change line automatically
wallLabel.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
wallLabel.BorderStyle = System.Windows.Forms.BorderStyle.None;
wallLabel.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.SingleHorizontal;
wallLabel.DefaultCellStyle.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
//set column to fill the whole width
wallLabel.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
//background
wallLabel.BackgroundColor = System.Drawing.Color.White;
//wallLabel.MultiSelect = true;
//wallLabel.SelectionChanged += new EventHandler(wallLabel_SelectionChanged);
wallLabel.ReadOnly = true;
wallLabel.CellMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(wallLabel_CellMouseClick);
//wallLabel.CellBeginEdit += new System.Windows.Forms.DataGridViewCellCancelEventHandler(wallLabel_CellBeginEdit);
wallLabel.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
wallLabel.DefaultCellStyle.SelectionBackColor = System.Drawing.Color.White;
wallLabel.DefaultCellStyle.SelectionForeColor = System.Drawing.Color.Red;
//wallLabel.EditMode = System.Windows.Forms.DataGridViewEditMode.
foreach (String tag in allTags)
{
if(tag.Length > 0)
wallLabel.Rows.Add(tag);
//Dictionary<String, int> result = parseText(tag, width - left - right);
//if (result.Values.First() > 1)
// resultWidth = width + addwidth;
//else if (resultWidth < width && resultWidth < ResourceManager.font_.MeasureString(tag).Length() + 5)
// resultWidth = (int)ResourceManager.font_.MeasureString(tag).Length() + 5;
//if (activeTagList.Contains(tag))
//{
// Browser.Instance.batch_.DrawString(ResourceManager.font_, result.Keys.First(), new Vector2(startX + left, startY + YOffset), Color.Red);
//}
//else
// Browser.Instance.batch_.DrawString(ResourceManager.font_, result.Keys.First(), new Vector2(startX + left, startY + YOffset), Color.Gray);
//Vector2 size = ResourceManager.font_.MeasureString(tag);
////create bounding box for every tag
//tagBox[tag] = new BoundingBox2D(new Vector2(startX, startY + YOffset), new Vector2(startX + resultWidth, startY + YOffset + size.Y * result.Values.First()), angleDisplay);
//YOffset +=(int) size.Y * result.Values.First()+ up;
}
wallLabel.Location = new System.Drawing.Point(startX, startY);
wallLabel.Size = new System.Drawing.Size(width, height);
Browser.Instance.wall.Controls.Add(wallLabel);
wallLabel.ClearSelection();
wallLabel.Focus();
Browser.Instance.wall.AddLabel(wallLabel);
}
else if (wallLabel != null)
{
//wallLabel.Update(new System.Drawing.Point(startX + (int)Browser.Instance.clientBounds.Min.X, startY + (int)Browser.Instance.clientBounds.Min.Y), new System.Drawing.Size((int)(width), height));
wallLabel.Location = new System.Drawing.Point(startX, startY);
//.........这里部分代码省略.........