using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace LYFZ.Software.UI
{
///
/// 欢迎窗体
///
public partial class frmWelcomeForm : LYFZ.ComponentLibrary.BaseContentsFormMain
{
public frmWelcomeForm()
{
InitializeComponent();
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.panelEx1.BackgroundImage = frmWelcomeForm.StudioImageMap; //LYFZ.WinAPI.CustomPublicMethod.GetMenuItemImage("\\影楼形象图.jpg");
this.plExMainContainer.BackgroundImage = frmWelcomeForm.HomeBackground;// LYFZ.WinAPI.CustomPublicMethod.GetMenuItemImage("\\首页背景.png");
SetGlassButtonClick(this.plExMainContainer.Controls);
}
static Image studioImageMap = null;
///
/// 影楼形象图
///
public static Image StudioImageMap
{
get
{
if (frmWelcomeForm.studioImageMap == null)
{
string imagPath = LYFZ.WinAPI.CustomPublicMethod.GetFullDirectoryPath(LYFZ.WinAPI.CustomPublicMethod.BasePath) + "Resources\\SThemeImage\\Rimg_bg.png";
if (System.IO.File.Exists(imagPath))
{
frmWelcomeForm.studioImageMap = LYFZ.WinAPI.CustomPublicMethod.GetPathToBitmap(imagPath);
}
else
{
frmWelcomeForm.studioImageMap = LYFZ.ImageFunction.ImageOperation.GetNewBitmap(LYFZ.WinAPI.CustomPublicMethod.GetMenuItemImage("\\影楼形象图.png"));
}
}
return frmWelcomeForm.studioImageMap;
}
set { frmWelcomeForm.studioImageMap = value; }
}
static Image homeBackground = null;
///
/// 首页背景
///
public static Image HomeBackground
{
get
{
if (frmWelcomeForm.homeBackground == null)
{
string imagPath = LYFZ.WinAPI.CustomPublicMethod.GetFullDirectoryPath(LYFZ.WinAPI.CustomPublicMethod.BasePath) + "Resources\\SThemeImage\\Bgimg_bg.png";
if (System.IO.File.Exists(imagPath))
{
frmWelcomeForm.homeBackground = LYFZ.WinAPI.CustomPublicMethod.GetPathToBitmap(imagPath);
}
else
{
frmWelcomeForm.homeBackground = LYFZ.ImageFunction.ImageOperation.GetNewBitmap(LYFZ.WinAPI.CustomPublicMethod.GetMenuItemImage("\\首页背景.png"));
}
}
return frmWelcomeForm.homeBackground;
}
set { frmWelcomeForm.homeBackground = value; }
}
///
///
///
///
void SetGlassButtonClick(Control.ControlCollection controls)
{
// ComponentLibrary.GlassButton
foreach (Control btnControl in controls)
{
if (btnControl.GetType() == typeof(ComponentLibrary.GlassButton))
{
btnControl.Click += btnControl_Click;
}
}
}
public void btnControl_Click(object sender, EventArgs e)
{
ComponentLibrary.GlassButton gbtn = (ComponentLibrary.GlassButton)sender;
LYFZ.Model.Model_SystemToolsMenu.Item item = new Model.Model_SystemToolsMenu.Item();
item.KeyName = gbtn.Name;
// item.DllFileKey = "SUMB";
// item.OpenMode = "ShowEmbedded";
// item.ClassFullName = "LYFZ.Software.PhotoStudio.frmWelcomeForm";//gbtn.Tag.ToString();
try
{
string[] parameters = gbtn.Tag.ToString().Split('|');
item.DllFileKey = parameters[0];
item.OpenMode = parameters[1];
item.ClassFullName = parameters[2];
}
catch
{
MessageBoxCustom.Show("模块参数不正确,请写管理员联系!");
return;
}
try
{
//typeof(LYFZ.StandardInterface.IToolMenuClick).IsAssignableFrom(this.ParentForm.GetType())
//用于判断父窗体是否实现了指定的LYFZ.StandardInterface.IToolMenuClick接口
if (typeof(LYFZ.StandardInterface.IToolMenuClick).IsAssignableFrom(this.ParentForm.GetType()))
{
LYFZ.StandardInterface.IToolMenuClick iParentForm = (LYFZ.StandardInterface.IToolMenuClick)this.ParentForm;
DynamicMenu.ToolsClickProcessingMethod(item, iParentForm);
}
}
catch
{
MessageBoxCustom.Show("模块加载失败,请写管理员联系!");
}
}
}
}