EaseBox CreateGripper(PixelFarm.Drawing.Color bgcolor, bool isVertical) { int controllerBoxWH = 10; var gripperBox = new SimpleBox(controllerBoxWH, controllerBoxWH); gripperBox.BackColor = bgcolor; //--------------------------------------------------------------------- gripperBox.MouseDrag += (s, e) => { Point pos = gripperBox.Position; if (isVertical) { gripperBox.SetLocation(pos.X, pos.Y + e.YDiff); } else { gripperBox.SetLocation(pos.X + e.XDiff, pos.Y); } this.ninespaceGrippers.UpdateNinespaces(); e.MouseCursorStyle = MouseCursorStyle.Pointer; e.CancelBubbling = true; }; gripperBox.MouseUp += (s, e) => { e.MouseCursorStyle = MouseCursorStyle.Default; e.CancelBubbling = true; }; return(gripperBox); }
protected override void OnStartDemo(SampleViewport viewport) { //-------------------------------- { //background element var bgbox = new LayoutFarm.CustomWidgets.SimpleBox(800, 600); bgbox.BackColor = Color.White; bgbox.SetLocation(0, 0); SetupBackgroundProperties(bgbox); viewport.AddContent(bgbox); } //-------------------------------- //ninespace compartment ninespaceBox = new NinespaceBox(800, 600); ninespaceBox.ShowGrippers = true; viewport.AddContent(ninespaceBox); ninespaceBox.SetSize(800, 600); //-------------------------------- //-------------------------------- //test add some content to the ninespace box var sampleListView = CreateSampleListView(); ninespaceBox.LeftSpace.ContentLayoutKind = BoxContentLayoutKind.VerticalStack; ninespaceBox.LeftSpace.AddChild(sampleListView); }
protected override void OnStartDemo(SampleViewport viewport) { //-------------------------------- { //background element var bgbox = new LayoutFarm.CustomWidgets.SimpleBox(800, 600); bgbox.BackColor = Color.White; bgbox.SetLocation(0, 0); SetupBackgroundProperties(bgbox); viewport.AddContent(bgbox); } //-------------------------------- //ninespace compartment ninespaceBox = new NinespaceBox(800, 600); ninespaceBox.ShowGrippers = true; viewport.AddContent(ninespaceBox); ninespaceBox.SetSize(800, 600); //-------------------------------- //-------------------------------- //test add some content to the ninespace box var sampleListView = CreateSampleListView(); ninespaceBox.LeftSpace.ContentLayoutKind = BoxContentLayoutKind.VerticalStack; ninespaceBox.LeftSpace.AddChild(sampleListView); }
protected override void OnStartDemo(SampleViewport viewport) { //-------------------------------- { //background element var bgbox = new LayoutFarm.CustomWidgets.SimpleBox(viewport.PrimaryScreenWidth, viewport.PrimaryScreenHeight); bgbox.BackColor = Color.White; bgbox.SetLocation(0, 0); SetupBackgroundProperties(bgbox); viewport.AddContent(bgbox); } //-------------------------------- //ninespace compartment ninespaceBox = new NinespaceBox(viewport.PrimaryScreenWidth, viewport.PrimaryScreenHeight - 15); ninespaceBox.ShowGrippers = true; var ninespace2 = new NinespaceBox(400, 600); ninespace2.SetLeftSpaceWidth(150); ninespace2.ShowGrippers = true; ninespaceBox.RightSpace.AddChild(ninespace2); viewport.AddContent(ninespaceBox); // ninespaceBox.SetSize(800, 600); ////test add some content to the ninespace box //var sampleListView = CreateSampleListView(); //ninespaceBox.LeftSpace.PanelLayoutKind = PanelLayoutKind.VerticalStack; //ninespaceBox.LeftSpace.AddChildBox(sampleListView); }
protected override void OnStartDemo(SampleViewport viewport) { //-------------------------------- { //background element var bgbox = new LayoutFarm.CustomWidgets.SimpleBox(viewport.PrimaryScreenWidth, viewport.PrimaryScreenHeight); bgbox.BackColor = Color.White; bgbox.SetLocation(0, 0); SetupBackgroundProperties(bgbox); viewport.AddContent(bgbox); } //-------------------------------- //ninespace compartment ninespaceBox = new NinespaceBox(viewport.PrimaryScreenWidth, viewport.PrimaryScreenHeight - 15); ninespaceBox.ShowGrippers = true; var ninespace2 = new NinespaceBox(400, 600); ninespace2.SetLeftSpaceWidth(150); ninespace2.ShowGrippers = true; ninespaceBox.RightSpace.AddChild(ninespace2); viewport.AddContent(ninespaceBox); // ninespaceBox.SetSize(800, 600); ////test add some content to the ninespace box //var sampleListView = CreateSampleListView(); //ninespaceBox.LeftSpace.PanelLayoutKind = PanelLayoutKind.VerticalStack; //ninespaceBox.LeftSpace.AddChildBox(sampleListView); }
public void SetPosition(int x, int y) { //TODO: review here again*** //temp fix for invalidate area of overlap children _simpleBox.InvalidateOuterGraphics(); foreach (var ctrl in _controls) { ctrl.InvalidateOuterGraphics(); } _simpleBox.SetLocation(x, y); }
protected override void OnStartDemo(SampleViewport viewport) { //-------------------------------- { //background element var bgbox = new LayoutFarm.CustomWidgets.SimpleBox(800, 600); bgbox.BackColor = Color.White; bgbox.SetLocation(0, 0); SetupBackgroundProperties(bgbox); viewport.AddContent(bgbox); } //-------------------------------- //ninespace compartment ninespaceBox = new UINinespaceBox(800, 600); viewport.AddContent(ninespaceBox); ninespaceBox.SetSize(800, 600); }
protected override void OnStartDemo(SampleViewport viewport) { //-------------------------------- { //background element var bgbox = new LayoutFarm.CustomWidgets.SimpleBox(800, 600); bgbox.BackColor = Color.White; bgbox.SetLocation(0, 0); SetupBackgroundProperties(bgbox); viewport.AddContent(bgbox); } //-------------------------------- //ninespace compartment ninespaceBox = new UINinespaceBox(800, 600); viewport.AddContent(ninespaceBox); ninespaceBox.SetSize(800, 600); }
protected override void OnStartDemo(SampleViewport viewport) { //-------------------------------- var bgbox = new LayoutFarm.CustomWidgets.SimpleBox(800, 600); bgbox.BackColor = Color.White; bgbox.SetLocation(0, 0); SetupBackgroundProperties(bgbox); viewport.AddContent(bgbox); //-------------------------------- var box1 = new LayoutFarm.CustomWidgets.SimpleBox(150, 150); box1.BackColor = Color.Red; box1.SetLocation(10, 10); //box1.dbugTag = 1; SetupActiveBoxProperties(box1); viewport.AddContent(box1); //-------------------------------- var box2 = new LayoutFarm.CustomWidgets.SimpleBox(60, 60); box2.SetLocation(50, 50); //box2.dbugTag = 2; SetupActiveBoxProperties(box2); viewport.AddContent(box2); controllerBox1 = new UIControllerBox(40, 40); Color c = KnownColors.FromKnownColor(KnownColor.Yellow); controllerBox1.BackColor = new Color(100, c.R, c.G, c.B); controllerBox1.SetLocation(200, 200); //controllerBox1.dbugTag = 3; controllerBox1.Visible = false; SetupControllerBoxProperties(controllerBox1); viewport.AddContent(controllerBox1); }
protected override void OnStartDemo(SampleViewport viewport) { //-------------------------------- { //background element var bgbox = new LayoutFarm.CustomWidgets.SimpleBox(800, 600); bgbox.BackColor = Color.White; bgbox.SetLocation(0, 0); SetupBackgroundProperties(bgbox); viewport.AddContent(bgbox); } //-------------------------------- //ninespace compartment ninespaceBox = new UINinespaceBox(800, 600); viewport.AddContent(ninespaceBox); ninespaceBox.SetSize(800, 600); //-------------------------------- //test add some content to the ninespace box textbox = new LayoutFarm.CustomWidgets.TextBox(400, 30, false); listView = new CustomWidgets.ListView(300, 200); listView.SetLocation(0, 40); listView.Visible = false; //------------------------------------ //create special text surface listener var textSurfaceListener = new LayoutFarm.Text.TextSurfaceEventListener(); textSurfaceListener.CharacterAdded += (s, e) => UpdateSuggestionList(); textSurfaceListener.CharacterRemoved += (s, e) => UpdateSuggestionList(); textSurfaceListener.PreviewArrowKeyDown += new EventHandler <Text.TextDomEventArgs>(textSurfaceListener_PreviewArrowKeyDown); textSurfaceListener.PreviewEnterKeyDown += new EventHandler <Text.TextDomEventArgs>(textSurfaceListener_PreviewEnterKeyDown); textbox.TextEventListener = textSurfaceListener; //------------------------------------ //------------------------------------ BuildSampleCountryList(); ninespaceBox.LeftSpace.AddChild(textbox); ninespaceBox.RightSpace.AddChild(listView); }
protected override void OnStartDemo(SampleViewport viewport) { //-------------------------------- { //background element var bgbox = new LayoutFarm.CustomWidgets.SimpleBox(800, 600); bgbox.BackColor = Color.White; bgbox.SetLocation(0, 0); SetupBackgroundProperties(bgbox); viewport.AddContent(bgbox); } //-------------------------------- //ninespace compartment ninespaceBox = new UINinespaceBox(800, 600); viewport.AddContent(ninespaceBox); ninespaceBox.SetSize(800, 600); //-------------------------------- //test add some content to the ninespace box textbox = new LayoutFarm.CustomWidgets.TextBox(400, 30, false); listView = new CustomWidgets.ListView(300, 200); listView.SetLocation(0, 40); listView.Visible = false; //------------------------------------ //create special text surface listener var textSurfaceListener = new LayoutFarm.Text.TextSurfaceEventListener(); textSurfaceListener.CharacterAdded += (s, e) => UpdateSuggestionList(); textSurfaceListener.CharacterRemoved += (s, e) => UpdateSuggestionList(); textSurfaceListener.PreviewArrowKeyDown += new EventHandler<Text.TextDomEventArgs>(textSurfaceListener_PreviewArrowKeyDown); textSurfaceListener.PreviewEnterKeyDown += new EventHandler<Text.TextDomEventArgs>(textSurfaceListener_PreviewEnterKeyDown); textbox.TextEventListener = textSurfaceListener; //------------------------------------ //------------------------------------ BuildSampleCountryList(); ninespaceBox.LeftSpace.AddChild(textbox); ninespaceBox.RightSpace.AddChild(listView); }
void SetLatestHit_FlowBoxModel(GridCell hitCell) { if (hitCell != _beginSelectedCell) { _moreThan1Cell = true; if (hitCell.ColumnIndex > _beginSelectedCell.ColumnIndex) { //select next to right side of the begin if (hitCell.RowIndex == _beginSelectedCell.RowIndex) { //same row _bodyBox.SetSize(hitCell.Right - _beginSelectedCell.X, hitCell.Bottom - _beginSelectedCell.Y); _bodyBox.Visible = true; _headBox.Visible = _tailBox.Visible = false; } else if (hitCell.RowIndex < _beginSelectedCell.RowIndex) { //move upper int rowDiff = _beginSelectedCell.RowIndex - hitCell.RowIndex; if (rowDiff == 1) { //just head and tail //select to end of the row int colCount = _targetGridView.ColumnCount; { // GridCell lastCellOfHeadRow = _targetGridView.GetCell(hitCell.RowIndex, _targetGridView.ColumnCount - 1); _headBox.SetLocation(hitCell.X, hitCell.Y); _headBox.SetSize(lastCellOfHeadRow.Right - hitCell.X, lastCellOfHeadRow.Height); } //----- { GridCell lastCellOfTailRow = _targetGridView.GetCell(_beginSelectedCell.RowIndex, 0); _tailBox.SetLocation(0, _beginSelectedCell.Y); _tailBox.SetSize(hitCell.Right, lastCellOfTailRow.Height); } _headBox.Visible = _tailBox.Visible = true; _bodyBox.Visible = false; } else { //more than 2 row //so set head-body-tail int colCount = _targetGridView.ColumnCount; { // GridCell lastCellOfHeadRow = _targetGridView.GetCell(hitCell.RowIndex, _targetGridView.ColumnCount - 1); _headBox.SetLocation(hitCell.X, hitCell.Y); _headBox.SetSize(lastCellOfHeadRow.Right - _headBox.Left, lastCellOfHeadRow.Height); } //----- //in between //----- { GridCell lastCellOfTailRow = _targetGridView.GetCell(_beginSelectedCell.RowIndex, 0); _headBox.SetLocation(0, _beginSelectedCell.Y); _headBox.SetSize(_beginSelectedCell.X, lastCellOfTailRow.Height); } _headBox.Visible = _tailBox.Visible = true; _bodyBox.Visible = false; } } else { //move to lower _bodyBox.SetSize(hitCell.Right - _beginSelectedCell.X, hitCell.Bottom - _beginSelectedCell.Y); } } else if (hitCell.ColumnIndex < _beginSelectedCell.ColumnIndex) { //select to left side //move if (hitCell.RowIndex == _beginSelectedCell.RowIndex) { //same row _bodyBox.SetLocation(hitCell.X, hitCell.Y); _bodyBox.SetSize(_beginSelectedCell.Right - hitCell.X, _beginSelectedCell.Bottom - _beginSelectedCell.Y); } else if (hitCell.RowIndex < _beginSelectedCell.RowIndex) { //move upper _bodyBox.SetLocation(hitCell.X, hitCell.Y); _bodyBox.SetSize(_beginSelectedCell.Right - hitCell.X, _beginSelectedCell.Bottom - hitCell.Y); } else { //select to lower _bodyBox.SetLocation(hitCell.X, _beginSelectedCell.Y); _bodyBox.SetSize(_beginSelectedCell.Right - hitCell.X, hitCell.Bottom - _beginSelectedCell.Y); } } else { //same column if (hitCell.RowIndex == _beginSelectedCell.RowIndex) { //same row } else if (hitCell.RowIndex < _beginSelectedCell.RowIndex) { //move upper _bodyBox.SetLocation(hitCell.X, hitCell.Y); _bodyBox.SetSize(_beginSelectedCell.Right - hitCell.X, _beginSelectedCell.Bottom - hitCell.Y); } else { //select to lower _bodyBox.SetSize(hitCell.Right - _beginSelectedCell.X, hitCell.Bottom - _beginSelectedCell.Y); } } } else { if (_moreThan1Cell) { _bodyBox.SetSize(hitCell.Width, hitCell.Height); _bodyBox.SetLocation(hitCell.X, hitCell.Y); _moreThan1Cell = false; //_endSelectedCell = hitCell; } } _latestHitCell = hitCell; }
public void StartAt(GridCell hitCell) { _moreThan1Cell = false; _beginSelectedCell = _latestHitCell = hitCell; _bodyBox.SetSize(hitCell.Width, hitCell.Height); _bodyBox.SetLocation(hitCell.X, hitCell.Y); _bodyBox.Visible = true; Started = true; }
EaseBox CreateGripper(PixelFarm.Drawing.Color bgcolor, bool isVertical) { int controllerBoxWH = 10; var gripperBox = new SimpleBox(controllerBoxWH, controllerBoxWH); gripperBox.BackColor = bgcolor; //--------------------------------------------------------------------- gripperBox.MouseDrag += (s, e) => { Point pos = gripperBox.Position; if (isVertical) { gripperBox.SetLocation(pos.X, pos.Y + e.YDiff); } else { gripperBox.SetLocation(pos.X + e.XDiff, pos.Y); } this.ninespaceGrippers.UpdateNinespaces(); e.MouseCursorStyle = MouseCursorStyle.Pointer; e.CancelBubbling = true; }; gripperBox.MouseUp += (s, e) => { e.MouseCursorStyle = MouseCursorStyle.Default; e.CancelBubbling = true; }; return gripperBox; }