/// <summary> /// 下拉菜单显示方法 /// </summary> public virtual void onDropDownOpening() { //创建下拉菜单及日历 if (m_dropDownMenu == null) { FCHost host = Native.Host; m_dropDownMenu = host.createInternalControl(this, "dropdownmenu") as FCMenu; Native.addControl(m_dropDownMenu); if (m_calendar == null) { m_calendar = CreateCalendar(); m_dropDownMenu.addControl(m_calendar); m_calendar.Size = m_dropDownMenu.Size; m_calendar.addEvent(m_selectedTimeChangedEvent, FCEventID.SELECTEDTIMECHANGED); } } if (m_calendar != null && !m_showTime) { m_calendar.TimeDiv.Height = 0; } m_dropDownMenu.Native = Native; FCPoint nativePoint = pointToNative(new FCPoint(0, Height)); m_dropDownMenu.Location = nativePoint; m_dropDownMenu.Visible = true; if (m_calendar != null) { m_calendar.Mode = FCCalendarMode.Day; } m_dropDownMenu.bringToFront(); m_dropDownMenu.invalidate(); }
/// <summary> /// 显示右键菜单 /// </summary> /// <param name="var">变量</param> /// <returns>状态</returns> private double SHOWRIGHTMENU(CVariable var) { DesignerScript designerScript = m_xml.Script as DesignerScript; FCNative native = m_xml.Native; FCView control = m_xml.findControl(designerScript.getSender()); int clientX = native.clientX(control); int clientY = native.clientY(control); FCMenu menu = m_xml.getMenu(m_indicator.getText(var.m_parameters[0])); menu.Location = new FCPoint(clientX, clientY + control.Height); menu.Visible = true; menu.Focused = true; menu.bringToFront(); native.invalidate(); return(0); }
/// <summary> /// 菜单触摸移动方法 /// </summary> /// <param name="item">菜单项</param> /// <param name="touchInfo">触摸信息</param> public virtual void onMenuItemTouchMove(FCMenuItem item, FCTouchInfo touchInfo) { FCNative native = Native; ArrayList <FCMenuItem> items = null; FCMenuItem parentItem = item.ParentItem; if (parentItem != null) { items = parentItem.getItems(); } else { items = m_items; } //关闭其他表格 bool close = closeMenus(items); if (item.getItems().size() > 0) { FCMenu dropDownMenu = item.DropDownMenu; //获取位置和大小 if (dropDownMenu != null) { dropDownMenu.Native = native; FCLayoutStyle layoutStyle = LayoutStyle; FCPoint location = new FCPoint(native.clientX(item) + item.Width, native.clientY(item)); if (layoutStyle == FCLayoutStyle.LeftToRight || layoutStyle == FCLayoutStyle.RightToLeft) { location.x = native.clientX(item); location.y = native.clientY(item) + item.Height; } //设置弹出位置 dropDownMenu.Opacity = Opacity; dropDownMenu.Location = location; dropDownMenu.bringToFront(); dropDownMenu.focus(); dropDownMenu.show(); adjust(dropDownMenu); } } native.invalidate(); }