System.Windows.Forms.DrawListViewItemEventArgs.DrawFocusRectangle()

Here are the examples of the csharp api class System.Windows.Forms.DrawListViewItemEventArgs.DrawFocusRectangle() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

1. Example

Project: subtitleedit
Source File: SubtitleListView.cs
View license
private void SubtitleListView_DrawItem(object sender, DrawListViewItemEventArgs e)
        {
            if (!Focused && (e.State & ListViewItemStates.Selected) != 0)
            {
                if (e.Item.Focused)
                    e.DrawFocusRectangle();
            }
            else
            {
                e.DrawDefault = true;
            }
        }

2. Example

Project: Nexus-Mod-Manager
Source File: IconListView.cs
View license
protected override void OnDrawItem(DrawListViewItemEventArgs e)
		{
			e.DrawDefault = true;

			Int32 intSubItemsRight = 0;
			for (Int32 i = 0; i < e.Item.SubItems.Count; i++)
			{
				if (Messages.ContainsKey(e.Item.SubItems[i]))
					e.DrawDefault = false;
				if (i > 0 && intSubItemsRight < e.Item.SubItems[i].Bounds.Right)
					intSubItemsRight += e.Item.SubItems[i].Bounds.Right;
			}
			if (!e.DrawDefault)
			{
				if (e.Item.Focused && !CheckBoxes)
					e.DrawFocusRectangle();
				if (e.Item.Selected)
				{
					Color clrBackColor = e.Item.ListView.Focused ? SystemColors.Highlight : SystemColors.Control;
					e.Graphics.FillRectangle(new SolidBrush(clrBackColor), new Rectangle(intSubItemsRight, e.Bounds.Y, e.Item.Bounds.Width - intSubItemsRight, e.Bounds.Height));
				}
			}
			base.OnDrawItem(e);
		}

3. Example

Project: gitextensions
Source File: FileStatusList.cs
View license
private void FileStatusListView_DrawItem(object sender, DrawListViewItemEventArgs e)
        {
            if (e.Bounds.Height <= 0 || e.Bounds.Width <= 0 || e.ItemIndex < 0)
                return;

            e.DrawBackground();
            Color color;
            if (e.Item.Selected)
            {
                e.Graphics.FillRectangle(SystemBrushes.Highlight, e.Bounds);
                color = SystemColors.HighlightText;
            }
            else
                color = SystemColors.WindowText;
            e.DrawFocusRectangle();

            e.Graphics.FillRectangle(Brushes.White, e.Bounds.Left, e.Bounds.Top, ImageSize, e.Bounds.Height);

            int centeredImageTop = e.Bounds.Top;
            if ((e.Bounds.Height - ImageSize) > 1)
                centeredImageTop = e.Bounds.Top + ((e.Bounds.Height - ImageSize) / 2);

            var image = e.Item.ImageList.Images[e.Item.ImageIndex];

            if (image != null)
                e.Graphics.DrawImage(image, e.Bounds.Left, centeredImageTop, ImageSize, ImageSize);

            GitItemStatus gitItemStatus = (GitItemStatus)e.Item.Tag;

            string text = GetItemText(e.Graphics, gitItemStatus);
            text = AppendItemSubmoduleStatus(text, gitItemStatus);

            e.Graphics.DrawString(text, e.Item.ListView.Font,
                                  new SolidBrush(color), e.Bounds.Left + ImageSize, e.Bounds.Top);
        }