public ChatTab() { Size = new Point(100, 100); Dock = DockStyle.Fill; Scrollbar = new ScrollBar(); Scrollbar.Dock = DockStyle.Right; Scrollbar.Margin = new Margin(0, 8, 8, 8); Scrollbar.Size = new Squid.Point(14, 10); Scrollbar.Slider.Style = "vscrollTrack"; Scrollbar.Slider.Button.Style = "vscrollButton"; Scrollbar.ButtonUp.Style = "vscrollUp"; Scrollbar.ButtonUp.Size = new Squid.Point(10, 20); Scrollbar.ButtonDown.Style = "vscrollUp"; Scrollbar.ButtonDown.Size = new Squid.Point(10, 20); Scrollbar.Slider.Margin = new Margin(0, 2, 0, 2); Scrollbar.ShowAlways = true; Elements.Add(Scrollbar); Frame = new Frame(); Frame.Dock = DockStyle.Fill; Frame.Scissor = true; Elements.Add(Frame); Output = new Label(); Output.BBCodeEnabled = true; Output.TextWrap = true; Output.AutoSize = Squid.AutoSize.Vertical; Output.Style = "multiline"; Output.Margin = new Margin(8, 8, 8, 8); Output.TextAlign = Alignment.BottomLeft; Frame.Controls.Add(Output); }
public ChatBox() { Size = new Point(100, 100); Input = new TextBox(); Input.Size = new Point(100, 35); Input.Dock = DockStyle.Bottom; Input.TextCommit += Input_OnTextCommit; Elements.Add(Input); Scrollbar = new ScrollBar(); Scrollbar.Dock = DockStyle.Right; Scrollbar.Size = new Point(25, 25); Elements.Add(Scrollbar); Frame = new Frame(); Frame.Dock = DockStyle.Fill; Frame.Scissor = true; Elements.Add(Frame); Output = new Label(); Output.BBCodeEnabled = true; Output.TextWrap = true; Output.AutoSize = Squid.AutoSize.Vertical; Output.Text = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."; Output.Style = "multiline"; Frame.Controls.Add(Output); }
public ListBox(Manager manager) : base(manager) { Width = 64; Height = 64; MinimumHeight = 16; sbVert = new ScrollBar(Manager, Orientation.Vertical); sbVert.Init(); sbVert.Parent = this; sbVert.Left = Left + Width - sbVert.Width - Skin.Layers["Control"].ContentMargins.Right; sbVert.Top = Top + Skin.Layers["Control"].ContentMargins.Top; sbVert.Height = Height - Skin.Layers["Control"].ContentMargins.Vertical; sbVert.Anchor = Anchors.Top | Anchors.Right | Anchors.Bottom; sbVert.PageSize = 25; sbVert.Range = 1; sbVert.PageSize = 1; sbVert.StepSize = 10; pane = new ClipBox(manager); pane.Init(); pane.Parent = this; pane.Top = Skin.Layers["Control"].ContentMargins.Top; pane.Left = Skin.Layers["Control"].ContentMargins.Left; pane.Width = Width - sbVert.Width - Skin.Layers["Control"].ContentMargins.Horizontal - 1; pane.Height = Height - Skin.Layers["Control"].ContentMargins.Vertical; pane.Anchor = Anchors.All; pane.Passive = true; pane.CanFocus = false; pane.Draw += new DrawEventHandler(DrawPane); CanFocus = true; Passive = false; }
public ScrollableControl() { this.vScrollbar = new ScrollBar(Orientation.Vertical, 0, 0, 0); this.hScrollbar = new ScrollBar(Orientation.Horizontal, 0, 0, 0); this.SetupScrollbars(); }
public Container(Manager manager) : base(manager) { sbVert = new ScrollBar(manager, Orientation.Vertical); sbVert.Init(); sbVert.Detached = false; sbVert.Anchor = Anchors.Top | Anchors.Right | Anchors.Bottom; sbVert.ValueChanged += new EventHandler(ScrollBarValueChanged); sbVert.Range = 0; sbVert.PageSize = 0; sbVert.Value = 0; sbVert.Visible = false; sbHorz = new ScrollBar(manager, Orientation.Horizontal); sbHorz.Init(); sbHorz.Detached = false; sbHorz.Anchor = Anchors.Right | Anchors.Left | Anchors.Bottom; sbHorz.ValueChanged += new EventHandler(ScrollBarValueChanged); sbHorz.Range = 0; sbHorz.PageSize = 0; sbHorz.Value = 0; sbHorz.Visible = false; Add(sbVert, false); Add(sbHorz, false); }
internal static bool CheckBottom(Control ctrl) { ScrollBar info = new ScrollBar(); info.CbSize = Marshal.SizeOf(info); int res = GetScrollBarInfo(ctrl.Handle, ObjidVscroll, ref info); bool isAtBottom = info.XyThumbBottom > (info.RcScrollBar.Bottom - info.RcScrollBar.Top - (int)Math.Round((decimal)info.DxyLineButton * (decimal)2)); return isAtBottom; }
public TextBox(Manager manager) : base(manager) { CheckLayer(Skin, lrCursor); SetDefaultSize(128, 20); Lines.Add(""); ClientArea.Draw += new DrawEventHandler(ClientArea_Draw); vert = new ScrollBar(manager, Orientation.Vertical); horz = new ScrollBar(manager, Orientation.Horizontal); }
public ScrollMenu(WidgetRenderer wr, int w, int h, int bCount, int sbw, int sbh) { Widget = new RectWidget(wr); Widget.Width = w; Widget.Height = h * bCount; scrollBar = new ScrollBar(wr); scrollBar.IsVertical = true; scrollBar.Width = sbw; scrollBar.ScrollButton.InactiveWidth = scrollBar.Width; scrollBar.ScrollButton.InactiveHeight = sbh; scrollBar.ScrollButton.ActiveWidth = scrollBar.Width; scrollBar.ScrollButton.ActiveHeight = sbh; scrollBar.Height = Widget.Height; scrollBar.OffsetAlignX = Alignment.RIGHT; scrollBar.Parent = Widget; scrollBar.ScrollRatio = 0; buttons = new RectButton[bCount]; buttonsText = new TextWidget[buttons.Length]; for(int i = 0; i < buttons.Length; i++) { buttons[i] = new RectButton(wr, Widget.Width, h, Color.Black, Color.White); if(i > 0) { buttons[i].Parent = buttons[i - 1]; buttons[i].OffsetAlignY = Alignment.BOTTOM; buttons[i].LayerOffset = 0f; } else { buttons[i].Parent = Widget; } buttonsText[i] = new TextWidget(wr); buttonsText[i].Height = (int)(TEXT_H_RATIO * buttons[i].Height); buttonsText[i].Text = ""; buttonsText[i].Offset = new Point(TEXT_X_OFF, 0); buttonsText[i].AlignX = Alignment.LEFT; buttonsText[i].AlignY = Alignment.MID; buttonsText[i].OffsetAlignX = Alignment.LEFT; buttonsText[i].OffsetAlignY = Alignment.MID; buttonsText[i].Parent = buttons[i]; } BaseColor = Color.Black; HighlightColor = Color.DarkSlateGray; TextColor = Color.White; ScrollBarBaseColor = Color.Red; }
public ListPanel(int x, int y, int width, int height) : base(x, y, width, height) { this.entries = new List<MenuEntry>(); this.setEntryColor(Color.Black); this.setEntryHighlightedColor(Color.Yellow); this.entriesHidden = false; this.cursor = 0; this.tempWillAlign = false; this.rows = 1; this.cols = 1; this.rowFirst = true; this.scrolling = false; this.scrollRowsOnPanel = 0; this.scrollBar = new ScrollBar(this); this.scrollBar.setVisible(false); }
/////////////////////////////////////////// protected override void OnAttach() { base.OnAttach(); //create window window = ControlDeclarationManager.Instance.CreateControl("Gui\\MultiViewConfigurationWindow.gui"); Controls.Add(window); //update views list box listBoxViews = (ListBox)window.Controls["ViewList"]; listBoxViews.Items.Clear(); foreach (ViewConfigurations configuration in Enum.GetValues(typeof(ViewConfigurations))) listBoxViews.Items.Add(configuration.ToString()); listBoxViews.SelectedIndex = (int)lastViewsConfiguration; listBoxViews.SelectedIndexChange += listBoxViews_SelectedIndexChange; //showMainScene checkbox checkBoxShowMainScene = (CheckBox)window.Controls["ShowMainScene"]; if (MultiViewRenderingManager.Instance != null) checkBoxShowMainScene.Checked = MultiViewRenderingManager.Instance.MainCameraDraw3DScene; checkBoxShowMainScene.CheckedChange += checkBoxShowMainScene_CheckedChange; checkBoxShowMainScene.Enable = listBoxViews.SelectedIndex != 0; //view opacity scrollBarViewsOpacity = (ScrollBar)window.Controls["ViewsOpacity"]; if (MultiViewRenderingManager.Instance != null && MultiViewRenderingManager.Instance.Views.Count > 0) scrollBarViewsOpacity.Value = MultiViewRenderingManager.Instance.Views[0].Opacity; scrollBarViewsOpacity.ValueChange += scrollBarViewsOpacity_ValueChange; scrollBarViewsOpacity.Enable = listBoxViews.SelectedIndex != 0; checkBoxDrawDebugInfo = (CheckBox)window.Controls["DrawDebugInfo"]; if (MultiViewRenderingManager.Instance != null) checkBoxDrawDebugInfo.Checked = MultiViewRenderingManager.Instance.DrawDebugInfo; checkBoxDrawDebugInfo.CheckedChange += checkBoxDrawDebugInfo_CheckedChange; checkBoxDrawDebugInfo.Enable = listBoxViews.SelectedIndex != 0; ((Button)window.Controls["Close"]).Click += Close_Click; BackColor = new ColorValue(0, 0, 0, .5f); MouseCover = true; }
public override void AddToGUIUpdateList(bool ignoreChildren = false, int order = 0) { if (!Visible) { return; } if (!ignoreChildren) { foreach (GUIComponent child in Children) { if (child == Content || child == ScrollBar || child == ContentBackground) { continue; } child.AddToGUIUpdateList(ignoreChildren, order); } } foreach (GUIComponent child in Content.Children) { if (!childVisible.ContainsKey(child)) { childVisible[child] = child.Visible; } if (childVisible[child] != child.Visible) { childVisible[child] = child.Visible; childrenNeedsRecalculation = true; scrollBarNeedsRecalculation = true; break; } } if (childrenNeedsRecalculation) { RecalculateChildren(); childVisible.Clear(); } UpdateOrder = order; GUI.AddToUpdateList(this); if (ignoreChildren) { OnAddedToGUIUpdateList?.Invoke(this); return; } int lastVisible = 0; for (int i = 0; i < Content.CountChildren; i++) { var child = Content.GetChild(i); if (!child.Visible) { continue; } if (!IsChildInsideFrame(child)) { if (lastVisible > 0) { break; } continue; } lastVisible = i; child.AddToGUIUpdateList(false, order); } if (ScrollBar.Enabled) { ScrollBar.AddToGUIUpdateList(false, order); } OnAddedToGUIUpdateList?.Invoke(this); }
void VScrollBar_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { AnimatedScrollViewer thisScroller = this; ScrollBar scrollbar = (sender as ScrollBar); /*ScrollBar animationScrollbar; * if (scrollbar == _aniVerticalScrollBar) * { * animationScrollbar = _animationVerticalScrollBar; * } * else * { * //animationScrollbar = _animationHorizontalScrollBar; * animationScrollbar = _animationVerticalScrollBar; //TEMP * }*/ double oldTargetVOffset = (double)e.OldValue; double newTargetVOffset = (double)e.NewValue; if (newTargetVOffset != thisScroller.TargetVerticalOffset) { double deltaVOffset = Math.Round((newTargetVOffset - oldTargetVOffset), 3); if (deltaVOffset == 1) { thisScroller.TargetVerticalOffset = oldTargetVOffset + thisScroller.ViewportHeight; } else if (deltaVOffset == -1) { thisScroller.TargetVerticalOffset = oldTargetVOffset - thisScroller.ViewportHeight; } else if (deltaVOffset == 0.1) { thisScroller.TargetVerticalOffset = oldTargetVOffset + 16.0; } else if (deltaVOffset == -0.1) { thisScroller.TargetVerticalOffset = oldTargetVOffset - 16.0; } else { thisScroller.TargetVerticalOffset = newTargetVOffset; } /*DoubleAnimation animation = new DoubleAnimation() * { * From = 0, * To = newTargetVOffset, * Duration = ScrollingTime * }; * * animation.Completed += delegate * { * animationScrollbar.BeginAnimation(ScrollBar.ValueProperty, null); * animationScrollbar.Visibility = Visibility.Hidden; * scrollbar.Visibility = Visibility.Visible; * }; * * scrollbar.Visibility = Visibility.Hidden; * animationScrollbar.Visibility = Visibility.Visible; * animationScrollbar.BeginAnimation(ScrollBar.ValueProperty, animation);*/ } }
void soundPitchScaleScrollBar_ValueChange( ScrollBar sender ) { if( !disableChangeEvents ) { float value = float.Parse( sender.Value.ToString( "F1" ) ); SoundWorld.Instance.MasterChannelGroup.Pitch = value; UpdateSoundPitchScaleValue(); } }
static void scroll_EventScrollChangePosition(ScrollBar _sender, uint _position) { Export.DebugOut("EventScrollChangePosition position=" + _position.ToString()); }
public override void OnInit() { base.OnInit(); //IndependentParameters independentParametersCheckBox = (CheckBox)PageControl.Controls[ "IndependentParameters" ]; UpdateEngineTimeScaleValue(); independentParametersCheckBox.Checked = independentParameters; independentParametersCheckBox.CheckedChange += independentParametersCheckBox_CheckedChange; //EngineTimeScale engineTimeScaleScrollBar = (ScrollBar)PageControl.Controls[ "EngineTimeScale" ]; engineTimeScaleScrollBar.Value = EngineApp.Instance.TimeScale; UpdateEngineTimeScaleValue(); engineTimeScaleScrollBar.ValueChange += engineTimeScaleScrollBar_ValueChange; //SoundPitchScale soundPitchScaleScrollBar = (ScrollBar)PageControl.Controls[ "SoundPitchScale" ]; soundPitchScaleScrollBar.Value = SoundWorld.Instance.MasterChannelGroup.Pitch; UpdateSoundPitchScaleValue(); soundPitchScaleScrollBar.ValueChange += soundPitchScaleScrollBar_ValueChange; }
public void Scroll(ScrollBar scrollBar, MouseEventArgs e) { int newvalue = scrollBar.Value - GetScrollAmount(e) * scrollBar.SmallChange; scrollBar.Value = Math.Max(scrollBar.Minimum, Math.Min(scrollBar.Maximum - scrollBar.LargeChange + 1, newvalue)); }
void ScrollChange(ScrollBar sb, float r) { RefreshVisible(); }
void engineTimeScaleScrollBar_ValueChange( ScrollBar sender ) { if( !disableChangeEvents ) { float value = float.Parse( sender.Value.ToString( "F1" ) ); EngineApp.Instance.TimeScale = value; UpdateEngineTimeScaleValue(); if( !independentParametersCheckBox.Checked && soundPitchScaleScrollBar.Value != engineTimeScaleScrollBar.Value ) soundPitchScaleScrollBar.Value = engineTimeScaleScrollBar.Value; } }
public ColorScroll() { Title = "Color Scroll"; Width = 500; Height = 300; // GridMain contains a vertical splitter. Grid gridMain = new Grid(); Content = gridMain; // GridMain column definitions. ColumnDefinition coldef = new ColumnDefinition(); coldef.Width = new GridLength(200, GridUnitType.Pixel); gridMain.ColumnDefinitions.Add(coldef); coldef = new ColumnDefinition(); coldef.Width = GridLength.Auto; gridMain.ColumnDefinitions.Add(coldef); coldef = new ColumnDefinition(); coldef.Width = new GridLength(100, GridUnitType.Star); gridMain.ColumnDefinitions.Add(coldef); // Vertical splitter. GridSplitter split = new GridSplitter(); split.HorizontalAlignment = HorizontalAlignment.Center; split.VerticalAlignment = VerticalAlignment.Stretch; split.Width = 6; gridMain.Children.Add(split); Grid.SetRow(split, 0); Grid.SetColumn(split, 1); // Panel on right side of splitter to display color pnlColor = new StackPanel(); pnlColor.Background = new SolidColorBrush(SystemColors.WindowColor); gridMain.Children.Add(pnlColor); Grid.SetRow(pnlColor, 0); Grid.SetColumn(pnlColor, 2); // Secondary grid at left of splitter Grid grid = new Grid(); gridMain.Children.Add(grid); Grid.SetRow(grid, 0); Grid.SetColumn(grid, 0); // Three rows for label, scroll, and label. RowDefinition rowdef = new RowDefinition(); rowdef.Height = GridLength.Auto; grid.RowDefinitions.Add(rowdef); rowdef = new RowDefinition(); rowdef.Height = new GridLength(100, GridUnitType.Star); grid.RowDefinitions.Add(rowdef); rowdef = new RowDefinition(); rowdef.Height = GridLength.Auto; grid.RowDefinitions.Add(rowdef); // Three columns for Red, Green, and Blue. for (int i = 0; i < 3; i++) { coldef = new ColumnDefinition(); coldef.Width = new GridLength(33, GridUnitType.Star); grid.ColumnDefinitions.Add(coldef); } for (int i = 0; i < 3; i++) { Label lbl = new Label(); lbl.Content = new string[] { "Red", "Green", "Blue" }[i]; lbl.HorizontalAlignment = HorizontalAlignment.Center; grid.Children.Add(lbl); Grid.SetRow(lbl, 0); Grid.SetColumn(lbl, i); scrolls[i] = new ScrollBar(); scrolls[i].Focusable = true; scrolls[i].Orientation = Orientation.Vertical; scrolls[i].Minimum = 0; scrolls[i].Maximum = 255; scrolls[i].SmallChange = 1; scrolls[i].LargeChange = 16; scrolls[i].ValueChanged += ScrollOnValueChanged; grid.Children.Add(scrolls[i]); Grid.SetRow(scrolls[i], 1); Grid.SetColumn(scrolls[i], i); txtValue[i] = new TextBlock(); txtValue[i].TextAlignment = TextAlignment.Center; txtValue[i].HorizontalAlignment = HorizontalAlignment.Center; txtValue[i].Margin = new Thickness(5); grid.Children.Add(txtValue[i]); Grid.SetRow(txtValue[i], 2); Grid.SetColumn(txtValue[i], i); } // Initialize scroll bars. Color clr = (pnlColor.Background as SolidColorBrush).Color; scrolls[0].Value = clr.R; scrolls[1].Value = clr.G; scrolls[2].Value = clr.B; // Set initial focus. scrolls[0].Focus(); }
public void TestScrollBar() { ScrollBar bar = new ScrollBar("newBar"); Assert.AreEqual("newBar", bar.Name); Assert.AreEqual(String.Empty, bar.Text); Assert.IsTrue(bar is Component); ScrollBar anotherBar = new ScrollBar("anotherBar", "someText"); Assert.AreEqual("someText", anotherBar.Text); Assert.AreEqual("anotherBar", anotherBar.Name); Assert.AreEqual("scrollBar", anotherBar.Type); Assert.AreEqual("scrollBar(\"anotherBar\")", anotherBar.GetBaseComponentString()); Assert.AreEqual("getTestFixture().scrollBar(\"anotherBar\")", anotherBar.GetQueryString()); Assert.AreEqual("getTestFixture().prefix(\"prefix\").scrollBar(\"anotherBar\")", anotherBar.GetQueryString("prefix(\"prefix\")")); }
private void RefreshScrollTipContent(ScrollBar scrollBar) { const int MaxItemToVisit = 100; DataGridContext dataGridContext = DataGridControl.GetDataGridContext(this); if (dataGridContext == null) { return; } DataGridControl parentGridControl = dataGridContext.DataGridControl; if (parentGridControl == null) { return; } if (scrollBar.Orientation != m_itemsScrollingOrientation) { return; } double maxOffset = 0; if (scrollBar.Orientation == Orientation.Vertical) { maxOffset = parentGridControl.ScrollViewer.ExtentHeight; } else { maxOffset = parentGridControl.ScrollViewer.ExtentWidth; } double offset = scrollBar.Track.Value; int itemMaxOffset = 0; int itemOffset = 0; if (this.IsPixelScrolling) { // Calculate the offset ratio to get the item from the Generator int itemsCount = parentGridControl.CustomItemContainerGenerator.ItemCount; itemMaxOffset = itemsCount; if ((maxOffset > 0) && (itemsCount > 0)) { itemOffset = ( int )(offset / (maxOffset / itemsCount)); } else { itemOffset = 0; } } else { itemMaxOffset = ( int )maxOffset; itemOffset = ( int )offset; } object newValue = null; DataGridContext itemContext = null; // If data is grouped, we do not want to keep the next data item if a HeaderFooterItem // is the current item returned. So we increment the scroll up to the next item in order // to get the real item that will be visible when the user will release the mouse ItemContextVisitor visitor = new ItemContextVisitor(parentGridControl.ItemsHost is TableflowViewItemsHost); int endOffset = System.Math.Min(itemOffset + MaxItemToVisit, itemMaxOffset); bool visitWasStopped; (( IDataGridContextVisitable )parentGridControl.DataGridContext).AcceptVisitor(itemOffset, endOffset, visitor, DataGridContextVisitorType.Items, out visitWasStopped); object tempValue = visitor.Item; if (visitor.VisitSuccessful) { newValue = tempValue; itemContext = visitor.ParentDataGridContext; } else { //Set the ItemContext as the ScrollTip's DataGridContext, this is to ensure the //ScrollTip will not change the ScrollContentTemplate ( by invalidation of the binding). itemContext = DataGridControl.GetDataGridContext(this); newValue = null; //show nothing in the ScrollTip. } // The TippedItemDataGridContext PropertChanged callback will take care of refreshing the ScrollTip CellContentTemplate. if (itemContext != DataGridControl.GetDataGridContext(this)) { DataGridControl.SetDataGridContext(this, itemContext); } if (this.Content != newValue) { this.Content = newValue; } }
//private DockPanel layout; /// <summary> /// Create ReoGrid spreadsheet control /// </summary> public ReoGridControl() { this.SnapsToDevicePixels = true; this.Focusable = true; this.FocusVisualStyle = null; this.BeginInit(); //layout = new DockPanel(); //this.bottomGrid = new DockPanel() { Height = ScrollBarSize }; //this.bottomGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(ScrollBarWidth) }); this.sheetTab = new SheetTabControl() { ControlWidth = 400, }; this.horScrollbar = new ScrollBar() { Orientation = Orientation.Horizontal, Height = ScrollBarSize, SmallChange = Worksheet.InitDefaultColumnWidth, }; this.verScrollbar = new System.Windows.Controls.Primitives.ScrollBar() { Orientation = Orientation.Vertical, Width = ScrollBarSize, SmallChange = Worksheet.InitDefaultRowHeight, }; this.Children.Add(this.sheetTab); this.Children.Add(this.horScrollbar); Grid.SetColumn(this.horScrollbar, 1); //this.Children.Add(this.bottomGrid); this.Children.Add(this.verScrollbar); this.horScrollbar.Scroll += (s, e) => { if (this.currentWorksheet.ViewportController is IScrollableViewportController) { ((IScrollableViewportController)this.currentWorksheet.ViewportController).HorizontalScroll(e.NewValue); } }; this.verScrollbar.Scroll += (s, e) => { if (this.currentWorksheet.ViewportController is IScrollableViewportController) { ((IScrollableViewportController)this.currentWorksheet.ViewportController).VerticalScroll(e.NewValue); } }; this.sheetTab.SplitterMoving += (s, e) => { double width = System.Windows.Input.Mouse.GetPosition(this).X + 3; if (width < 75) { width = 75; } if (width > this.RenderSize.Width - ScrollBarSize) { width = this.RenderSize.Width - ScrollBarSize; } this.SheetTabWidth = width; this.UpdateSheetTabAndScrollBarsLayout(); //this.bottomGrid.ColumnDefinitions[0].Width = new GridLength(width); //double newScrollWidth = this.RenderSize.Width // - this.bottomGrid.ColumnDefinitions[0].ActualWidth - this.bottomGrid.ColumnDefinitions[2].ActualWidth; //if (newScrollWidth < 0) newScrollWidth = 0; //this.bottomGrid.ColumnDefinitions[1].Width = new GridLength(newScrollWidth); //this.horScrollbar.Width = this.bottomGrid.ColumnDefinitions[1].ActualWidth; }; this.InitControl(); this.editTextbox = new InputTextBox() { Owner = this, BorderThickness = new Thickness(0), Visibility = System.Windows.Visibility.Hidden, HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden, VerticalScrollBarVisibility = ScrollBarVisibility.Hidden, Padding = new Thickness(0), Margin = new Thickness(0), }; this.Children.Add(editTextbox); this.adapter = new ReoGridWPFControlAdapter(this); this.adapter.editTextbox = this.editTextbox; InitWorkbook(this.adapter); TextCompositionManager.AddPreviewTextInputHandler(this, OnTextInputStart); this.EndInit(); this.renderer = new Rendering.WPFRenderer(); Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Input, new Action(delegate() { if (!string.IsNullOrEmpty(this.LoadFromFile)) { var file = new System.IO.FileInfo(this.LoadFromFile); this.currentWorksheet.Load(file.FullName); } })); }
private void cameraHeightScrollBar_ValueChange(ScrollBar sender) { if (disableUpdatingCameraScrollBars) return; cameraDirection.Vertical = sender.Value; }
/// <summary> /// Gets value of given scroll bar as gray value. /// </summary> /// <param name="bar"></param> /// <returns></returns> private float GetScrollBarValue(ScrollBar bar) { return(rangeMin + (float)bar.Value / (bar.Maximum - bar.LargeChange) * (rangeMax - rangeMin)); }
public ScrollingRelation(ScrollBar scBar, IScrollable scrollableSurface) { this.scBar = scBar; this.scrollableSurface = scrollableSurface; switch (scBar.ScrollBarType) { case ScrollBarType.Vertical: { SetupVerticalScrollRelation(); } break; case ScrollBarType.Horizontal: { SetupHorizontalScrollRelation(); } break; default: throw new NotSupportedException(); } }
void addEntry(string text) { ScrollBar.ScrollToBottom(); Debug.Inlines.Add(text); }
public override void OnInit() { base.OnInit(); //EngineTimeScale engineTimeScaleScrollBar = (ScrollBar)PageControl.Controls[ "EngineTimeScale" ]; engineTimeScaleScrollBar.Value = EngineApp.Instance.TimeScale; UpdateEngineTimeScaleValue(); engineTimeScaleScrollBar.ValueChange += engineTimeScaleScrollBar_ValueChange; //SoundPitchScale soundPitchScaleScrollBar = (ScrollBar)PageControl.Controls[ "SoundPitchScale" ]; soundPitchScaleScrollBar.Value = SoundWorld.Instance.MasterChannelGroup.Pitch; UpdateSoundPitchScaleValue(); soundPitchScaleScrollBar.ValueChange += soundPitchScaleScrollBar_ValueChange; }
public FileList(Rect Bounds, ScrollBar AScrollBar) : base(Bounds, 2, AScrollBar) { }
public static extern bool ShowScrollBar(IntPtr hWnd, ScrollBar bar, int cmd);
public ScrollBarProvider(ScrollBar scrollbar) : base(scrollbar) { orientation = scrollbar is HScrollBar ? OrientationType.Horizontal : OrientationType.Vertical; }
public static extern bool ShowScrollBar(IntPtr hWnd, ScrollBar bar, bool bShow);
void soundPitchScaleScrollBar_ValueChange( ScrollBar sender ) { if( !disableChangeEvents ) { float value = float.Parse( sender.Value.ToString( "F1" ) ); SoundWorld.Instance.MasterChannelGroup.Pitch = value; UpdateSoundPitchScaleValue(); if( !independentParametersCheckBox.Checked && soundPitchScaleScrollBar.Value != engineTimeScaleScrollBar.Value ) engineTimeScaleScrollBar.Value = soundPitchScaleScrollBar.Value; } }
protected virtual bool OnScroll(ScrollBar sender, int value) { return(false); }
public static void SetExpandedThumbBackgroundColor(ScrollBar scrollBar, Color?value) { scrollBar.SetValue(ExpandedThumbBackgroundColorProperty, value); }
public OptionsWindow(BaseControl owner) : base(owner) { Font = CtlCommon.SmFont; Width = 480; Height = 390; WindowStyle = new WindowStyles(WindowStyles.wsScreenCenter, WindowStyles.wsModal, WindowStyles.wsKeyPreview); fPages = new TabControl(this); fPages.Left = 10; fPages.Top = 10; fPages.Width = Width - 20; fPages.Height = Height - 30 - 40; TabSheet ts = fPages.AddPage(BaseLocale.GetStr(RS.rs_CommonOptions)); ts.OnLangChange = GlobalVars.nwrWin.LangChange; ts.LangResID = 9; fSngVolume = new ScrollBar(ts); fSngVolume.Min = 0; fSngVolume.Max = 255; fSngVolume.Pos = 255; fSngVolume.OnChange = OnSongsVolumeChange; fSngVolume.Kind = ScrollBar.SBK_HORIZONTAL; fSngVolume.Width = ts.Width - 50; fSngVolume.Left = 25; fSngVolume.Top = 30; Label label = new Label(ts); label.Bounds = ExtRect.Create(25, 30 - 20, 25 + fSngVolume.Width, 30); label.LangResID = RS.rs_MusicVolume; label.OnLangChange = GlobalVars.nwrWin.LangChange; fSndVolume = new ScrollBar(ts); fSndVolume.Min = 0; fSndVolume.Max = 255; fSndVolume.Pos = 255; fSndVolume.OnChange = OnSoundsVolumeChange; fSndVolume.Kind = ScrollBar.SBK_HORIZONTAL; fSndVolume.Width = ts.Width - 50; fSndVolume.Left = 25; fSndVolume.Top = 70; label = new Label(ts); label.Bounds = ExtRect.Create(25, 70 - 20, 25 + fSndVolume.Width, 70); label.LangResID = RS.rs_SoundsVolume; label.OnLangChange = GlobalVars.nwrWin.LangChange; fNewStyle = new CheckBox(ts); fNewStyle.OnLangChange = GlobalVars.nwrWin.LangChange; fNewStyle.LangResID = 12; fNewStyle.Group = 1; fNewStyle.Left = 25; fNewStyle.Top = 100; fNewStyle.Width = Width - 50; fNewStyle.OnClick = OnNewStyleClick; fModernStyle = new CheckBox(ts); fModernStyle.OnLangChange = GlobalVars.nwrWin.LangChange; fModernStyle.LangResID = 13; fModernStyle.Group = 1; fModernStyle.Left = 225; fModernStyle.Top = 100; fModernStyle.Width = Width - 50; fModernStyle.OnClick = OnModernStyleClick; fHideLocMap = new CheckBox(ts); fHideLocMap.OnLangChange = GlobalVars.nwrWin.LangChange; fHideLocMap.LangResID = 14; fHideLocMap.Left = 25; fHideLocMap.Top = 130; fHideLocMap.Width = Width - 50; fHideLocMap.OnClick = OnHideLocMapClick; fHideCtlPanel = new CheckBox(ts); fHideCtlPanel.OnLangChange = GlobalVars.nwrWin.LangChange; fHideCtlPanel.LangResID = 15; fHideCtlPanel.Left = 25; fHideCtlPanel.Top = 160; fHideCtlPanel.Width = Width - 50; fHideCtlPanel.OnClick = OnHideCtlPanelClick; fHideInfoPanel = new CheckBox(ts); fHideInfoPanel.OnLangChange = GlobalVars.nwrWin.LangChange; fHideInfoPanel.LangResID = 16; fHideInfoPanel.Left = 25; fHideInfoPanel.Top = 190; fHideInfoPanel.Width = Width - 50; fHideInfoPanel.OnClick = OnHideInfoPanelClick; fInvOnlyIcons = new CheckBox(ts); fInvOnlyIcons.OnLangChange = GlobalVars.nwrWin.LangChange; fInvOnlyIcons.LangResID = 549; fInvOnlyIcons.Left = 25; fInvOnlyIcons.Top = 220; fInvOnlyIcons.Width = Width - 50; fInvOnlyIcons.OnClick = OnInvOnlyIconsClick; ts = fPages.AddPage(BaseLocale.GetStr(RS.rs_KeyOptions)); ts.OnLangChange = GlobalVars.nwrWin.LangChange; ts.LangResID = 10; fKeyList = new ListBox(ts); fKeyList.Mode = ListBox.MODE_REPORT; fKeyList.Left = 10; fKeyList.Top = 10; fKeyList.Width = ts.Width - 20; fKeyList.Height = ts.Height - 20; fKeyList.ColumnTitles.Add("name", 300); fKeyList.ColumnTitles.Add("key", 150); fKeyList.OnKeyDown = OnKeyListKeyDown; fKeyList.ShowHints = true; fKeyList.Hint = "hint"; ts = fPages.AddPage(BaseLocale.GetStr(RS.rs_GameplayOptions)); ts.OnLangChange = GlobalVars.nwrWin.LangChange; ts.LangResID = 11; fCircularFOV = new CheckBox(ts); fCircularFOV.OnLangChange = GlobalVars.nwrWin.LangChange; fCircularFOV.LangResID = 17; fCircularFOV.Left = 25; fCircularFOV.Top = 25; fCircularFOV.Width = Width - 50; fCircularFOV.OnClick = OnCircularFOVClick; fAutoPickup = new CheckBox(ts); fAutoPickup.OnLangChange = GlobalVars.nwrWin.LangChange; fAutoPickup.LangResID = 536; fAutoPickup.Left = 25; fAutoPickup.Top = 65; fAutoPickup.Width = Width - 50; fAutoPickup.OnClick = OnAutoPickupClick; fExtremeMode = new CheckBox(ts); fExtremeMode.OnLangChange = GlobalVars.nwrWin.LangChange; fExtremeMode.LangResID = 82; fExtremeMode.Left = 25; fExtremeMode.Top = 105; fExtremeMode.Width = Width - 50; fExtremeMode.OnClick = OnExtremeModeClick; ts = fPages.AddPage(BaseLocale.GetStr(RS.rs_Language)); ts.OnLangChange = GlobalVars.nwrWin.LangChange; ts.LangResID = 815; fLangList = new ListBox(ts); fLangList.Mode = ListBox.MODE_LIST; fLangList.Options = new LBOptions(LBOptions.lboChecks, LBOptions.lboRadioChecks); fLangList.Left = 10; fLangList.Top = 10; fLangList.Width = ts.Width - 20; fLangList.Height = ts.Height - 20; Locale locale = GlobalVars.nwrWin.Locale; int num = locale.LangsCount; for (int i = 0; i < num; i++) { fLangList.Items.Add(locale.GetLang(i).Name, null); } fLangList.OnItemSelect = OnLangSelect; fPages.TabIndex = 0; NWButton tRButton = new NWButton(this); tRButton.Width = 90; tRButton.Height = 30; tRButton.Left = Width - 90 - 20; tRButton.Top = Height - 30 - 20; tRButton.ImageFile = "itf/DlgBtn.tga"; tRButton.OnClick = OnBtnClose; tRButton.OnLangChange = GlobalVars.nwrWin.LangChange; tRButton.LangResID = 8; }
public static bool GetIsEnabled(ScrollBar scrollBar) { return((bool)scrollBar.GetValue(IsEnabledProperty)); }
public ScrollBarThumbProvider(ScrollBar scrollbar) : base(scrollbar) { runtimeId = -1; }
public static void SetIsEnabled(ScrollBar scrollBar, bool value) { scrollBar.SetValue(IsEnabledProperty, value); }
private static float CalculateMaxScroll(float size, ScrollBar scroll) { return(size + scroll.LargeChange - 1.0f); }
public static ScrollingIndicatorMode GetIndicatorMode(ScrollBar scrollBar) { return((ScrollingIndicatorMode)scrollBar.GetValue(IndicatorModeProperty)); }
public ControlsTest() : base(80, 23) { Controls.ThemeColors = Container.EditingColors; Position = new Point(10, 10); SadConsole.UI.Border.AddToSurface(this, "Example"); var prog1 = new ProgressBar(10, 1, HorizontalAlignment.Left) { Position = new Point(16, 5), DisplayTextColor = Color.White }; var theme = (ProgressBarTheme)Library.Default.GetControlTheme(typeof(ProgressBar)); //theme.Background.SetGlyph(0); //theme.Foreground.SetGlyph('='); prog1.Theme = theme; Controls.Add(prog1); var prog2 = new ProgressBar(1, 6, VerticalAlignment.Bottom) { Position = new Point(18, 7), DisplayTextColor = Color.White }; Controls.Add(prog2); var slider = new ScrollBar(Orientation.Horizontal, 10) { Position = new Point(16, 3), Maximum = 18 }; Controls.Add(slider); slider = new ScrollBar(Orientation.Vertical, 6) { Position = new Point(16, 7), Maximum = 6 }; Controls.Add(slider); progressTimer = new SadConsole.Components.Timer(TimeSpan.FromSeconds(0.5)); progressTimer.TimerElapsed += (timer, e) => { prog1.Progress = prog1.Progress >= 1f ? 0f : prog1.Progress + 0.1f; prog2.Progress = prog2.Progress >= 1f ? 0f : prog2.Progress + 0.1f; }; SadComponents.Add(progressTimer); var listbox = new ListBox(20, 6) { Position = new Point(28, 3) }; listbox.Items.Add("item 1"); listbox.Items.Add("item 2"); listbox.Items.Add("item 3"); listbox.Items.Add("item 4"); listbox.Items.Add("item 5"); listbox.Items.Add("item 6"); listbox.Items.Add("item 7"); listbox.Items.Add("item 8"); Controls.Add(listbox); var radioButton = new RadioButton(20, 1) { Text = "Group 1 Option 1", Position = new Point(28, 12) }; Controls.Add(radioButton); radioButton = new RadioButton(20, 1) { Text = "Group 1 Option 2", Position = new Point(28, 13) }; Controls.Add(radioButton); var tmp = new ListBox(5, 11); tmp.Items.Add("1"); tmp.Items.Add("2"); tmp.Items.Add("3"); tmp.Items.Add("4"); tmp.Items.Add("5"); tmp.Items.Add("11"); tmp.Items.Add("22"); tmp.Items.Add("33"); tmp.Items.Add("44"); tmp.Items.Add("55"); tmp.Position = (6, 0); var selButton = new SelectionButton(24, 1) { Text = "Selection Button 1", Position = new Point(51, 3) }; Controls.Add(selButton); var selButton1 = new SelectionButton(24, 1) { Text = "Selection Button 2", Position = new Point(51, 4) }; Controls.Add(selButton1); var selButton2 = new SelectionButton(24, 1) { Text = "Selection Button 3", Position = new Point(51, 5) }; Controls.Add(selButton2); selButton.PreviousSelection = selButton2; selButton.NextSelection = selButton1; selButton1.PreviousSelection = selButton; selButton1.NextSelection = selButton2; selButton2.PreviousSelection = selButton1; selButton2.NextSelection = selButton; var input = new TextBox(10) { Position = new Point(51, 9) }; Controls.Add(input); var password = new TextBox(10) { Mask = '*', Position = new Point(65, 9) }; Controls.Add(password); var button = new Button(11, 1) { Text = "Click", Position = new Point(1, 3) }; button.Click += (s, a) => SadConsole.UI.Window.Message("This has been clicked -- and your password field contains '" + password.Text + "'", "Close"); Controls.Add(button); button = new Button(11, 3) { Text = "Click", Position = new Point(1, 5), Theme = new Button3dTheme() }; //button.AlternateFont = SadConsole.Global.LoadFont("Fonts/Cheepicus12.font").GetFont(Font.FontSizes.One); Controls.Add(button); button = new Button(11, 3) { Text = "Click", Position = new Point(1, 10), Theme = new ButtonLinesTheme() }; Controls.Add(button); var checkbox = new CheckBox(13, 1) { Text = "Check box", Position = new Point(51, 13) }; Controls.Add(checkbox); Controls.FocusedControl = null; //DisableControlFocusing = true; List <Tuple <Color, string> > colors = new List <Tuple <Color, string> > { new Tuple <Color, string>(Library.Default.Colors.Red, "Red"), new Tuple <Color, string>(Library.Default.Colors.RedDark, "DRed"), new Tuple <Color, string>(Library.Default.Colors.Purple, "Prp"), new Tuple <Color, string>(Library.Default.Colors.PurpleDark, "DPrp"), new Tuple <Color, string>(Library.Default.Colors.Blue, "Blu"), new Tuple <Color, string>(Library.Default.Colors.BlueDark, "DBlu"), new Tuple <Color, string>(Library.Default.Colors.Cyan, "Cya"), new Tuple <Color, string>(Library.Default.Colors.CyanDark, "DCya"), new Tuple <Color, string>(Library.Default.Colors.Green, "Gre"), new Tuple <Color, string>(Library.Default.Colors.GreenDark, "DGre"), new Tuple <Color, string>(Library.Default.Colors.Yellow, "Yel"), new Tuple <Color, string>(Library.Default.Colors.YellowDark, "DYel"), new Tuple <Color, string>(Library.Default.Colors.Orange, "Ora"), new Tuple <Color, string>(Library.Default.Colors.OrangeDark, "DOra"), new Tuple <Color, string>(Library.Default.Colors.Brown, "Bro"), new Tuple <Color, string>(Library.Default.Colors.BrownDark, "DBrow"), new Tuple <Color, string>(Library.Default.Colors.Gray, "Gray"), new Tuple <Color, string>(Library.Default.Colors.GrayDark, "DGray"), new Tuple <Color, string>(Library.Default.Colors.White, "White"), new Tuple <Color, string>(Library.Default.Colors.Black, "Black") }; backgroundcycle = colors.Select(i => i.Item1).ToArray(); //int y = 25 - 20; //int x = 0; //int colorLength = 4; //foreach (var color1 in colors) //{ // foreach (var color2 in colors) // { // _Print(x, y, new ColoredString(color2.Item2.PadRight(colorLength).Substring(0, colorLength), color2.Item1, color1.Item1, null)); // y++; // } // y = 25 -20; // x += colorLength; //} RedrawColors(); }
public static void SetIndicatorMode(ScrollBar scrollBar, ScrollingIndicatorMode value) { scrollBar.SetValue(IndicatorModeProperty, value); }
private void Awake() { INSTANCE = this; }
public static Color?GetCollapsedThumbBackgroundColor(ScrollBar scrollBar) { return((Color?)scrollBar.GetValue(CollapsedThumbBackgroundColorProperty)); }
private void cameraDistanceScrollBar_ValueChange(ScrollBar sender) { if (disableUpdatingCameraScrollBars) return; cameraDistance = sender.Value; }
protected override Size ArrangeOverride(Size finalSize) { int firstRow = Cells.GetInitialRow(); foreach (var cell in Cells.GetVisibleCells()) { double width = AccumulatedColumnWidths[cell.Column.Index + 1] - AccumulatedColumnWidths[cell.Column.Index] - GridControl.VerticalLinesThickness; cell.Arrange(new Rect(AccumulatedColumnWidths[cell.Column.Index], AccumulatedRowHeights[cell.Row - firstRow], width, cell.DesiredSize.Height)); } UpdateGridLines(); ScrollBar.Arrange(new Rect(finalSize.Width - ScrollBar.Width, 0.0, ScrollBar.Width, finalSize.Height)); return(finalSize); void UpdateGridLines() { int lastAccumulatedColumnWidthsIndex = AccumulatedColumnWidths.Count - 1; while (ColumnLines.Count > lastAccumulatedColumnWidthsIndex) { var columnLine = ColumnLines[ColumnLines.Count - 1]; ColumnLines.Remove(columnLine); LogicalChildren.Remove(columnLine); VisualChildren.Remove(columnLine); } while (lastAccumulatedColumnWidthsIndex > ColumnLines.Count) { Line columnLine = new Line(); columnLine.Stroke = GridControl.VerticalLinesBrush; columnLine.StrokeThickness = GridControl.VerticalLinesThickness; ColumnLines.Add(columnLine); LogicalChildren.Add(columnLine); VisualChildren.Add(columnLine); } int lastAccumulatedRowHeightsIndex = AccumulatedRowHeights.Count(rh => !Double.IsNaN(rh)) - 1; while (RowLines.Count > lastAccumulatedRowHeightsIndex) { var rowLine = RowLines[RowLines.Count - 1]; RowLines.Remove(rowLine); LogicalChildren.Remove(rowLine); VisualChildren.Remove(rowLine); } while (lastAccumulatedRowHeightsIndex > RowLines.Count) { Line rowLine = new Line(); rowLine.Stroke = GridControl.HorizontalLinesBrush; rowLine.StrokeThickness = GridControl.HorizontalLinesThickness; RowLines.Add(rowLine); LogicalChildren.Add(rowLine); VisualChildren.Add(rowLine); } for (int i = 0; i < RowLines.Count; i++) { double y = AccumulatedRowHeights[i + 1] - GridControl.HorizontalLinesThickness / 2.0; RowLines[i].StartPoint = new Point(0.0, y); RowLines[i].EndPoint = new Point(AccumulatedColumnWidths[lastAccumulatedColumnWidthsIndex], y); } for (int i = 0; i < ColumnLines.Count; i++) { double x = AccumulatedColumnWidths[i + 1] - GridControl.VerticalLinesThickness / 2.0; ColumnLines[i].StartPoint = new Point(x, 0.0); ColumnLines[i].EndPoint = new Point(x, AccumulatedRowHeights[lastAccumulatedRowHeightsIndex]); } foreach (var line in RowLines.Concat(ColumnLines)) { line.InvalidateMeasure(); line.Measure(Size.Infinity); } } }
// protected override void OnAttach() { base.OnAttach(); EngineApp.Instance.KeysAndMouseButtonUpAll(); //hudControl hudControl = ControlDeclarationManager.Instance.CreateControl("Maps\\RTSDemo\\Gui\\HUD.gui"); Controls.Add(hudControl); ((Button)hudControl.Controls["Menu"]).Click += delegate(Button sender) { Controls.Add(new MenuWindow()); }; ((Button)hudControl.Controls["Exit"]).Click += delegate(Button sender) { GameWorld.Instance.NeedChangeMap("Maps\\MainDemo\\Map.map", "Teleporter_Maps", null); }; ((Button)hudControl.Controls["Help"]).Click += delegate(Button sender) { hudControl.Controls["HelpWindow"].Visible = !hudControl.Controls["HelpWindow"].Visible; }; ((Button)hudControl.Controls["HelpWindow"].Controls["Close"]).Click += delegate(Button sender) { hudControl.Controls["HelpWindow"].Visible = false; }; ((Button)hudControl.Controls["DebugPath"]).Click += delegate(Button sender) { mapDrawPathMotionMap = !mapDrawPathMotionMap; }; cameraDistanceScrollBar = hudControl.Controls["CameraDistance"] as ScrollBar; if (cameraDistanceScrollBar != null) { cameraDistanceScrollBar.ValueRange = cameraDistanceRange; cameraDistanceScrollBar.ValueChange += cameraDistanceScrollBar_ValueChange; } cameraHeightScrollBar = hudControl.Controls["CameraHeight"] as ScrollBar; if (cameraHeightScrollBar != null) { cameraHeightScrollBar.ValueRange = cameraAngleRange; cameraHeightScrollBar.ValueChange += cameraHeightScrollBar_ValueChange; } InitControlPanelButtons(); UpdateControlPanel(); //set playerFaction if (RTSFactionManager.Instance != null && RTSFactionManager.Instance.Factions.Count != 0) playerFaction = RTSFactionManager.Instance.Factions[0].FactionType; //minimap minimapControl = hudControl.Controls["Minimap"]; string textureName = Map.Instance.GetSourceMapVirtualFileDirectory() + "\\Minimap\\Minimap"; Texture minimapTexture = TextureManager.Instance.Load(textureName, Texture.Type.Type2D, 0); minimapControl.BackTexture = minimapTexture; minimapControl.RenderUI += new RenderUIDelegate(Minimap_RenderUI); //set camera position foreach (Entity entity in Map.Instance.Children) { SpawnPoint spawnPoint = entity as SpawnPoint; if (spawnPoint == null) continue; cameraPosition = spawnPoint.Position.ToVec2(); break; } //World serialized data if (World.Instance.GetCustomSerializationValue("cameraDistance") != null) cameraDistance = (float)World.Instance.GetCustomSerializationValue("cameraDistance"); if (World.Instance.GetCustomSerializationValue("cameraDirection") != null) cameraDirection = (SphereDir)World.Instance.GetCustomSerializationValue("cameraDirection"); if (World.Instance.GetCustomSerializationValue("cameraPosition") != null) cameraPosition = (Vec2)World.Instance.GetCustomSerializationValue("cameraPosition"); for (int n = 0; ; n++) { Unit unit = World.Instance.GetCustomSerializationValue( "selectedUnit" + n.ToString()) as Unit; if (unit == null) break; SetEntitySelected(unit, true); } ResetTime(); //render scene for loading resources EngineApp.Instance.RenderScene(); EngineApp.Instance.MousePosition = new Vec2(.5f, .5f); UpdateCameraScrollBars(); }
/*private void CellOnPointerReleased(object sender, PointerReleasedEventArgs e) * { * if (e.InitialPressMouseButton == MouseButton.Left) * { * Cell cell = (Cell)sender; * GridControl.UpdateSelection(cell); * } * }*/ protected override Size MeasureOverride(Size availableSize) { if (GridControl.Columns.Count == 0 || GridControl.Controller.Count == 0) { foreach (var cell in Cells.GetVisibleCells()) { cell.IsVisible = false; } for (int i = 0; i < RowHeights.Count; i++) { RowHeights[i] = Double.NaN; } CalcAccumulatedColumnRowSizes(); ScrollBar.IsVisible = false; return(Size.Empty); } start: bool measureFromTop = (bottomRowToFocus < 0); if (measureFromTop) { for (int i = 0; i < RowHeights.Count; i++) { RowHeights[i] = 0.0; } } else { RowHeights.Clear(); } double offsetFloor = Math.Floor(ScrollBar.Value); int firstRow = Convert.ToInt32(offsetFloor); int row = firstRow - 1; if (!measureFromTop) { firstRow = bottomRowToFocus; row = firstRow + 1; bottomRowToFocus = -1; } Cells.SetInitialRow(firstRow); double viewportRowsHeight = measureFromTop ? 0.0 : GridControl.HorizontalLinesThickness; double firstVisibleRowVisiblePart = 1.0; double lastVisibleRowVisiblePart = 1.0; FirstWholeVisibleRow = LastWholeVisibleRow = -1; //TODO zero, very big one and two rows while (viewportRowsHeight < availableSize.Height) { if (measureFromTop) { if (row == GridControl.Controller.Count - 1) { break; } row++; } else { if (row == 0) { break; } row--; } int visibleRowIndex = Math.Abs(row - firstRow); for (int column = 0; column < GridControl.Columns.Count; column++) { bool cellNeedsMeasure = false; var cell = Cells.GetCell(row - firstRow, column); if (cell.Row != row) { cell.Row = row; cell.DataContext = GridControl.Controller.GetProperty(row, GridControl.Columns[column].FieldName); cellNeedsMeasure = true; } if (!cell.IsVisible) { cell.IsVisible = true; cellNeedsMeasure = true; } if (cellNeedsMeasure) { //UpdateCellSelection(cell); cell.InvalidateMeasure(); cell.Measure(Size.Infinity); } if (visibleRowIndex == RowHeights.Count) { RowHeights.Add(0.0); } RowHeights[visibleRowIndex] = Math.Max(RowHeights[visibleRowIndex], cell.DesiredSize.Height); } viewportRowsHeight += RowHeights[visibleRowIndex]; if (measureFromTop && visibleRowIndex == 0) { double firstRowHiddenPart = ScrollBar.Value - offsetFloor; firstVisibleRowVisiblePart = 1.0 - firstRowHiddenPart; viewportRowsHeight *= firstVisibleRowVisiblePart; AccumulatedRowHeightsStart = -RowHeights[0] * firstRowHiddenPart; } if (viewportRowsHeight >= availableSize.Height) { double visibleRowVisiblePart = (RowHeights[visibleRowIndex] - (viewportRowsHeight - availableSize.Height)) / RowHeights[visibleRowIndex]; if (measureFromTop) { lastVisibleRowVisiblePart = visibleRowVisiblePart; } else { firstVisibleRowVisiblePart = visibleRowVisiblePart; double firstRowHiddenPart = 1.0 - firstVisibleRowVisiblePart; AccumulatedRowHeightsStart = -RowHeights[RowHeights.Count - 1] * firstRowHiddenPart; } } viewportRowsHeight += GridControl.HorizontalLinesThickness; } if (row < 0) { ScrollBar.Value = 0.0; goto start; } if (!measureFromTop) { //TODO top grid line is not drawn if it should and we have one pixel of next raw in the bottom int temp = firstRow; firstRow = row; row = temp; Cells.SetInitialRow(firstRow); RowHeights.Reverse(); ScrollBar.Value = firstRow + (1.0 - firstVisibleRowVisiblePart); } FirstWholeVisibleRow = firstRow; if (firstVisibleRowVisiblePart < 1.0) { FirstWholeVisibleRow++; } LastWholeVisibleRow = row; if (lastVisibleRowVisiblePart < 1.0) { LastWholeVisibleRow--; } if (FirstWholeVisibleRow > LastWholeVisibleRow) { //TODO check that all works with this FirstWholeVisibleRow = LastWholeVisibleRow = -1; } //TODO fix bug when row == GridControl.Controller.Count Cells.OptimizeFreeCells(row + 1); Cells.UpdateVisibility(row + 1); for (int i = row - firstRow + 1; i < RowHeights.Count; i++) { RowHeights[i] = Double.NaN; } CalcAccumulatedColumnRowSizes(); UpdateScrollBar(); return(new Size(AccumulatedColumnWidths[AccumulatedColumnWidths.Count - 1], viewportRowsHeight)); void CalcAccumulatedColumnRowSizes() { var columns = GridControl.Columns; if (AccumulatedColumnWidths.Count > columns.Count + 1) { AccumulatedColumnWidths.RemoveRange(columns.Count + 1, AccumulatedColumnWidths.Count - (columns.Count + 1)); } if (columns.Count + 1 > AccumulatedColumnWidths.Count) { AccumulatedColumnWidths.AddRange(Enumerable.Repeat(0.0, columns.Count + 1 - AccumulatedColumnWidths.Count)); } for (int i = 0; i < AccumulatedColumnWidths.Count; i++) { if (i != 0) { AccumulatedColumnWidths[i] = AccumulatedColumnWidths[i - 1] + columns[i - 1].Width + GridControl.VerticalLinesThickness; } else { AccumulatedColumnWidths[i] = 0.0; } } if (AccumulatedRowHeights.Count > RowHeights.Count + 1) { AccumulatedRowHeights.RemoveRange(RowHeights.Count + 1, AccumulatedRowHeights.Count - (RowHeights.Count + 1)); } if (RowHeights.Count + 1 > AccumulatedRowHeights.Count) { AccumulatedRowHeights.AddRange(Enumerable.Repeat(0.0, RowHeights.Count + 1 - AccumulatedRowHeights.Count)); } for (int i = 0; i < AccumulatedRowHeights.Count; i++) { if (i != 0) { if (!Double.IsNaN(RowHeights[i - 1])) { AccumulatedRowHeights[i] = Math.Round(AccumulatedRowHeights[i - 1] + RowHeights[i - 1] + GridControl.HorizontalLinesThickness); } else { AccumulatedRowHeights[i] = Double.NaN; } } else { AccumulatedRowHeights[i] = Math.Round(AccumulatedRowHeightsStart); if (AccumulatedRowHeightsStart < -Single.Epsilon) { AccumulatedRowHeights[i] += GridControl.HorizontalLinesThickness; } } } } void UpdateScrollBar() { //TODO: grid should not scroll entirely ScrollBar.IsVisible = (viewportRowsHeight >= availableSize.Height); ScrollBar.Height = availableSize.Height; ScrollBar.ViewportSize = row - firstRow - 2 + firstVisibleRowVisiblePart + lastVisibleRowVisiblePart; ScrollBar.InvalidateMeasure(); ScrollBar.Measure(Size.Infinity); } }
public ScrollBarButton(int w, int h, ScrollBar owner) : base(w, h) { this.OwnerScrollBar = owner; }
public FluentScrolling(ScrollBar scrollBar) { this.scrollBar = scrollBar; this.scrollBar.ValueChanged += new EventHandler(onValueChanged); }
private FormsHello() { // Force the entire form to repaint when it is resized. SetStyle(ControlStyles.ResizeRedraw, true); // Set some initial form properties. Size = new Size(400, 270); Text = "Forms Hello"; // Create a button control on the form. button = new Button(); button.Text = "Click Me!"; button.Location = new Point(30, 130); Controls.Add(button); // Create a progress bar control progress = new ProgressBar(); progress.Location = new Point(30, 175); progress.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; Controls.Add(progress); // Create a label and dock it to the bottom. Label label = new Label(); label.Text = "This is a label, docked to the bottom ..."; label.BackColor = Color.White; label.Dock = DockStyle.Bottom; Controls.Add(label); // Hook up interesting events. Paint += new PaintEventHandler(HandlePaint); button.Click += new EventHandler(HandleClick); // Create a scrollbar control. scrollbar = new HScrollBar(); scrollbar.Dock = DockStyle.Bottom; Controls.Add(scrollbar); scrollbar = new VScrollBar(); scrollbar.Dock = DockStyle.Right; Controls.Add(scrollbar); // Create a toolbar control and some toolbar buttons. toolbar = new ToolBar(); toolbar.Buttons.Add("Hello"); ToolBarButton tbb = new ToolBarButton(); tbb.Style = ToolBarButtonStyle.Separator; toolbar.Buttons.Add(tbb); tbb = new ToolBarButton("World!"); toolbar.Buttons.Add(tbb); toolbar.Appearance = ToolBarAppearance.Flat; toolbar.BorderStyle = BorderStyle.FixedSingle; Controls.Add(toolbar); // Create another toolbar. // This reveals some layout bugs, so // the Controls.Add is commented out // to keep the sample looking good toolbar = new ToolBar(); toolbar.Buttons.Add("This one's"); tbb = new ToolBarButton(); tbb.Style = ToolBarButtonStyle.Separator; toolbar.Buttons.Add(tbb); tbb = new ToolBarButton("left docked."); tbb.Style = ToolBarButtonStyle.DropDownButton; toolbar.Buttons.Add(tbb); toolbar.BorderStyle = BorderStyle.Fixed3D; toolbar.Dock = DockStyle.Left; //toolbar.DropDownArrows = false; //Controls.Add(toolbar); checkbox=new CheckBox(); checkbox.Location=new Point(70,95); checkbox.Text="Any Good ?"; checkbox.Checked=true; checkbox.CheckStateChanged += new EventHandler(HandleCheck); Controls.Add(checkbox); }
private void SetScroll(ScrollBar scrollBar, Axis axis, double scrollMin, double scrollMax) { if (scrollBar != null && axis != null) { scrollBar.Minimum = 0; scrollBar.Maximum = _ScrollControlSpan - 1; if (scrollMin > axis._scale._min) { scrollMin = axis._scale._min; } if (scrollMax < axis._scale._max) { scrollMax = axis._scale._max; } int val = 0; Scale scale = axis._scale; double minLinearized = scale._minLinearized; double maxLinearized = scale._maxLinearized; scrollMin = scale.Linearize(scrollMin); scrollMax = scale.Linearize(scrollMax); double scrollMin2 = scrollMax - (maxLinearized - minLinearized); /* * if ( axis.Scale.IsLog ) * scrollMin2 = scrollMax / ( axis._scale._max / axis._scale._min ); * else * scrollMin2 = scrollMax - ( axis._scale._max - axis._scale._min ); */ if (scrollMin >= scrollMin2) { //scrollBar.Visible = false; scrollBar.Enabled = false; scrollBar.Value = 0; } else { double ratio = (maxLinearized - minLinearized) / (scrollMax - scrollMin); /* * if ( axis.Scale.IsLog ) * ratio = ( Math.Log( axis._scale._max ) - Math.Log( axis._scale._min ) ) / * ( Math.Log( scrollMax ) - Math.Log( scrollMin ) ); * else * ratio = ( axis._scale._max - axis._scale._min ) / ( scrollMax - scrollMin ); */ int largeChange = (int)(ratio * _ScrollControlSpan + 0.5); if (largeChange < 1) { largeChange = 1; } scrollBar.LargeChange = largeChange; int smallChange = largeChange / _ScrollSmallRatio; if (smallChange < 1) { smallChange = 1; } scrollBar.SmallChange = smallChange; int span = _ScrollControlSpan - largeChange; val = (int)((minLinearized - scrollMin) / (scrollMin2 - scrollMin) * span + 0.5); /* * if ( axis.Scale.IsLog ) * val = (int)( ( Math.Log( axis._scale._min ) - Math.Log( scrollMin ) ) / * ( Math.Log( scrollMin2 ) - Math.Log( scrollMin ) ) * span + 0.5 ); * else * val = (int)( ( axis._scale._min - scrollMin ) / ( scrollMin2 - scrollMin ) * * span + 0.5 ); */ if (val < 0) { val = 0; } else if (val > span) { val = span; } //if ( ( axis is XAxis && axis.IsReverse ) || ( ( ! axis is XAxis ) && ! axis.IsReverse ) ) if ((axis is XAxis) == axis.Scale.IsReverse) { val = span - val; } if (val < scrollBar.Minimum) { val = scrollBar.Minimum; } if (val > scrollBar.Maximum) { val = scrollBar.Maximum; } scrollBar.Value = val; scrollBar.Enabled = true; //scrollBar.Visible = true; } } }
void floatParameter_ValueChange( ScrollBar sender ) { PageControl.Controls[ sender.Name + "Value" ].Text = sender.Value.ToString( "F2" ); if( !disableChangeEvents ) UpdateCurrentPostEffect( true ); }
private ScrollBarThumbAccessibleObject GetThumb(ScrollBar scrollBar) { var accessibleObject = (ScrollBar.ScrollBarAccessibleObject)scrollBar.AccessibilityObject; return(accessibleObject.ThumbAccessibleObject); }
void engineTimeScaleScrollBar_ValueChange( ScrollBar sender ) { if( !disableChangeEvents ) { float value = float.Parse( sender.Value.ToString( "F1" ) ); EngineApp.Instance.TimeScale = value; UpdateEngineTimeScaleValue(); } }
private void GetInnerElementReferences() { _scrollViewer = (_listBox.Template.FindName("Border", _listBox) as Border).Child as ScrollViewer; _resizeGrip = _scrollViewer.Template.FindName("ResizeGrip", _scrollViewer) as ResizeGrip; _scrollBar = _scrollViewer.Template.FindName("PART_VerticalScrollBar", _scrollViewer) as ScrollBar; }
static void scroll_EventScrollChangePosition(ScrollBar _sender, uint _position) { Gui.Instance.Log("TestApp", LogLevel.Info, "EventScrollChangePosition position=" + _position.ToString()); }
public ScrollableTextBox(HudParentBase parent = null) : base(parent) { header = new Label(this) { ParentAlignment = ParentAlignments.Top | ParentAlignments.Left | ParentAlignments.Inner, Height = 24f, AutoResize = false, Format = new GlyphFormat(Color.White, TextAlignment.Center) }; subheader = new Label(header) { ParentAlignment = ParentAlignments.Bottom, Height = 20f, Padding = new Vector2(0f, 10f), BuilderMode = TextBuilderModes.Wrapped, AutoResize = false, VertCenterText = false, Format = new GlyphFormat(Color.White, TextAlignment.Center, .8f), }; textBox = new TextBox(subheader) { ParentAlignment = ParentAlignments.Bottom | ParentAlignments.Left | ParentAlignments.InnerH, Padding = new Vector2(8f, 8f), BuilderMode = TextBuilderModes.Wrapped, AutoResize = false, Format = GlyphFormat.White, VertCenterText = false, EnableEditing = false, EnableHighlighting = true, ClearSelectionOnLoseFocus = true }; headerDivider = new TexturedBox(textBox) { Color = new Color(53, 66, 75), ParentAlignment = ParentAlignments.Top, DimAlignment = DimAlignments.Width, Padding = new Vector2(0f, 2f), Height = 1f, }; verticalScroll = new ScrollBar(textBox) { ParentAlignment = ParentAlignments.Right, DimAlignment = DimAlignments.Height | DimAlignments.IgnorePadding, Vertical = true, }; scrollDivider = new TexturedBox(verticalScroll) { Color = new Color(53, 66, 75), ParentAlignment = ParentAlignments.Left | ParentAlignments.InnerH, DimAlignment = DimAlignments.Height, Padding = new Vector2(2f, 0f), Width = 1f, }; HeaderText = "Text Page Header"; SubHeaderText = "Subheading\nLine 1\nLine 2\nLine 3\nLine 4"; UseCursor = true; ShareCursor = true; }
private static extern int GetScrollBarInfo(IntPtr hWnd, uint idObject, ref ScrollBar psbi);