/// <summary> /// get the magic property Id which is affected by the window property. /// This function is not activated with the other functions when building the properties for the runtime designer. It is used /// when unserializing values and seting them on magic properties. /// </summary> /// <param name="controlType"></param> /// <param name="winPropName"></param> /// <returns></returns> static public int GetMagicPropId(MgControlType controlType, string winPropName) { switch (winPropName) { case Constants.WinPropLeft: case Constants.WinPropX1: return(PropInterface.PROP_TYPE_LEFT); case Constants.WinPropTop: case Constants.WinPropY1: return(PropInterface.PROP_TYPE_TOP); case Constants.WinPropWidth: case Constants.WinPropX2: return(PropInterface.PROP_TYPE_WIDTH); case Constants.WinPropHeight: case Constants.WinPropY2: return(PropInterface.PROP_TYPE_HEIGHT); case Constants.WinPropBackColor: case Constants.WinPropForeColor: return(PropInterface.PROP_TYPE_COLOR); case Constants.WinPropFont: return(PropInterface.PROP_TYPE_FONT); case Constants.WinPropText: if (controlPropsDictionary[controlType].Contains(PropInterface.PROP_TYPE_FORMAT)) { return(PropInterface.PROP_TYPE_FORMAT); } if (controlPropsDictionary[controlType].Contains(PropInterface.PROP_TYPE_LABEL)) { return(PropInterface.PROP_TYPE_LABEL); } return(PropInterface.PROP_TYPE_TEXT); case Constants.WinPropLayer: return(PropInterface.PROP_TYPE_LAYER); case Constants.WinPropVisible: return(PropInterface.PROP_TYPE_VISIBLE); case Constants.WinPropGradientStyle: return(PropInterface.PROP_TYPE_GRADIENT_STYLE); } if (!winPropName.EndsWith(Constants.TabOrderPropertyTermination)) { Debug.Assert(false, "unhandled property " + winPropName); } return(0); }
/// <summary>get control (which is not the frame form) by its name</summary> /// <param name = "ctrlName">is the requested controls name</param> /// <param name="ctrlType"></param> /// <returns> the requested control object</returns> internal MgControlBase getCtrlByName(String ctrlName, MgControlType ctrlType) { if (!string.IsNullOrEmpty(ctrlName)) { foreach (MgControlBase ctrl in _controls) { if (ctrl.Type == ctrlType) { if (ctrlName.Equals(ctrl.getName(), StringComparison.InvariantCultureIgnoreCase) || ctrlName.Equals(ctrl.Name, StringComparison.InvariantCultureIgnoreCase)) { return(ctrl); } } } } return(null); }
/// <summary>Adds the pane to the status bar/// </summary> /// <param name="statusBarIdx">Status bar index</param> /// <param name="paneType">Pane type: label or image</param> /// <param name="paneIdx">Pane index</param> /// <param name="paneWidth">Pane width</param> /// <param name="showPaneBorder">Show border or not</param> public void AddPane(MgControlType paneType, int paneIdx, int paneWidth, bool showPaneBorder) { var num = new NUM_TYPE(); //Get status bar index. int statusBarIdx = getForm().getControlIdx(this); // Create pane object MgControlBase paneObj = getForm().ConstructMgControl(paneType, getForm().getTask(), statusBarIdx); if (paneObj != null) { // Set width of pane object. num.NUM_4_LONG(paneWidth); paneObj.setProp(PropInterface.PROP_TYPE_WIDTH, num.toXMLrecord()); // Set Idx of pane object. num.NUM_4_LONG(paneIdx); paneObj.setProp(PropInterface.PROP_TYPE_LAYER, num.toXMLrecord()); // Set border of pane object. if (showPaneBorder) { paneObj.setProp(PropInterface.PROP_TYPE_BORDER, "1"); } //Properties specific to image pane only. if (paneObj.Type == MgControlType.CTRL_TYPE_SB_IMAGE) { paneObj.DataType = StorageAttribute.ALPHA; paneObj.setPIC("1000"); num.NUM_4_LONG((int)CtrlImageStyle.Copied); paneObj.setProp(PropInterface.PROP_TYPE_IMAGE_STYLE, num.toXMLrecord()); } //Add to control table collection. getForm().CtrlTab.addControl(paneObj); //Add to collection. Debug.Assert(!_paneObjectsCollection.ContainsKey(paneIdx)); _paneObjectsCollection[paneIdx] = paneObj; } }
/// <summary> /// /// </summary> /// <param name="control"></param> internal override void setSpecificControlProperties(Control control) { MgControlType type = GuiMgControl.Type; ControlUtils.SetContentAlignment(control, ContentAlignment); if (Text != null) { GuiUtilsBase.setText(control, Text); } if (GuiMgControl.IsHyperTextButton()) { MgLinkLabel mgLinkLabel = ((MgLinkLabel)control); mgLinkLabel.SetHoveringColor(HoveringFGColor, HoveringBGColor); mgLinkLabel.SetVisitedColor(VisitedFGColor, VisitedBGColor); mgLinkLabel.LinkVisited = Visited; mgLinkLabel.RefreshLinkColor(); } }
/// <summary> /// /// </summary> /// <param name="sourceControl"></param> /// <returns></returns> Control CreateComponent(Control sourceControl, MgControlType controlType) { Control newCtrl = null; if (controlType == MgControlType.CTRL_TYPE_DOTNET) { newCtrl = CreateDotNetWrapper(sourceControl); } else if (controlType == MgControlType.CTRL_TYPE_COMBO && ((MgComboBox)sourceControl).DrawMode == DrawMode.OwnerDrawFixed) { newCtrl = CreateMgFlexiCombo(sourceControl); } else if (SelectIsAllowed(sourceControl)) { newCtrl = (Control)host.CreateComponent(GetCreateType(sourceControl)); } else { newCtrl = (Control)Activator.CreateInstance(GetCreateType(sourceControl)); } return(newCtrl); }