资源简介
在做有些程序时,常常要添加一些图片来使界面更美观,我搜了一下,全放在这个文件里了,觉得有用的下。
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace Kayang.Workshop.Resources
{
public enum MenuItemVal
{
MF_UNCHECKED = 0x00000000
MF_STRING = 0x00000000
MF_DISABLED = 0x00000002
MF_GRAYED = 0x00000001
MF_CHECKED = 0x00000008
MF_POPUP = 0x00000010
MF_BARBREAK = 0x00000020
MF_BREAK = 0x00000040
MF_BYPOSITION = 0x00000400
MF_BYCOMMAND = 0x00000000
MF_SEPARATOR = 0x00000800
}
internal class NativeFunction
{
public const int WM_SYSCOMMAND = 0x0112;
public static readonly IntPtr TRUE = new IntPtr(1);
[DllImport(“user32.dll“ SetLastError = true)]
public static extern IntPtr GetSystemMenu(IntPtr hWnd bool bRevert);
[DllImport(“user32.dll“ SetLastError = true)]
public static extern bool InsertMenu(IntPtr hMenu int wPosition int wFlags int wIDNewItem string lpNewItem);
[DllImport(“user32.dll“ SetLastError = true)]
public static extern bool AppendMenu(IntPtr hMenu int wFlags int wIDNewItem string lpNewItem);
}
public class OperateSystemMenu : NativeWindow IDisposable
{
private Form _owner;
private IntPtr _hMenu;
private Dictionary _menuClickEventList;
public OperateSystemMenu(Form owner)
{
_owner = owner;
base.AssignHandle(owner.Handle);
GetSystemMenu();
}
protected Dictionary MenuClickEventList
{
get
{
if (_menuClickEventList == null)
{
_menuClickEventList = new Dictionary(10);
}
return _menuClickEventList;
}
}
public bool InsertMenu(int positionint idstring textEventHandler menuClickEvent)
{
return InsertMenu(position id MenuItemVal.MF_BYPOSITION | MenuItemVal.MF_STRINGtextmenuClickEvent);
}
public bool InertSeparator(int position)
{
return InsertMenu(position 0 MenuItemVal.MF_BYPOSITION | MenuItemVal.MF_SEPARATOR““null);
}
public bool InsertMenu(int positionint idMenuItemVal flagstring textEventHandler menuClickEvent)
{
if ((flag & MenuItemVal.MF_SEPARATOR) != MenuItemVal.MF_SEPARATOR &&!ValidateID(id))
{
return false;
}
bool sucess = NativeFunction.InsertMenu(_hMenuposition(int)flagidtext);
if (sucess && menuClickEvent != null)
{
MenuClickEventList.Add(id menuClickEvent);
}
return sucess;
}
public bool AppendMenu(int idstring textEventH
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
.CA.... 2238 2001-10-13 11:51 Resources\!doc.ico
.CA.... 161862 2002-10-21 03:31 Resources\02.ico
.CA.... 161862 2002-10-21 03:31 Resources\03.ico
.CA.... 161862 2002-10-21 03:31 Resources\04.ico
.CA.... 161862 2002-10-21 03:31 Resources\05.ico
.CA.... 161862 2002-10-21 03:33 Resources\1.ico
.CA.... 25214 2003-02-16 12:55 Resources\10.ICO
.CA...R 1406 2014-09-02 16:26 Resources\101.ico
.CA...R 1406 2014-09-02 16:26 Resources\102.ico
.CA.... 4710 2001-04-13 03:29 Resources\103 (2).ico
.CA...R 1150 2014-09-02 16:26 Resources\103.ico
.CA...R 1150 2014-09-02 16:26 Resources\104.ico
.CA...R 1406 2014-09-02 16:26 Resources\105.ico
.CA...R 1406 2014-09-02 16:26 Resources\106.ico
.CA...R 1406 2014-09-02 16:26 Resources\108.ico
.CA...R 1406 2014-09-02 16:26 Resources\109.ico
.CA.... 25214 2003-02-16 12:56 Resources\11.ICO
.CA...R 1406 2014-09-02 16:26 Resources\110.ico
.CA...R 1406 2014-09-02 16:26 Resources\111.ico
.CA...R 1406 2014-09-02 16:26 Resources\112.ico
.CA...R 1150 2014-09-02 16:26 Resources\113.ico
.CA...R 1406 2014-09-02 16:26 Resources\114.ico
.CA...R 1406 2014-09-02 16:26 Resources\115.ico
.CA...R 1406 2014-09-02 16:26 Resources\118.ico
.CA...R 1406 2014-09-02 16:26 Resources\119.ico
.CA.... 25214 2003-02-16 12:56 Resources\12.ICO
.CA...R 1406 2014-09-02 16:26 Resources\120.ico
.CA...R 1406 2014-09-02 16:26 Resources\121.ico
.CA...R 1406 2014-09-02 16:26 Resources\1211.ico
.CA...R 1150 2014-09-02 16:26 Resources\122.ico
............此处省略588个文件信息
评论
共有 条评论