/// <summary> /// 加载 /// </summary> /// <param name="name">名称</param> public void loadXml(String name) { if (name == "MainFrame") { m_xml = new MainFrame(); } m_xml.createNative(); m_native = m_xml.Native; m_native.Paint = new GdiPlusPaintEx(); m_host = new WinHostEx(); m_host.Native = m_native; m_native.Host = m_host; m_host.HWnd = Handle; m_native.AllowScaleSize = true; m_native.DisplaySize = new FCSize(ClientSize.Width, ClientSize.Height); m_xml.resetScaleSize(GetClientSize()); m_xml.Script = new FaceCatScript(m_xml); m_xml.Native.ResourcePath = DataCenter.getAppPath() + "\\config"; m_xml.load(DataCenter.getAppPath() + "\\config\\" + name + ".html"); m_host.ToolTip = new FCToolTip(); m_host.ToolTip.Font = new FCFont("SimSun", 20, true, false, false); (m_host.ToolTip as FCToolTip).InitialDelay = 250; m_native.update(); Invalidate(); }
/// <summary> /// 停止秒表 /// </summary> /// <param name="timerID">秒表ID</param> public override void stopTimer(int timerID) { IntPtr hWnd = m_hWnd; if (m_native.MirrorMode != FCMirrorMode.None) { WinHost host = m_native.MirrorHost.Host as WinHost; hWnd = host.HWnd; } KillTimer(hWnd, timerID); }
/// <summary> /// 开启秒表 /// </summary> /// <param name="timerID">秒表ID</param> /// <param name="interval">间隔</param> public override void startTimer(int timerID, int interval) { IntPtr hWnd = m_hWnd; if (m_native.MirrorMode != FCMirrorMode.None) { WinHost host = m_native.MirrorHost.Host as WinHost; hWnd = host.HWnd; } SetTimer(hWnd, timerID, interval, null); }
/// <summary> /// 在控件的线程中调用方法 /// </summary> /// <param name="control">控件</param> /// <param name="args">参数</param> public override void invoke(FCView control, object args) { lock (m_invokeArgs) { m_invokeArgs.put(m_invokeSerialID, args); } lock (m_invokeControls) { m_invokeControls.put(m_invokeSerialID, control); } IntPtr hWnd = m_hWnd; if (m_native.MirrorMode != FCMirrorMode.None) { WinHost host = m_native.MirrorHost.Host as WinHost; hWnd = host.HWnd; } PostMessage(hWnd, m_pInvokeMsgID, m_invokeSerialID, 0); m_invokeSerialID++; }
/// <summary> /// 创建图形控件 /// </summary> public MainForm() { InitializeComponent(); m_xml = new MainFrame(); m_xml.createNative(); m_native = m_xml.Native; m_native.ResourcePath = Application.StartupPath + "\\image"; //m_native.Paint = new GdiPlusPaintEx(); m_host = new WinHost(); m_host.Native = m_native; m_native.Host = m_host; m_host = m_native.Host as WinHost; m_host.HWnd = Handle; m_native.AllowScaleSize = true; m_native.DisplaySize = new FCSize(ClientSize.Width, ClientSize.Height); m_native.ScaleSize = new FCSize(ClientSize.Width, ClientSize.Height); m_xml.loadFile(Application.StartupPath + "\\config\\MainFrame.html", null); m_xml.resetScaleSize(m_native.DisplaySize); Invalidate(); //字符串+ m_native.update(); m_native.invalidate(); }