Exemple #1
0
        public void CheckScrollBarsVisible(ConstraintCategory category = ConstraintCategory.All)
        {
            if (mode.ContainsFlag(ScrollBarMode.Vertical))
            {
                var v = ScrollPanel.ContentPanel.size.Y > size.Y;
                if (v != VerticalScrollBar.Visible)
                {
                    VerticalScrollBar.Visible = v;
                    VerticalScrollBar.DoLayout(category);
                }
            }
            if (mode.ContainsFlag(ScrollBarMode.Horizontal))
            {
                var v = ScrollPanel.ContentPanel.size.X > size.X;
                if (v != HorizontalScrollBar.Visible)
                {
                    HorizontalScrollBar.Visible = v;
                    HorizontalScrollBar.DoLayout(category);
                }
            }

            if (mode == ScrollBarMode.Both)
            {
                var showFiller = VerticalScrollBar.Visible && HorizontalScrollBar.Visible;
                if (showFiller != fillerPanel.Visible)
                {
                    fillerPanel.Visible = showFiller;
                    base.DoLayout(category);
                }
            }
        }
        private void AddVerticalScrollbar(int left, int minimum, int maximum, int largeChange, int smallChange, int size = 300)
        {
            var desc_label = new Label {
                Left = left - 30,
                Top  = 10,
                Text = $"{minimum} - {maximum}, {smallChange}, {largeChange}"
            };

            Controls.Add(desc_label);

            var sb = new VerticalScrollBar {
                Left        = left,
                Top         = 30,
                Height      = size,
                Minimum     = minimum,
                Maximum     = maximum,
                LargeChange = largeChange,
                SmallChange = smallChange
            };

            Controls.Add(sb);

            var sb_label = new Label {
                Left = left,
                Top  = 340,
                Text = sb.Value.ToString()
            };

            sb.ValueChanged += (o, e) => sb_label.Text = sb.Value.ToString();

            Controls.Add(sb_label);
        }
Exemple #3
0
 /// <summary>
 /// Evento que habre el formulario de Nuevo Alimento con los campos
 /// del registro seleccionado
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnModificar_Click(object sender, EventArgs e)
 {
     try
     {
         VerticalScrollBar x = (VerticalScrollBar)DGridAlimento.TableControl.VerticalScroll.ScrollBar;
         x.ValueChanged -= X_ValueChanged;
         Alimento item = ObtenerSeleccionado();
         if (item != null)
         {
             FrmAlimentoNuevo modificar = new FrmAlimentoNuevo(item.IdAlimento);
             modificar.ShowDialog();
             modificar.Dispose();
             Model.Opcion = 2;
             CargarGrid();
             x.ValueChanged += X_ValueChanged;
         }
         else
         {
             CIDMessageBox.ShowAlert(Constants.Messages.SystemName, Constants.Messages.GridSelectMessage, TypeMessage.informacion);
         }
     }
     catch (Exception ex)
     {
         ErrorLogHelper.AddExcFileTxt(ex, "FrmAlimentoGrid ~ btnModificar_Click(object sender, EventArgs e)");
         CIDMessageBox.ShowAlert(Messages.SystemName, Messages.ErrorFormulario, TypeMessage.error);
     }
 }
Exemple #4
0
        protected override void InitializeChildren(IUIContext context)
        {
            base.InitializeChildren(context);

            HorizontalScrollBar?.Initialize(context);
            VerticalScrollBar?.Initialize(context);
        }
        void SetupMain()
        {
            // Main panel
            mainPanel = DaggerfallUI.AddPanel(mainPanelRect, NativePanel);
            mainPanel.BackgroundTexture   = baseTexture;
            mainPanel.HorizontalAlignment = HorizontalAlignment.Center;
            mainPanel.VerticalAlignment   = VerticalAlignment.Middle;
            if (buyMode)
            {
                mainPanel.BackgroundColor = Color.black;
            }

            // Spells list
            spellsListBox               = new ListBox();
            spellsListBox.Position      = new Vector2(spellsListBoxRect.x, spellsListBoxRect.y);
            spellsListBox.Size          = new Vector2(spellsListBoxRect.width, spellsListBoxRect.height);
            spellsListBox.RowsDisplayed = 16;
            spellsListBox.MaxCharacters = 22;
            spellsListBox.OnSelectItem += SpellsListBox_OnSelectItem;
            if (buyMode)
            {
                spellsListBox.OnMouseDoubleClick += SpellsListBox_OnMouseDoubleClick;
            }
            else
            {
                spellsListBox.OnUseSelectedItem += SpellsListBox_OnUseSelectedItem;
            }
            spellsListBox.OnMouseScrollDown += SpellsListBox_OnMouseScroll;
            spellsListBox.OnMouseScrollUp   += SpellsListBox_OnMouseScroll;
            mainPanel.Components.Add(spellsListBox);

            // Spells list scroller
            spellsListScrollBar = new VerticalScrollBar();
            spellsListScrollBar.HorizontalAlignment = HorizontalAlignment.None;
            spellsListScrollBar.VerticalAlignment   = VerticalAlignment.None;
            spellsListScrollBar.Position            = new Vector2(spellsListScrollBarRect.x, spellsListScrollBarRect.y);
            spellsListScrollBar.Size         = new Vector2(spellsListScrollBarRect.width, spellsListScrollBarRect.height);
            spellsListScrollBar.TotalUnits   = spellsListBox.Count;
            spellsListScrollBar.DisplayUnits = spellsListBox.RowsDisplayed;
            spellsListScrollBar.ScrollIndex  = 0;
            spellsListScrollBar.OnScroll    += SpellsListScrollBar_OnScroll;
            mainPanel.Components.Add(spellsListScrollBar);

            // Spell effect panels
            spellEffectPanels                  = new Panel[3];
            spellEffectPanels[0]               = DaggerfallUI.AddPanel(effect1PanelRect, mainPanel);
            spellEffectPanels[0].Name          = "effect1Panel";
            spellEffectPanels[0].OnMouseClick += SpellEffectPanelClick;
            spellEffectPanels[1]               = DaggerfallUI.AddPanel(effect2PanelRect, mainPanel);
            spellEffectPanels[1].Name          = "effect2Panel";
            spellEffectPanels[1].OnMouseClick += SpellEffectPanelClick;
            spellEffectPanels[2]               = DaggerfallUI.AddPanel(effect3PanelRect, mainPanel);
            spellEffectPanels[2].Name          = "effect3Panel";
            spellEffectPanels[2].OnMouseClick += SpellEffectPanelClick;

            // TODO: Prepare UI for spell buy mode
        }
Exemple #6
0
 private void VerticalScrollBar_VisibleChanged(object sender, EventArgs e)
 {
     if (!DesignMode &&
         !VerticalScrollBar.Visible)
     {
         VerticalScrollBar.Location = new Point(ClientRectangle.Width - VerticalScrollBar.Width, 0);
         VerticalScrollBar.Size     = new Size(VerticalScrollBar.Width, ClientRectangle.Height);
         VerticalScrollBar.Show();
     }
 }
Exemple #7
0
        void VerticalScrollBar_VisibleChanged(object sender, EventArgs e)
        {
            if (!VerticalScrollBar.Visible)
            {
                VerticalScrollBar.Location = new Point(ClientRectangle.Width - VerticalScrollBar.Width, 1);
                VerticalScrollBar.Size     = new Size(VerticalScrollBar.Width, ClientRectangle.Height - 1);// - HorizontalScrollBar.Height);
                VerticalScrollBar.Show();
            }

            VerticalScrollBar.Visible = true;
        }
 public void BringCtrlToFront(Control ctrl)
 {
     ctrl.BringToFront();
     if (HorizontalScrollBar.Visible)
     {
         HorizontalScrollBar.BringToFront();
     }
     if (VerticalScrollBar.Visible)
     {
         VerticalScrollBar.BringToFront();
     }
 }
        protected override string DoImpl()
        {
            var registeredKey = this.ExecutedCommand.Parameters["ID"].ToString();

            var element = this.Automator.ElementsRegistry.GetRegisteredElement(registeredKey);

            VerticalScrollBar scroll = element.FlaUIElement.AsVerticalScrollBar();

            scroll.ScrollDownLarge();

            return(this.JsonResponse());
        }
 void SetupScrollBar()
 {
     // Price list scroll bar
     priceListScrollBar = new VerticalScrollBar
     {
         Position     = new Vector2(106, 39),
         Size         = new Vector2(7, 48),
         DisplayUnits = listDisplayUnits
     };
     mainPanel.Components.Add(priceListScrollBar);
     priceListScrollBar.OnScroll += PriceScrollBar_OnScroll;
 }
Exemple #11
0
 private void UpdateScrollBarPosition()
 {
     if (mode.ContainsFlag(ScrollBarMode.Vertical))
     {
         float yDiff = ScrollPanel.ContentPanel.Height - ScrollPanel.Height;
         VerticalScrollBar.SetValue(ScrollPanel.ContentPanel.position.Y / -yDiff, true);
     }
     if (mode.ContainsFlag(ScrollBarMode.Horizontal))
     {
         float xDiff = ScrollPanel.ContentPanel.Width - ScrollPanel.Width;
         HorizontalScrollBar.SetValue(ScrollPanel.ContentPanel.position.X / -xDiff, true);
     }
 }
    /// <summary>
    /// Add a ScrollBar.
    /// </summary>
    /// <param name="panel">leftPanel, centerPanel or rightPanel.</param>
    /// <param name="minValue">Minimum value on scroll.</param>
    /// <param name="maxValue">Maximum value on scroll.</param>
    /// <param name="action">Action to execute on scroll.</param>
    /// <returns></returns>
    VerticalScrollBar AddVerticalScrollBar(Panel panel, int minValue, int maxValue, VerticalScrollBar.OnScrollHandler action)
    {
        VerticalScrollBar scrollBar = new VerticalScrollBar();

        scrollBar.Position        = new Vector2(18f, y);
        scrollBar.Size            = new Vector2(5, 40);
        scrollBar.DisplayUnits    = 20;
        scrollBar.TotalUnits      = (maxValue - minValue) + 20;
        scrollBar.BackgroundColor = scrollBarBackgroundColor;
        scrollBar.OnScroll       += action;
        panel.Components.Add(scrollBar);

        return(scrollBar);
    }
Exemple #13
0
 /// <summary>
 /// Evento que se ejecuta despues del evento Load,
 /// encargado de cargar el grid e iniciar los Binding's
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void FrmAlimentoGrid_Shown(object sender, EventArgs e)
 {
     try
     {
         VerticalScrollBar x = (VerticalScrollBar)DGridAlimento.TableControl.VerticalScroll.ScrollBar;
         x.ValueChanged += X_ValueChanged;
         CargarGrid();
         IniciarBindig();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public PaletteBox(IWindow window, IControl parent, Rectangle rect,
                   int zIndex   = 0,
                   bool visible = true)
     : base(window, parent, visible)
 {
     Window       = window;
     Parent       = parent;
     _spriteSheet = Ui.SpriteSheet;
     SetRect(rect);
     _clickable.SetRect(rect);
     ZIndex     = zIndex;
     BorderSize = 1;
     _scrollBar = new VerticalScrollBar(window, this, Border.Right);
 }
Exemple #15
0
        private void ShowScrollBars(object sender, EventArgs e)
        {
            if (!VerticalScrollBar.Visible)
            {
                int width = VerticalScrollBar.Width;

                VerticalScrollBar.Location =
                    new Point(ClientRectangle.Width - width - BORDERWIDTH, CAPTIONHEIGHT);

                VerticalScrollBar.Size =
                    new Size(width, ClientRectangle.Height - CAPTIONHEIGHT - BORDERWIDTH);

                VerticalScrollBar.Show();
            }
        }
Exemple #16
0
        /// <summary>
        /// Gets safe scroll index.
        /// Scroller will be adjust to always be inside display range where possible.
        /// </summary>
        int GetSafeScrollIndex(VerticalScrollBar scroller)
        {
            int scrollIndex = scroller.ScrollIndex;

            if (scrollIndex + scroller.DisplayUnits > scroller.TotalUnits)
            {
                scrollIndex = scroller.TotalUnits - scroller.DisplayUnits;
                if (scrollIndex < 0)
                {
                    scrollIndex = 0;
                }
                scroller.Reset(scroller.DisplayUnits, scroller.TotalUnits, scrollIndex);
            }

            return(scrollIndex);
        }
 public ImageListBox(IWindow window, IControl parent, Rectangle rect,
                     int zIndex   = 0,
                     bool visible = true)
     : base(window, parent, visible)
 {
     Window       = window;
     Parent       = parent;
     _spriteSheet = Ui.SpriteSheet;
     _font        = IoC.Get <IFont>();
     SetRect(rect);
     _clickable.SetRect(rect);
     ZIndex     = zIndex;
     BorderSize = 1;
     _margin    = 5 + BorderSize;
     _scrollBar = new VerticalScrollBar(window, this, Border.Right);
 }
Exemple #18
0
            public override void Add(Control value)
            {
                VerticalScrollBar vscrollbar = value as VerticalScrollBar;

                if (vscrollbar != null)
                {
                    ((ViewportContainer)Owner).verticalScrollBar = value;
                }
                HorizontalScrollBar hscrollbar = value as HorizontalScrollBar;

                if (hscrollbar != null)
                {
                    ((ViewportContainer)Owner).horizontalScrollBar = value;
                }
                base.Add(value);
            }
Exemple #19
0
 private void FrmCliente_Shown(object sender, EventArgs e)
 {
     try
     {
         VerticalScrollBar x = (VerticalScrollBar)sfDataGridCliente.TableControl.VerticalScroll.ScrollBar;
         x.ValueChanged += X_ValueChanged;
         CargarGrid();
         IniciarBinding();
         Model.Foto = Properties.Resources.imagen_subir;
     }
     catch (Exception ex)
     {
         ErrorLogHelper.AddExcFileTxt(ex, "FrmCliente ~ FrmCliente_Shown(object sender, EventArgs e)");
         CIDMessageBox.ShowAlert(Messages.SystemName, Messages.ErrorFormulario, TypeMessage.error);
     }
 }
Exemple #20
0
 private void btnLimpiarBusqueda_Click(object sender, EventArgs e)
 {
     try
     {
         VerticalScrollBar x = (VerticalScrollBar)sfDataGridCliente.TableControl.VerticalScroll.ScrollBar;
         x.ValueChanged      -= X_ValueChanged;
         BusquedaControl.Text = string.Empty;
         Model.Opcion         = 2;
         CargarGrid();
         x.ValueChanged += X_ValueChanged;
         errorProvider1.Clear();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #21
0
 /// <summary>
 /// Obtiene nuevamente los registros que ya se habian cargado
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnLimpiarBusqueda_Click(object sender, EventArgs e)
 {
     try
     {
         VerticalScrollBar x = (VerticalScrollBar)DGridAlimento.TableControl.VerticalScroll.ScrollBar;
         x.ValueChanged      -= X_ValueChanged;
         BusquedaControl.Text = String.Empty;
         Model.Opcion         = 2;
         CargarGrid();
         x.ValueChanged += X_ValueChanged;
         error.Clear();
     }
     catch (Exception ex)
     {
         ErrorLogHelper.AddExcFileTxt(ex, "FrmAlimentoGrid ~ btnLimpiarBusqueda_Clic(object sender, EventArgs e)");
         CIDMessageBox.ShowAlert(Messages.SystemName, Messages.ErrorFormulario, TypeMessage.error);
     }
 }
Exemple #22
0
        void SetupScrollBars()
        {
            // Local items list scroll bar (e.g. items in character inventory)
            localItemsScrollBar              = new VerticalScrollBar();
            localItemsScrollBar.Position     = new Vector2(164, 66);
            localItemsScrollBar.Size         = new Vector2(6, 117);
            localItemsScrollBar.DisplayUnits = listDisplayUnits;
            localItemsScrollBar.OnScroll    += LocalItemsScrollBar_OnScroll;
            NativePanel.Components.Add(localItemsScrollBar);

            // Remote items list scroll bar (e.g. wagon, shop, loot pile, etc.)
            remoteItemsScrollBar              = new VerticalScrollBar();
            remoteItemsScrollBar.Position     = new Vector2(262, 66);
            remoteItemsScrollBar.Size         = new Vector2(6, 117);
            remoteItemsScrollBar.DisplayUnits = listDisplayUnits;
            remoteItemsScrollBar.OnScroll    += RemoteItemsScrollBar_OnScroll;
            NativePanel.Components.Add(remoteItemsScrollBar);
        }
Exemple #23
0
        protected override void Setup()
        {
            base.Setup();

            // Load native texture
            nativeTexture = DaggerfallUI.GetTextureFromImg(nativeImgName);
            if (!nativeTexture)
            {
                throw new Exception("DaggerfallClassSelectWindow: Could not load native texture.");
            }

            // Create panel for picker
            pickerPanel.Size = new Vector2(nativeTexture.width, nativeTexture.height);
            pickerPanel.HorizontalAlignment     = HorizontalAlignment.Center;
            pickerPanel.VerticalAlignment       = VerticalAlignment.Middle;
            pickerPanel.BackgroundTexture       = nativeTexture;
            pickerPanel.BackgroundTextureLayout = TextureLayout.StretchToFill;
            NativePanel.Components.Add(pickerPanel);

            // Create list box
            listBox.Position           = new Vector2(26, 27);
            listBox.Size               = new Vector2(138, 72);
            listBox.OnUseSelectedItem += ListBox_OnUseSelectedItem;
            pickerPanel.Components.Add(listBox);

            // Add previous button
            Button previousButton = DaggerfallUI.AddButton(new Rect(179, 10, 9, 9), pickerPanel);

            previousButton.OnMouseClick += PreviousButton_OnMouseClick;

            // Add next button
            Button nextButton = DaggerfallUI.AddButton(new Rect(179, 108, 9, 9), pickerPanel);

            nextButton.OnMouseClick += NextButton_OnMouseClick;

            // Add scrollbar
            scrollBar               = new VerticalScrollBar();
            scrollBar.Position      = new Vector2(181, 23);
            scrollBar.Size          = new Vector2(5, 82);
            scrollBar.OnScrollUp   += ScrollBar_OnScrollUp;
            scrollBar.OnScrollDown += ScrollBar_OnScrollDown;
            pickerPanel.Components.Add(scrollBar);
        }
Exemple #24
0
 /// <summary>
 /// Evento que abre el formulario de Nuevo Alimento con todos los
 /// campos vacios
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnNuevo_Click(object sender, EventArgs e)
 {
     try
     {
         VerticalScrollBar x = (VerticalScrollBar)DGridAlimento.TableControl.VerticalScroll.ScrollBar;
         x.ValueChanged -= X_ValueChanged;
         FrmAlimentoNuevo nuevo = new FrmAlimentoNuevo(0);
         nuevo.ShowDialog();
         nuevo.Dispose();
         Model.Opcion = 2;
         CargarGrid();
         x.ValueChanged += X_ValueChanged;
     }
     catch (Exception ex)
     {
         ErrorLogHelper.AddExcFileTxt(ex, "FrmAlimentoGrid ~ btnNuevo_Click(object sender, EventArgs e)");
         CIDMessageBox.ShowAlert(Messages.SystemName, Messages.ErrorFormulario, TypeMessage.error);
     }
 }
        private async void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                VerticalScrollBar x = (VerticalScrollBar)sfDataGridMedicion.TableControl.VerticalScroll.ScrollBar;
                x.ValueChanged         -= X_ValueChanged;
                pnlBotonesDatos.Enabled = false;
                this.CleanErrors(errorProvider1, typeof(MedicionViewModel));
                var validation = Model.Validate();
                if (validation.IsValid)
                {
                    var resul = await Model.GuardarCambios(CurrentSession.IdCuentaUsuario);

                    if (resul.IdMedicion > 0)
                    {
                        CIDMessageBox.ShowAlert(Messages.SystemName, Messages.SuccessMessage, TypeMessage.correcto);
                        LimpiarPropiedades();
                        GroupMedicion.Enabled = false;
                        Model.Opcion          = 2;
                        CargarGrid();
                        x.ValueChanged += X_ValueChanged;
                    }
                    else
                    {
                        CIDMessageBox.ShowAlert(Messages.SystemName, Messages.ErrorMessage, TypeMessage.error);
                    }
                }
                else
                {
                    this.ShowErrors(errorProvider1, typeof(MedicionViewModel), validation);
                }
            }
            catch (Exception ex)
            {
                ErrorLogHelper.AddExcFileTxt(ex, "FrmDireccionesCliente ~ btnGuardar_Click(object sender, EventArgs e)");
                CIDMessageBox.ShowAlert(Messages.SystemName, Messages.ErrorMessage, TypeMessage.error);
            }
            finally
            {
                pnlBotonesDatos.Enabled = true;
            }
        }
Exemple #26
0
        private async void btnEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                VerticalScrollBar x = (VerticalScrollBar)sfDataGridCliente.TableControl.VerticalScroll.ScrollBar;
                x.ValueChanged -= X_ValueChanged;
                var item = ObtenerSeleccionado();
                if (item != null)
                {
                    if (CIDMessageBox.ShowAlertRequest(Messages.SystemName, Messages.ConfirmDeleteMessage) == DialogResult.OK)
                    {
                        Model.IdCliente = item.IdCliente;
                        //Model.IdUsuarioL = CurrentSession.IdCuentaUsuario;
                        groupBoxCliente.Enabled = false;
                        var result = await Model.DeleteAsync();

                        if (result == 1)
                        {
                            CIDMessageBox.ShowAlert(Messages.SystemName, Messages.SuccessDeleteMessage, TypeMessage.correcto);
                            LimpiarPropiedades();
                            Model.Opcion = 2;
                            CargarGrid();
                            x.ValueChanged += X_ValueChanged;
                        }
                        else
                        {
                            CIDMessageBox.ShowAlert(Messages.SystemName, Messages.ErrorDeleteMessage, TypeMessage.error);
                        }
                    }
                }
                else
                {
                    CIDMessageBox.ShowAlert(Messages.SystemName, Messages.GridSelectMessage, TypeMessage.informacion);
                }
            }
            catch (Exception ex)
            {
                ErrorLogHelper.AddExcFileTxt(ex, "FrmCliente ~  btnEliminar_Click(object sender, EventArgs e)");
                CIDMessageBox.ShowAlert(Messages.SystemName, Messages.ErrorDeleteMessage, TypeMessage.error);
            }
        }
Exemple #27
0
        /// <summary>
        /// Evento que ejecuta el método del ViewModels de alimentos para
        /// eliminar el registro seleccionado
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void btnEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                VerticalScrollBar x = (VerticalScrollBar)DGridAlimento.TableControl.VerticalScroll.ScrollBar;
                x.ValueChanged -= X_ValueChanged;
                Alimento item = ObtenerSeleccionado();
                if (item != null)
                {
                    if (CIDMessageBox.ShowAlertRequest(Messages.SystemName, Messages.ConfirmDeleteMessage) == DialogResult.OK)
                    {
                        Model.IdAlimento = item.IdAlimento;
                        var result = await Model.DeleteAsync(CurrentSession.IdCuentaUsuario);

                        if (result == 1)
                        {
                            CIDMessageBox.ShowAlert(Constants.Messages.SystemName, Constants.Messages.SuccessDeleteMessage, TypeMessage.correcto);
                            Model.Opcion = 2;
                            CargarGrid();
                            x.ValueChanged += X_ValueChanged;
                        }
                        else
                        {
                            CIDMessageBox.ShowAlert(Constants.Messages.SystemName, Constants.Messages.SuccessDeleteMessage, TypeMessage.correcto);
                        }
                    }
                }
                else
                {
                    CIDMessageBox.ShowAlert(Constants.Messages.SystemName, Constants.Messages.GridSelectMessage, TypeMessage.informacion);
                }
            }
            catch (Exception ex)
            {
                ErrorLogHelper.AddExcFileTxt(ex, "FrmAlimentoGrid ~ btnEliminar_Click(object sender, EventArgs e)");
                CIDMessageBox.ShowAlert(Messages.SystemName, Messages.ErrorFormulario, TypeMessage.error);
            }
        }
 private void FrmMedicionGrid_Shown(object sender, EventArgs e)
 {
     try
     {
         VerticalScrollBar x = (VerticalScrollBar)sfDataGridMedicion.TableControl.VerticalScroll.ScrollBar;
         x.ValueChanged += X_ValueChanged;
         CargarGrid();
         CIDWait.Show(async() =>
         {
             var ListaMedicion = await Model.GetListaMedicionsAsync();
             Model.LlenarListaMedicion(ListaMedicion);
             var ListaUnidad = await Model.GetListaUnidadMedida();
             Model.LlenarListaUnidadMedida(ListaUnidad);
         }, "Espere");
         IniciarBinding();
         Model.EsAbierta = true;
     }
     catch (Exception ex)
     {
         ErrorLogHelper.AddExcFileTxt(ex, "FrmDireccionesCliente ~ FrmMedicionGrid_Shown(object sender, EventArgs e)");
         CIDMessageBox.ShowAlert(Messages.SystemName, Messages.ErrorFormulario, TypeMessage.error);
     }
 }
Exemple #29
0
        private void ShowScrollBars(object sender, EventArgs e)
        {
            if (!VerticalScrollBar.Visible)
            {
                int width = VerticalScrollBar.Width;
                //if (isFirst)
                //{
                //    Width -= width;
                //    isFirst = false;
                //}
                VerticalScrollBar.Location = new Point(ClientRectangle.Width - width - 1, 1);
                VerticalScrollBar.Size     = new Size(width, ClientRectangle.Height - 1);
                VerticalScrollBar.Show();
                //   AutoResizeColumns();

                //MessageBox.Show(width.ToString());
                //SuspendLayout();
                //foreach (DataGridViewColumn c in Columns)
                //{
                //    c.Width -= 4;
                //}
                //ResumeLayout();
            }
        }
        protected override void Setup()
        {
            base.Setup();

            ParentPanel.BackgroundColor = ScreenDimColor;

            nativeTexture = DaggerfallUI.GetTextureFromImg(SPELLBOOKIMAGENAME);
            if (!nativeTexture)
            {
                throw new Exception("DaggerfallTravelMap: Could not load native texture.");
            }

            mainPanel = new Panel();
            mainPanel.BackgroundTexture = nativeTexture;
            mainPanel.Size = new Vector2(nativeTexture.width, nativeTexture.height);
            mainPanel.HorizontalAlignment = HorizontalAlignment.Center;
            mainPanel.VerticalAlignment   = VerticalAlignment.Middle;
            mainPanel.Name = "main_panel";
            NativePanel.Components.Add(mainPanel);

            listBox                     = new ListBox();
            listBox.Position            = new Vector2(5, 12);
            listBox.Size                = new Vector2(111, 132);
            listBox.RowsDisplayed       = 16;
            listBox.MaxCharacters       = 22;
            listBox.Name                = "spell_list";
            listBox.OnMouseClick       += listBox_OnMouseClickHandler;
            listBox.OnMouseDoubleClick += listBox_OnMouseDoubleClickHandler;
            listBox.OnMouseScrollDown  += listBox_OnMouseScroll;
            listBox.OnMouseScrollUp    += listBox_OnMouseScroll;
            mainPanel.Components.Add(listBox);

            buyButton               = DaggerfallUI.AddButton(new Rect(3, 152, 36, 9), mainPanel);
            buyButton.Name          = "buy_button";
            buyButton.OnMouseClick += buyButton_OnMouseClick;

            upArrowButton               = DaggerfallUI.AddButton(new Rect(121, 11, 9, 16), mainPanel);
            upArrowButton.Name          = "upArroow_button";
            upArrowButton.OnMouseClick += arrowButton_OnMouseClick;

            downArrowButton               = DaggerfallUI.AddButton(new Rect(121, 132, 9, 16), mainPanel);
            downArrowButton.Name          = "downArroow_button";
            downArrowButton.OnMouseClick += arrowButton_OnMouseClick;

            exitButton               = DaggerfallUI.AddButton(new Rect(216, 149, 42, 14.5f), mainPanel);
            exitButton.Name          = "downArroow_button";
            exitButton.OnMouseClick += exitButton_OnMouseClick;

            scrollBar = new VerticalScrollBar();
            scrollBar.HorizontalAlignment = HorizontalAlignment.None;
            scrollBar.VerticalAlignment   = VerticalAlignment.None;
            scrollBar.Position            = new Vector2(121, 27);
            scrollBar.Size         = new Vector2(9, 104);
            scrollBar.TotalUnits   = listBox.Count;
            scrollBar.DisplayUnits = listBox.RowsDisplayed;
            scrollBar.ScrollIndex  = 0;
            scrollBar.Name         = "scrollbar";
            scrollBar.OnScroll    += ScrollBar_OnScroll;
            mainPanel.Components.Add(scrollBar);

            spellIcon      = DaggerfallUI.AddPanel(new Rect(149.25f, 14, 16, 16), mainPanel);
            spellIcon.Name = "spell_icon";
            spellIcon.BackgroundTextureLayout = BackgroundLayout.StretchToFill;

            spellRangeIcon      = DaggerfallUI.AddPanel(new Rect(182, 14, 25, 16), mainPanel);
            spellRangeIcon.Name = "spellRange_icon";
            spellRangeIcon.BackgroundTextureLayout = BackgroundLayout.StretchToFill;

            spellElementIcon      = DaggerfallUI.AddPanel(new Rect(223, 14, 16, 16), mainPanel);
            spellElementIcon.Name = "spellEffect_icon";
            spellElementIcon.BackgroundTextureLayout = BackgroundLayout.StretchToFill;

            spellName               = new TextLabel();
            spellName.Position      = new Vector2(123, 1);
            spellName.Size          = new Vector2(122, 7);
            spellName.MaxCharacters = 24;
            spellName.Name          = "spellName_label";
            mainPanel.Components.Add(spellName);

            spellPrice               = new TextLabel();
            spellPrice.Position      = new Vector2(76, 153);
            spellPrice.Size          = new Vector2(50, 7);
            spellPrice.MaxCharacters = 19;
            spellPrice.Name          = "spellPrice_label";
            mainPanel.Components.Add(spellPrice);

            spellEffectPanels = new Panel[3];

            spellEffectPanels[0]               = new Panel();
            spellEffectPanels[0].Position      = new Vector2(138, 40);
            spellEffectPanels[0].Size          = new Vector2(118, 28);
            spellEffectPanels[0].Name          = "effect_top";
            spellEffectPanels[0].OnMouseClick += SpellEffectPanelClick;
            mainPanel.Components.Add(spellEffectPanels[0]);

            spellEffectPanels[1]               = new Panel();
            spellEffectPanels[1].Position      = new Vector2(138, 78);
            spellEffectPanels[1].Size          = new Vector2(118, 28);
            spellEffectPanels[1].Name          = "effect_middle";
            spellEffectPanels[1].OnMouseClick += SpellEffectPanelClick;
            mainPanel.Components.Add(spellEffectPanels[1]);

            spellEffectPanels[2]               = new Panel();
            spellEffectPanels[2].Position      = new Vector2(138, 116);
            spellEffectPanels[2].Size          = new Vector2(118, 28);
            spellEffectPanels[2].Name          = "effect_bottom";
            spellEffectPanels[2].OnMouseClick += SpellEffectPanelClick;
            mainPanel.Components.Add(spellEffectPanels[2]);

            //configure effect labels
            spellEffectLabels = new TextLabel[spellEffectPanels.Length * 2];

            for (int i = 0; i < spellEffectLabels.Length; i++)
            {
                spellEffectLabels[i] = new TextLabel();
                spellEffectLabels[i].MaxCharacters       = 24;
                spellEffectLabels[i].Text                = string.Format("index: {0} panel: {1}", i, i / 2);
                spellEffectLabels[i].Name                = "effect_label_" + i;
                spellEffectLabels[i].HorizontalAlignment = HorizontalAlignment.Center;

                if (i % 2 == 0)
                {
                    spellEffectLabels[i].Position = new Vector2(spellEffectLabels[i].Position.x, spellEffectPanels[i / 2].Size.y * .125f);
                }
                else
                {
                    spellEffectLabels[i].Position = new Vector2(spellEffectLabels[i].Position.x, spellEffectPanels[i / 2].Size.y * .5f);
                }
                spellEffectPanels[i / 2].Components.Add(spellEffectLabels[i]);
            }

            Refresh = true;

            //##below just fills in examples for testing until spells are implemented

            spellIcon.BackgroundTexture        = GetSpellIcon(34);
            spellRangeIcon.BackgroundTexture   = GetSpellRangeIcon(0);
            spellElementIcon.BackgroundTexture = GetElementTypeIcon(0);
            spellPrice.Text = "01234567890123456789012345678901234567890";

            for (int i = 0; i < spellEffectPanels.Length; i++)
            {
                var labels = GetEffectLabels(i);
                SetEffectLabel(labels, new string[] { labels[0].Name, labels[1].Name });
            }

            for (int i = 0; i < 50; i++)
            {
                listBox.AddItem(i + "- spell name");
            }

#if LAYOUT
            SetBackgroundColors();
#endif
        }