void PreCreateItemDataLayerEvent(ScLayerLayoutViewerItem item) { item.SuspendLayout(); ScLayerLayoutViewerHeaderItem headerItem; ScLayerLayoutViewerHeaderItem dataItem; ScLayerLayoutViewerHeaderItemContainer dataItemContainer = new ScLayerLayoutViewerHeaderItemContainer(item.ScMgr); item.AddContent(dataItemContainer); dataItemContainer.HeaderOrientation = ScLayerLayoutViewerHeaderOrientation.HORIZONTAL; dataItemContainer.CreateHeaderItemDataLayerEvent += DataItemContainer_CreateHeaderItemDataLayerEvent; dataItemContainer.ItemMinSize = ItemMinSize - (HeaderControlerSize - RowControlerSize); dataItemContainer.CreateHeaderItemFormDataInfo(columnInfos, RowControlerSize, null); dataItemContainer.DirectionRect = new RectangleF(0, 0, item.Width, item.Height); for (int i = 0; i < header.controls.Count; i++) { dataItem = (ScLayerLayoutViewerHeaderItem)dataItemContainer.controls[i]; headerItem = (ScLayerLayoutViewerHeaderItem)header.controls[i]; dataItem.Width = headerItem.Width - (HeaderControlerSize - RowControlerSize); } item.ResumeLayout(false); }
Dictionary <string, ScLayer> CreateUserItemDict(ScLayerLayoutViewerItem viewerItem) { ScLayerLayoutViewerHeaderItemContainer dataItemContainer = (ScLayerLayoutViewerHeaderItemContainer)viewerItem.GetContent(); ScLayerLayoutViewerHeaderItem item; Dictionary <string, ScLayer> userItemDict = new Dictionary <string, ScLayer>(); ScLayer userLayer; if (dataItemContainer == null) { return(null); } for (int j = 0; j < dataItemContainer.controls.Count(); j++) { item = (ScLayerLayoutViewerHeaderItem)dataItemContainer.controls[j]; if (item.ContentLayer.controls.Count > 0) { if (item.ContentLayer.controls.Count == 2) { userLayer = item.ContentLayer.controls[1]; } else { userLayer = item.ContentLayer.controls[0]; } } else { userLayer = null; } if (userItemDict.ContainsKey(item.ItemDataName)) { continue; } userItemDict.Add(item.ItemDataName, userLayer); } return(userItemDict); }
private void Header_SizeChanegedEvent(ScLayerLayoutViewerHeaderItemContainer headerItemContainer, List <ScLayer> headerItemList) { headerTitleContainer.Size = header.Size; List <ScLayer>[] itemlists = { dbScreen.GetScreen1AllItem(), dbScreen.GetScreen2AllItem() }; if (itemlists[0].Count == 0 || itemlists[1].Count == 0) { return; } SuspendLayout(); HeaderItemSizeChangedEventHandler(headerItemList); dbScreen.Width = headerItemContainer.Width; ResumeLayout(true); if (ContentSizeChangedEvent != null) { ContentSizeChangedEvent(); } }
public ScGridViewCore(ScMgr scmgr = null) : base(scmgr) { headerTitleContainer = new ScLayer(scmgr); headerTitleContainer.IsHitThrough = true; Add(headerTitleContainer); header = new ScLayerLayoutViewerHeaderItemContainer(scmgr); header.StyleIdx = 1; header.IsUseDebugPanitCode = true; header.HeaderOrientation = ScLayerLayoutViewerHeaderOrientation.HORIZONTAL; header.CreateHeaderItemDataLayerEvent += Header_CreateHeaderItemDataLayerEvent; header.HeaderItemValueChangedEvent += Header_HeaderItemValueChangedEvent; header.SizeChanegedEvent += Header_SizeChanegedEvent; Add(header); dbScreen = new ScLayerLayoutViewerDoubleScreenViewport(scmgr); dbScreen.LayoutMode = ScLayerLayoutViewerLayoutMode.MORE_ROW_SINGLE_COL_LAYOUT; dbScreen.CreateItemDataLayerEvent = PreCreateItemDataLayerEvent; dbScreen.ItemDataSetValueEvent += DbScreen_ItemDataSetValueEvent; dbScreen.UserLayerValueChangedEvent += DbScreen_UserLayerValueChangedEvent; dbScreen.ViewerItemMouseEnterEvent += DbScreen_ViewerItemMouseEnterEvent; dbScreen.ViewerItemMouseDownEvent += DbScreen_ViewerItemMouseDownEvent; dbScreen.ViewerItemMouseLeaveEvent += DbScreen_ViewerItemMouseLeaveEvent; dbScreen.ViewerItemMouseDoubleDownEvent += DbScreen_ViewerItemMouseDoubleDownEvent; Add(dbScreen); // SizeChanged += ScGridView_SizeChanged; // D2DPaint += ScGridViewContainer_D2DPaint; BackgroundColor = Color.FromArgb(255, 227, 228, 231); }