mirror of
https://github.com/mirror/processhacker
synced 2026-06-08 16:03:24 +00:00
b02427417c
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@5614 21ef857c-d57f-4fe0-8362-d861dc6d29cd
81 lines
1.8 KiB
C#
81 lines
1.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Drawing;
|
|
using System.Data;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using ProcessHacker.Common;
|
|
using ProcessHacker.Native.Api;
|
|
|
|
namespace ProcessHacker.Components
|
|
{
|
|
public partial class MessageLabel : UserControl
|
|
{
|
|
private MessageLabelIcon _icon = MessageLabelIcon.None;
|
|
|
|
public MessageLabel()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public bool AutoEllipsis
|
|
{
|
|
get { return labelText.AutoEllipsis; }
|
|
set { labelText.AutoEllipsis = value; }
|
|
}
|
|
|
|
public MessageLabelIcon Icon
|
|
{
|
|
get { return _icon; }
|
|
set
|
|
{
|
|
Image oldImage;
|
|
|
|
_icon = value;
|
|
|
|
oldImage = pictureIcon.Image;
|
|
|
|
pictureIcon.Image = this.GetBitmap(_icon);
|
|
|
|
if (oldImage != null)
|
|
oldImage.Dispose();
|
|
}
|
|
}
|
|
|
|
[Browsable(true)]
|
|
public override string Text
|
|
{
|
|
get { return labelText.Text; }
|
|
set { labelText.Text = value; }
|
|
}
|
|
|
|
private Bitmap GetBitmap(MessageLabelIcon icon)
|
|
{
|
|
if (icon == MessageLabelIcon.None)
|
|
return null;
|
|
|
|
IntPtr iconHandle;
|
|
|
|
Win32.LoadIconMetric(IntPtr.Zero, new IntPtr((int)icon), 0, out iconHandle);
|
|
|
|
try
|
|
{
|
|
return Utils.ToBitmap(iconHandle, 16, 16);
|
|
}
|
|
finally
|
|
{
|
|
Win32.DestroyIcon(iconHandle);
|
|
}
|
|
}
|
|
}
|
|
|
|
public enum MessageLabelIcon
|
|
{
|
|
None = 0,
|
|
Information = 32516,
|
|
Warning = 32515,
|
|
Error = 32513
|
|
}
|
|
}
|