Files
dmex b02427417c PH1.x: fixed build
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@5614 21ef857c-d57f-4fe0-8362-d861dc6d29cd
2014-02-25 23:14:38 +00:00

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
}
}