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); }
void SetupDockSpaces(SpaceConcept spaceConcept) { //1. controller this.dockspaceController = new DockSpacesController(this, spaceConcept); //2. this.dockspaceController.LeftTopSpace.Content = boxLeftTop = CreateSpaceBox(SpaceName.LeftTop, leftTopColor); this.dockspaceController.RightTopSpace.Content = boxRightTop = CreateSpaceBox(SpaceName.RightTop, rightTopColor); this.dockspaceController.LeftBottomSpace.Content = boxLeftBottom = CreateSpaceBox(SpaceName.LeftBottom, leftBottomColor); this.dockspaceController.RightBottomSpace.Content = boxRightBottom = CreateSpaceBox(SpaceName.RightBottom, rightBottomColor); //3. this.dockspaceController.LeftSpace.Content = boxLeft = CreateSpaceBox(SpaceName.Left, leftColor); this.dockspaceController.TopSpace.Content = boxTop = CreateSpaceBox(SpaceName.Top, topColor); this.dockspaceController.RightSpace.Content = boxRight = CreateSpaceBox(SpaceName.Right, rightColor); this.dockspaceController.BottomSpace.Content = boxBottom = CreateSpaceBox(SpaceName.Bottom, bottomColor); this.dockspaceController.CenterSpace.Content = boxCentral = CreateSpaceBox(SpaceName.Center, centerColor); //-------------------------------- //left and right space expansion //dockspaceController.LeftSpaceVerticalExpansion = VerticalBoxExpansion.TopBottom; //dockspaceController.RightSpaceVerticalExpansion = VerticalBoxExpansion.TopBottom; dockspaceController.SetRightSpaceWidth(200); dockspaceController.SetLeftSpaceWidth(200); //------------------------------------------------------------------------------------ this.ninespaceGrippers = new NinespaceGrippers(this.dockspaceController); this.ninespaceGrippers.LeftGripper = gripperLeft = CreateGripper(gripperColor, false); this.ninespaceGrippers.RightGripper = gripperRight = CreateGripper(gripperColor, false); this.ninespaceGrippers.TopGripper = gripperTop = CreateGripper(gripperColor, true); this.ninespaceGrippers.BottomGripper = gripperBottom = CreateGripper(gripperColor, true); this.ninespaceGrippers.UpdateGripperPositions(); //------------------------------------------------------------------------------------ }
CustomWidgets.EaseBox CreateTinyControlBox(SpaceName name) { int controllerBoxWH = 10; var tinyBox = new CustomWidgets.SimpleBox(controllerBoxWH, controllerBoxWH); tinyBox.BackColor = PixelFarm.Drawing.Color.Red; tinyBox.Tag = name; //add handler for each tiny box //--------------------------------------------------------------------- tinyBox.MouseDrag += (s, e) => { ResizeTargetWithSnapToGrid((SpaceName)tinyBox.Tag, this, e); e.MouseCursorStyle = MouseCursorStyle.Pointer; e.CancelBubbling = true; }; tinyBox.MouseUp += (s, e) => { if (e.IsDragging) { ResizeTargetWithSnapToGrid2(this, e); } e.MouseCursorStyle = MouseCursorStyle.Default; e.CancelBubbling = true; }; return(tinyBox); }
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); }
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); }
static SimpleBox CreateSpaceBox(SpaceName name, Color bgcolor) { int controllerBoxWH = 10; SimpleBox spaceBox = new SimpleBox(controllerBoxWH, controllerBoxWH); spaceBox.BackColor = bgcolor; spaceBox.Tag = name; return spaceBox; }
static CustomWidgets.EaseBox CreateSpaceBox(SpaceName name, PixelFarm.Drawing.Color bgcolor) { int controllerBoxWH = 10; var tinyBox = new CustomWidgets.SimpleBox(controllerBoxWH, controllerBoxWH); tinyBox.BackColor = bgcolor; tinyBox.Tag = name; return(tinyBox); }
static SimpleBox SetupHighlightBox() { var box = new SimpleBox(10, 10); box.BackColor = new Color(100, 255, 0, 0); box.Visible = false; box.TransparentAllMouseEvents = true; return(box); }
static SimpleBox CreateSpaceBox(SpaceName name, Color bgcolor) { int controllerBoxWH = 10; SimpleBox spaceBox = new SimpleBox(controllerBoxWH, controllerBoxWH); spaceBox.BackColor = bgcolor; spaceBox.Tag = name; return(spaceBox); }
SimpleBox panel; //panel public TreeView(int width, int height) : base(width, height) { //panel for listview items this.panel = new SimpleBox(width, height); panel.ContentLayoutKind = BoxContentLayoutKind.VerticalStack; panel.BackColor = Color.LightGray; uiList = new UICollection(this); uiList.AddUI(panel); }
public PolygonController() { _simpleBox = new SimpleBox(10, 10); _simpleBox.TransparentAllMouseEvents = true; _simpleBox.NeedClipArea = false; //_simpleBox.BackColor = Color.Transparent;//*** #if DEBUG _simpleBox.BackColor = Color.Blue;//*** #endif }
protected override void OnStartDemo(SampleViewport viewport) { var sampleButton = new LayoutFarm.CustomWidgets.SimpleBox(100, _chartHeight); viewport.AddContent(sampleButton); int count = 0; sampleButton.MouseDown += new EventHandler <UIMouseEventArgs>((s, e2) => { Console.WriteLine("click :" + (count++)); }); TestSimplePlot1(viewport); }
public ListView(int width, int height) : base(width, height) { uiList = new UICollection(this); var simpleBox = new SimpleBox(width, height); simpleBox.ContentLayoutKind = BoxContentLayoutKind.VerticalStack; simpleBox.BackColor = Color.LightGray; simpleBox.MouseDown += panel_MouseDown; simpleBox.MouseDoubleClick += panel_MouseDoubleClick; simpleBox.AcceptKeyboardFocus = true; simpleBox.KeyDown += simpleBox_KeyDown; this.panel = simpleBox; uiList.AddUI(panel); }
public ListView(int width, int height) : base(width, height) { uiList = new UICollection(this); //panel for listview items // var simpleBox = new SimpleBox(width, height); simpleBox.ContentLayoutKind = BoxContentLayoutKind.VerticalStack; simpleBox.BackColor = Color.LightGray; simpleBox.MouseDown += panel_MouseDown; simpleBox.MouseDoubleClick += panel_MouseDoubleClick; simpleBox.AcceptKeyboardFocus = true; simpleBox.KeyDown += simpleBox_KeyDown; this.panel = simpleBox; uiList.AddUI(panel); }
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); }
public void SetTargetGridView(GridView targetGridView) { _targetGridView = targetGridView; _bodyBox = SetupHighlightBox(); //---- targetGridView.AddChild(_bodyBox); if (_gridSelectionStyle == GridSelectionStyle.FlowBox) { //prepare 3 box //head, body, tail _headBox = SetupHighlightBox(); _tailBox = SetupHighlightBox(); // targetGridView.AddChild(_headBox); targetGridView.AddChild(_tailBox); } }
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); }
public GridBox(int width, int height) : base(width, height) { //this grid box acts as viewport this.HasSpecificHeight = true; this.HasSpecificWidth = true; this.NeedClipArea = true; //scrollable content box is inside this grid box _scrollableViewPanel = new SimpleBox(this.Width, this.Height); this.AddChild(_scrollableViewPanel); { //vertical scrollbar var vscbar = new LayoutFarm.CustomWidgets.ScrollBar(15, this.Height); vscbar.SetLocation(this.Width - 15, 0); vscbar.MinValue = 0; vscbar.MaxValue = this.Height; vscbar.SmallChange = 20; this.AddChild(vscbar); //add relation between _scrollableViewPanel and scroll bar var scRelation = new LayoutFarm.CustomWidgets.ScrollingRelation(vscbar.SliderBox, _scrollableViewPanel); } //------------------------- { //horizontal scrollbar var hscbar = new LayoutFarm.CustomWidgets.ScrollBar(150, 15); hscbar.ScrollBarType = CustomWidgets.ScrollBarType.Horizontal; hscbar.SetLocation(30, 10); hscbar.MinValue = 0; hscbar.MaxValue = this.Width - 20; hscbar.SmallChange = 20; this.AddChild(hscbar); //add relation between _scrollableViewPanel and scroll bar var scRelation = new LayoutFarm.CustomWidgets.ScrollingRelation(hscbar.SliderBox, _scrollableViewPanel); } _scrollableViewPanel.PerformContentLayout(); }
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); }
static CustomWidgets.EaseBox CreateSpaceBox(SpaceName name, PixelFarm.Drawing.Color bgcolor) { int controllerBoxWH = 10; var tinyBox = new CustomWidgets.SimpleBox(controllerBoxWH, controllerBoxWH); tinyBox.BackColor = bgcolor; tinyBox.Tag = name; return tinyBox; }
void SetupDockSpaces() { //1. controller this.dockspaceController = new DockSpacesController(this, SpaceConcept.NineSpace); //2. this.dockspaceController.LeftTopSpace.Content = boxLeftTop = CreateSpaceBox(SpaceName.LeftTop, Color.Red); this.dockspaceController.RightTopSpace.Content = boxRightTop = CreateSpaceBox(SpaceName.RightTop, Color.Red); this.dockspaceController.LeftBottomSpace.Content = boxLeftBottom = CreateSpaceBox(SpaceName.LeftBottom, Color.Red); this.dockspaceController.RightBottomSpace.Content = boxRightBottom = CreateSpaceBox(SpaceName.RightBottom, Color.Red); //3. this.dockspaceController.LeftSpace.Content = boxLeft = CreateSpaceBox(SpaceName.Left, Color.Blue); this.dockspaceController.TopSpace.Content = boxTop = CreateSpaceBox(SpaceName.Top, Color.Yellow); this.dockspaceController.RightSpace.Content = boxRight = CreateSpaceBox(SpaceName.Right, Color.Green); this.dockspaceController.BottomSpace.Content = boxBottom = CreateSpaceBox(SpaceName.Bottom, Color.Yellow); //-------------------------------- //left and right space expansion dockspaceController.LeftSpaceVerticalExpansion = VerticalBoxExpansion.TopBottom; dockspaceController.RightSpaceVerticalExpansion = VerticalBoxExpansion.TopBottom; dockspaceController.SetRightSpaceWidth(200); dockspaceController.SetLeftSpaceWidth(200); //------------------------------------------------------------------------------------ this.ninespaceGrippers = new NinespaceGrippers(this.dockspaceController); this.ninespaceGrippers.LeftGripper = gripperLeft = CreateGripper(Color.Red, false); this.ninespaceGrippers.RightGripper = gripperRight = CreateGripper(Color.Red, false); this.ninespaceGrippers.TopGripper = gripperTop = CreateGripper(Color.Red, true); this.ninespaceGrippers.BottomGripper = gripperBottom = CreateGripper(Color.Red, true); this.ninespaceGrippers.UpdateGripperPositions(); //------------------------------------------------------------------------------------ }
CustomWidgets.EaseBox CreateTinyControlBox(SpaceName name) { int controllerBoxWH = 10; var tinyBox = new CustomWidgets.SimpleBox(controllerBoxWH, controllerBoxWH); tinyBox.BackColor = PixelFarm.Drawing.Color.Red; tinyBox.Tag = name; //add handler for each tiny box //--------------------------------------------------------------------- tinyBox.MouseDrag += (s, e) => { ResizeTargetWithSnapToGrid((SpaceName)tinyBox.Tag, this, e); e.MouseCursorStyle = MouseCursorStyle.Pointer; e.CancelBubbling = true; }; tinyBox.MouseUp += (s, e) => { if (e.IsDragging) { ResizeTargetWithSnapToGrid2(this, e); } e.MouseCursorStyle = MouseCursorStyle.Default; e.CancelBubbling = true; }; return tinyBox; }
public RectBoxController() { _simpleBox = new SimpleBox(10, 10); _simpleBox.BackColor = Color.Transparent;//*** }
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; }