/// <summary>
    /// 
    /// </summary>
    /// <param name="fileName"></param>
    /// <param name="gv"></param>
    public void ExceleAktar(DataTable Tablo, string fileName, GridLines Kenarlik)
    {
        HttpContext.Current.Response.Clear();
        HttpContext.Current.Response.AddHeader(
            "content-disposition", string.Format("attachment; filename={0}", fileName));
        HttpContext.Current.Response.ContentType = "application/ms-excel";

        GridView gv = new GridView();
        gv.DataSource = Tablo;
        gv.DataBind();
        using(StringWriter sw = new StringWriter())
        {
            using(HtmlTextWriter htw = new HtmlTextWriter(sw))
            {
                //  Create a table to contain the grid
                Table table = new Table();

                //  include the gridline settings
                table.GridLines = Kenarlik;

                //  add the header row to the table
                if(gv.HeaderRow != null)
                {
                    TuaGridViewExcelExport.PrepareControlForExport(gv.HeaderRow);
                    table.Rows.Add(gv.HeaderRow);
                }

                //  add each of the data rows to the table
                foreach(GridViewRow row in gv.Rows)
                {
                    TuaGridViewExcelExport.PrepareControlForExport(row);
                    table.Rows.Add(row);
                }

                //  add the footer row to the table
                if(gv.FooterRow != null)
                {
                    TuaGridViewExcelExport.PrepareControlForExport(gv.FooterRow);
                    table.Rows.Add(gv.FooterRow);
                }

                //  render the table into the htmlwriter
                table.RenderControl(htw);
                //  render the htmlwriter into the response
                HttpContext.Current.Response.Write(RecursiveTranslateAjax(sw.ToString()));
                HttpContext.Current.Response.End();
            }
        }
    }
示例#2
0
        private bool IsWinner(Player player, GridLines gridLine)
        {
            bool isWon = false;
            Dictionary <string, List <int> > winningSets = LoadJson(gridLine);

            foreach (var item in winningSets)
            {
                if (player.Moves.Intersect(item.Value).Count() == item.Value.Count())
                {
                    isWon = true;
                    break;
                }
            }

            return(isWon);
        }
示例#3
0
        public static Gtk.TreeViewGridLines ToGtkValue(this GridLines value)
        {
            switch (value)
            {
            case GridLines.Both:
                return(Gtk.TreeViewGridLines.Both);

            case GridLines.Horizontal:
                return(Gtk.TreeViewGridLines.Horizontal);

            case GridLines.Vertical:
                return(Gtk.TreeViewGridLines.Vertical);

            case GridLines.None:
                return(Gtk.TreeViewGridLines.None);
            }
            throw new InvalidOperationException("Invalid GridLines value: " + value);
        }
示例#4
0
文件: Util.cs 项目: wiltonlazary/xwt
        public static NSTableViewGridStyle ToMacValue(this GridLines value)
        {
            switch (value)
            {
            case GridLines.Both:
                return(NSTableViewGridStyle.SolidHorizontalLine | NSTableViewGridStyle.SolidVerticalLine);

            case GridLines.Horizontal:
                return(NSTableViewGridStyle.SolidHorizontalLine);

            case GridLines.Vertical:
                return(NSTableViewGridStyle.SolidVerticalLine);

            case GridLines.None:
                return(NSTableViewGridStyle.None);
            }
            throw new InvalidOperationException("Invalid GridLines value: " + value);
        }
示例#5
0
        /// <internalonly/>
        /// <devdoc>
        ///    <para>A protected method. Adds information about the border
        ///       color and border width HTML attributes to the list of attributes to render.</para>
        /// </devdoc>
        protected override void AddAttributesToRender(HtmlTextWriter writer)
        {
            base.AddAttributesToRender(writer);
            if (ControlStyleCreated)
            {
                if (EnableLegacyRendering || writer is Html32TextWriter)
                {
                    // Must render bordercolor attribute to affect cell borders.
                    Color borderColor = BorderColor;
                    if (!borderColor.IsEmpty)
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Bordercolor, ColorTranslator.ToHtml(borderColor));
                    }
                }
            }

            string borderWidthString = "0";
            bool   renderBorder      = false;

            if (ControlStyleCreated)
            {
                // GridLines property controls whether we render the "border" attribute, as "border" controls
                // whether gridlines appear in HTML 3.2. Always render a value for the border attribute.
                Unit      borderWidth = BorderWidth;
                GridLines gridLines   = GridLines;
                if (gridLines != GridLines.None)
                {
                    if (borderWidth.IsEmpty || borderWidth.Type != UnitType.Pixel)
                    {
                        borderWidthString = "1";
                        renderBorder      = true;
                    }
                    else
                    {
                        borderWidthString = ((int)borderWidth.Value).ToString(NumberFormatInfo.InvariantInfo);
                    }
                }
            }
            if ((RenderingCompatibility < VersionUtil.Framework40) || renderBorder)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Border, borderWidthString);
            }
        }
    private void PrepareEditor()
    {
        LevelScaleManager levelScaleManager = levelToEdit.GetComponent <LevelScaleManager>();

        levelScaleManager.InitializeLevelScaleManager(levelWidth, levelHeight);
        levelScaleManager.InitializeVoidBorders(rootCanvas.gameObject);

        GridLines gridLines = levelToEdit.GetComponent <GridLines>();

        gridLines.scaledUnitSize = levelScaleManager.scaledUnitSize;
        gridLines.levelWidth     = this.levelWidth;
        gridLines.levelHeight    = this.levelHeight;
        gridLines.InitializeGrid();

        TileSelectionBox tileBox = tileSelectionBox.GetComponent <TileSelectionBox>();

        tileBox.SetupTileSelectionBox();

        levelToEdit.SetActive(true);
    }
示例#7
0
    //based on http://answers.unity.com/answers/1108340/view.html
    internal void CreateGridLine(int startX, int startY, int startZ, int endX, int endY, int endZ)
    {
        Color   color = new Color(0.505f, 0.145f, 0.552f);
        Vector3 start = GetGridScaledVector(startX, startY, startZ);
        Vector3 end   = GetGridScaledVector(endX, endY, endZ);

        GameObject myLine = new GameObject();

        myLine.transform.position = start;
        myLine.AddComponent <LineRenderer>();
        LineRenderer lr = myLine.GetComponent <LineRenderer>();

        lr.material   = new Material(Shader.Find("Standard"));
        lr.startColor = lr.endColor = color;
        lr.startWidth = lr.endWidth = 0.2f;
        lr.SetPosition(0, start);
        lr.SetPosition(1, end);

        GridLines.Add(myLine);
    }
示例#8
0
    private void GridLineY()
    {
        //y軸のグリッド線を生成
        for (int i = 0; i < 10; i++)
        {
            GameObject go = Instantiate(gridLine);

            GridLines grid = go.GetComponent <GridLines>();

            go.transform.parent = Camera.main.transform;

            go.transform.localPosition = pos;

            go.name = "GridLine";

            grid.GridLineY(pos.y);

            pos.y -= interval;
        }
    }
示例#9
0
        private void Viewport_Load(object sender, EventArgs e)
        {
            //Note: Setting up OpenGL stuff only works after the control has loaded on the Form.
            Viewport.MakeCurrent();

            Renderer = new Renderer(Viewport.Width, Viewport.Height);

            Renderer.SetBackgroundColor(Color.Gray);

            AnimGrp = new AnimationGroup(Renderer);

            Shader = new Shader();

            UIGrid = new GridLines(Renderer, Shader);
            UIAxis = new AxisLines(Renderer, Shader);

            ResetTransforms();
            UpdateTransforms();

            LoadSettings();
        }
示例#10
0
        private Dictionary <string, List <int> > LoadJson(GridLines gridLine)
        {
            Dictionary <string, List <int> > winningSets = null;

            switch (gridLine)
            {
            case GridLines.Column:
                winningSets = LoadJson("ColumnWinnerSets.json");
                break;

            case GridLines.Diagonal:
                winningSets = LoadJson("DiagonalWinnerSets.json");
                break;

            case GridLines.Row:
                winningSets = LoadJson("RowWinnerSets.json");
                break;
            }

            return(winningSets);
        }
 public static void ConfigurarChica(DataGrid dtg, string campoClave, GridLines bordes)
 {
     dtg.AllowPaging                = false;
     dtg.AllowCustomPaging          = false;
     dtg.AutoGenerateColumns        = false;
     dtg.CellPadding                = 1;
     dtg.CellSpacing                = 0;
     dtg.DataKeyField               = campoClave;
     dtg.GridLines                  = bordes;
     dtg.BorderStyle                = BorderStyle.Solid;
     dtg.BorderWidth                = Unit.Pixel(1);
     dtg.BorderColor                = System.Drawing.Color.Gray;
     dtg.HeaderStyle.CssClass       = "TituloGrilla";
     dtg.ItemStyle.CssClass         = "TextoGrilla";
     dtg.PagerStyle.CssClass        = "Texto";
     dtg.PagerStyle.Mode            = PagerMode.NumericPages;
     dtg.PagerStyle.PageButtonCount = 20;
     dtg.PagerStyle.Position        = PagerPosition.TopAndBottom;
     //dtg.PageSize = 15;//cantidadOpciones;
     dtg.ShowHeader = true;
     dtg.ShowFooter = false;
     dtg.Width      = Unit.Percentage(100);
 }
示例#12
0
        internal override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (SkipRender(context))
            {
                return;
            }
            var sheet = new TagBuilder("a2-sheet", null, IsInGrid);

            onRender?.Invoke(sheet);
            MergeAttributes(sheet, context);
            if (GridLines != GridLinesVisibility.None)
            {
                sheet.AddCssClass($"grid-{GridLines.ToString().ToLowerInvariant()}");
            }
            sheet.AddCssClassBool(Hover, "hover");
            sheet.AddCssClassBool(Striped, "striped");
            sheet.RenderStart(context);
            RenderColumns(context);
            RenderHeader(context);
            RenderBody(context);
            RenderFooter(context);
            sheet.RenderEnd(context);
        }
 private static void SetGRID_LINES(string coordinateSystemName, GridLines gridLines, List <Dictionary <string, string> > table)
 {
     foreach (GridLine gridLine in gridLines.Lines)
     {
         Dictionary <string, string> tableRow = new Dictionary <string, string>
         {
             { "CoordSys", Adaptor.ToStringEntryLimited(coordinateSystemName) },
             { "AxisDir", Adaptor.fromEnum(gridLine.AxisDirection) },
             { "GridID", Adaptor.ToStringEntryLimited(gridLine.GridID) },
             { "XRYZCoord", Adaptor.fromDouble(gridLine.Coordinate) },
             { "LineType", Adaptor.fromEnum(gridLine.LineType) },
             { "LineColor", Adaptor.ToStringEntryLimited(gridLine.LineColor) },
             { "Visible", Adaptor.toYesNo(gridLine.Visible) },
             { "BubbleLoc", Adaptor.fromEnum(gridLine.BubbleLocation) }
         };
         if (gridLine.AllVisible)
         {
             tableRow.Add("AllVisible", Adaptor.toYesNo(gridLine.AllVisible));
             tableRow.Add("BubbleSize", Adaptor.fromDouble(gridLine.BubbleSize));
         }
         table.Add(tableRow);
     }
 }
示例#14
0
        public static void IconsBitmapsImportFromFile(string path)
        {
            // Read file in local directory. If it doesn't exist there, read it in root civ2 directory.
            var    icons          = new Bitmap(640, 480, PixelFormat.Format32bppRgba);
            string FilePath_local = path + Path.DirectorySeparatorChar + "ICONS.GIF";
            string FilePath_root  = Settings.Civ2Path + "ICONS.GIF";

            if (File.Exists(FilePath_local))
            {
                icons = new Bitmap(FilePath_local);
            }
            else if (File.Exists(FilePath_root))
            {
                icons = new Bitmap(FilePath_root);
            }
            else
            {
                Debug.WriteLine("ICONS.GIF not found!");
            }

            // Initialize objects
            Improvements  = new Bitmap[67];
            ResearchIcons = new Bitmap[5, 4];

            // Define transparent colors
            Color transparentLightPink = Color.FromArgb(255, 159, 163); //define transparent back color (light pink)
            Color transparentPink      = Color.FromArgb(255, 0, 255);   //define transparent back color (pink)
            //Color transparentGray = Color.FromArgb(135, 83, 135);    //define transparent back color (gray)

            // Improvement icons
            int count = 1;  //start at 1. 0 is for no improvement.

            for (int row = 0; row < 5; row++)
            {
                for (int col = 0; col < 8; col++)
                {
                    Improvements[count] = icons.Clone(new Rectangle((36 * col) + 343 + col, (20 * row) + 1 + row, 36, 20));
                    count++;
                    if (count == 39)
                    {
                        break;
                    }
                }
            }

            // WondersIcons
            for (int row = 0; row < 4; row++)
            {
                for (int col = 0; col < 7; col++)
                {
                    Improvements[count] = icons.Clone(new Rectangle((36 * col) + 343 + col, (20 * row) + 106 + row, 36, 20));
                    count++;
                }
            }

            // Research icons
            for (int row = 0; row < 4; row++)
            {
                for (int col = 0; col < 5; col++)
                {
                    ResearchIcons[col, row] = icons.Clone(new Rectangle((36 * col) + 343 + col, (20 * row) + 211 + row, 36, 20));
                }
            }

            SellIcon = icons.Clone(new Rectangle(16, 320, 14, 14));
            SellIcon.ReplaceColors(transparentLightPink, Colors.Transparent);

            ViewPiece = icons.Clone(new Rectangle(199, 256, 64, 32));
            ViewPiece.ReplaceColors(transparentLightPink, Colors.Transparent);
            ViewPiece.ReplaceColors(transparentPink, Colors.Transparent);

            GridLines = icons.Clone(new Rectangle(183, 430, 64, 32));
            GridLines.ReplaceColors(transparentLightPink, Colors.Transparent);
            GridLines.ReplaceColors(transparentPink, Colors.Transparent);

            GridLinesVisible = icons.Clone(new Rectangle(248, 430, 64, 32));
            GridLinesVisible.ReplaceColors(transparentLightPink, Colors.Transparent);
            GridLinesVisible.ReplaceColors(transparentPink, Colors.Transparent);

            // Big icons in city resources
            CityHungerBig = icons.Clone(new Rectangle(1, 290, 14, 14));
            CityHungerBig.ReplaceColors(transparentLightPink, Colors.Transparent);
            CityShortageBig = icons.Clone(new Rectangle(16, 290, 14, 14));
            CityShortageBig.ReplaceColors(transparentLightPink, Colors.Transparent);
            CityCorruptBig = icons.Clone(new Rectangle(31, 290, 14, 14));
            CityCorruptBig.ReplaceColors(transparentLightPink, Colors.Transparent);
            CityFoodBig = icons.Clone(new Rectangle(1, 305, 14, 14));
            CityFoodBig.ReplaceColors(transparentLightPink, Colors.Transparent);
            CitySupportBig = icons.Clone(new Rectangle(16, 305, 14, 14));
            CitySupportBig.ReplaceColors(transparentLightPink, Colors.Transparent);
            CityTradeBig = icons.Clone(new Rectangle(31, 305, 14, 14));
            CityTradeBig.ReplaceColors(transparentLightPink, Colors.Transparent);
            CityLuxBig = icons.Clone(new Rectangle(1, 320, 14, 14));
            CityLuxBig.ReplaceColors(transparentLightPink, Colors.Transparent);
            CityTaxBig = icons.Clone(new Rectangle(16, 320, 14, 14));
            CityTaxBig.ReplaceColors(transparentLightPink, Colors.Transparent);
            CitySciBig = icons.Clone(new Rectangle(31, 320, 14, 14));
            CitySciBig.ReplaceColors(transparentLightPink, Colors.Transparent);

            // Small icons in city resources
            CityFoodSmall = icons.Clone(new Rectangle(49, 334, 10, 10));
            CityFoodSmall.ReplaceColors(transparentLightPink, Colors.Transparent);
            CitySupportSmall = icons.Clone(new Rectangle(60, 334, 10, 10));
            CitySupportSmall.ReplaceColors(transparentLightPink, Colors.Transparent);
            CityTradeSmall = icons.Clone(new Rectangle(71, 334, 10, 10));
            CityTradeSmall.ReplaceColors(transparentLightPink, Colors.Transparent);

            // Wallpaper icons
            PanelOuterWallpaper = icons.Clone(new Rectangle(199, 322, 64, 32));
            PanelInnerWallpaper = icons.Clone(new Rectangle(299, 190, 31, 31));

            // Icon for next/previous city (black arrow)
            NextCity = icons.Clone(new Rectangle(227, 389, 18, 24));
            NextCity.ReplaceColors(transparentLightPink, Colors.Transparent);
            PrevCity = icons.Clone(new Rectangle(246, 389, 18, 24));
            PrevCity.ReplaceColors(transparentLightPink, Colors.Transparent);
            //NextCityLarge = ModifyImage.Resize(NextCity, 27, 36);    //50% larger
            NextCityLarge = NextCity;
            //PrevCityLarge = ModifyImage.Resize(PrevCity, 27, 36);    //50% larger
            PrevCityLarge = PrevCity;

            // Zoom icons
            ZoomIN  = icons.Clone(new Rectangle(18, 389, 16, 16));
            ZoomOUT = icons.Clone(new Rectangle(35, 389, 16, 16));

            // Battle sprites
            BattleAnim = new Bitmap[8];
            for (int i = 0; i < 8; i++)
            {
                BattleAnim[i] = icons.Clone(new Rectangle(1 + 33 * i, 356, 32, 32));
                BattleAnim[i].ReplaceColors(transparentLightPink, Colors.Transparent);
            }

            icons.Dispose();
        }
    void Update()
    {
        if (Input.GetButtonDown("LevelEditor_ToggleMenu") || Input.GetButtonDown("Cancel"))
        {
            if (levelOptionsMenu.activeSelf == false)
            {
                buildingMenu.SetActive(!buildingMenu.activeSelf);
            }
        }

        if (Input.GetButtonDown("LevelEditor_ToggleGridLines"))
        {
            GridLines gridLines = levelToEdit.GetComponent <GridLines>();
            gridLines.gridActive = !gridLines.gridActive;
        }

        if (Input.GetButtonDown("LevelEditor_RotateTile"))
        {
            if (selectedTile != null)
            {
                selectedTile.transform.Rotate(new Vector3(0f, 0f, 45.0f));
            }
        }

        if (selectedTile != null)
        {
            if (tileSelectionBox.activeInHierarchy == false)
            {
                DisplayTileAtCursor();
                if (Input.GetButtonDown("LevelEditor_PlaceTile"))
                {
                    placeTile = true;
                }
                else if (Input.GetButtonDown("LevelEditor_DeleteTile"))
                {
                    delTile = true;
                }

                if (placeTile)
                {
                    var tileBounds   = selectedTile.transform.localScale;
                    var spriteBounds = selectedTile.GetComponentInChildren <SpriteRenderer>().sprite.bounds.size;

                    if (Mathf.Abs(lastPlacedX - selectedTile.transform.position.x) >= tileBounds.x * spriteBounds.x ||
                        Mathf.Abs(lastPlacedY - selectedTile.transform.position.y) >= tileBounds.y * spriteBounds.y)
                    {
                        GameObject tempTile = Instantiate(selectedTile);
                        tempTile.transform.SetParent(levelToEdit.transform, true);
                        lastPlacedX = selectedTile.transform.position.x;
                        lastPlacedY = selectedTile.transform.position.y;
                    }
                }
                else if (delTile)
                {
                    GameObject tempTile = GetTileUnderCurrent();
                    if (tempTile != null)
                    {
                        Destroy(tempTile);
                    }
                }
            }
            else
            {
                selectedTile.SetActive(false);
            }
        }

        if (Input.GetButtonUp("LevelEditor_PlaceTile"))
        {
            placeTile   = false;
            lastPlacedX = Mathf.Infinity;
            lastPlacedY = Mathf.Infinity;
        }
        if (Input.GetButtonUp("LevelEditor_DeleteTile"))
        {
            delTile = false;
        }
    }
示例#16
0
		/*/// <summary>
		/// Specifies whether pressing the Tab key while editing moves the 
		/// editor to the next available cell
		/// </summary>
		private bool tabMovesEditor;*/

		#endregion

		#endregion


		#region Constructor

		/// <summary>
		/// Initializes a new instance of the Table class with default settings
		/// </summary>
		public Table()
		{
			// starting setup
			this.init = true;
			
			// This call is required by the Windows.Forms Form Designer.
			components = new System.ComponentModel.Container();

			//
			this.SetStyle(ControlStyles.UserPaint, true);
			this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
			this.SetStyle(ControlStyles.DoubleBuffer, true);
			this.SetStyle(ControlStyles.ResizeRedraw, true);
			this.SetStyle(ControlStyles.Selectable, true);
			this.TabStop = true;

			this.Size = new Size(150, 150);

			this.BackColor = Color.White;

			//
			this.columnModel = null;
			this.tableModel = null;

			// header
			this.headerStyle = ColumnHeaderStyle.Clickable;
			this.headerFont = this.Font;
			this.headerRenderer = new XPHeaderRenderer();
			//this.headerRenderer = new GradientHeaderRenderer();
			//this.headerRenderer = new FlatHeaderRenderer();
			this.headerRenderer.Font = this.headerFont;
			this.headerContextMenu = new HeaderContextMenu();
			
			this.columnResizing = true;
			this.resizingColumnIndex = -1;
			this.resizingColumnWidth = -1;
			this.hotColumn = -1;
			this.pressedColumn = -1;
			this.lastSortedColumn = -1;
			this.sortedColumnBackColor = Color.WhiteSmoke;

			// borders
			this.borderStyle = BorderStyle.Fixed3D;

			// scrolling
			this.scrollable = true;

			this.hScrollBar = new HScrollBar();
			this.hScrollBar.Visible = false;
			this.hScrollBar.Location = new Point(this.BorderWidth, this.Height - this.BorderWidth - SystemInformation.HorizontalScrollBarHeight);
			this.hScrollBar.Width = this.Width - (this.BorderWidth * 2) - SystemInformation.VerticalScrollBarWidth;
			this.hScrollBar.Scroll += new ScrollEventHandler(this.OnHorizontalScroll);
			this.Controls.Add(this.hScrollBar);

			this.vScrollBar = new VScrollBar();
			this.vScrollBar.Visible = false;
			this.vScrollBar.Location = new Point(this.Width - this.BorderWidth - SystemInformation.VerticalScrollBarWidth, this.BorderWidth);
			this.vScrollBar.Height = this.Height - (this.BorderWidth * 2) - SystemInformation.HorizontalScrollBarHeight;
			this.vScrollBar.Scroll += new ScrollEventHandler(this.OnVerticalScroll);
			this.Controls.Add(this.vScrollBar);

			//
			this.gridLines = GridLines.None;;
			this.gridColor = SystemColors.Control;
			this.gridLineStyle = GridLineStyle.Solid;

			this.allowSelection = true;
			this.multiSelect = false;
			this.fullRowSelect = false;
			this.hideSelection = false;
			this.selectionBackColor = SystemColors.Highlight;
			this.selectionForeColor = SystemColors.HighlightText;
			this.unfocusedSelectionBackColor = SystemColors.Control;
			this.unfocusedSelectionForeColor = SystemColors.ControlText;
			this.selectionStyle = SelectionStyle.ListView;
			this.alternatingRowColor = Color.Transparent;

			// current table state
			this.tableState = TableState.Normal;

			this.lastMouseCell = new CellPos(-1, -1);
			this.lastMouseDownCell = new CellPos(-1, -1);
			this.focusedCell = new CellPos(-1, -1);
			this.hoverTime = 1000;
			this.trackMouseEvent = null;
			this.ResetMouseEventArgs();

			this.toolTip = new ToolTip(this.components);
			this.toolTip.Active = false;
			this.toolTip.InitialDelay = 1000;

			this.noItemsText = "There are no items in this view";

			this.editingCell = new CellPos(-1, -1);
			this.curentCellEditor = null;
			this.editStartAction = EditStartAction.DoubleClick;
			this.customEditKey = Keys.F5;
			//this.tabMovesEditor = true;

			// finished setting up
			this.beginUpdateCount = 0;
			this.init = false;
			this.preview = false;
		}
        public override void AddAttributesToRender(HtmlTextWriter writer, WebControl owner)
        {
            base.AddAttributesToRender(writer, owner);
            if (writer == null)
            {
                return;
            }

            // note: avoid calling properties multiple times
            int i = CellSpacing;

            if (i != -1)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, i.ToString(Helpers.InvariantCulture), false);
                if (i == 0)
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.BorderCollapse, "collapse");
                }
            }

            i = CellPadding;
            if (i != -1)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, i.ToString(Helpers.InvariantCulture), false);
            }

            GridLines g = GridLines;

            switch (g)
            {
            case GridLines.Horizontal:
                writer.AddAttribute(HtmlTextWriterAttribute.Rules, "rows", false);
                break;

            case GridLines.Vertical:
                writer.AddAttribute(HtmlTextWriterAttribute.Rules, "cols", false);
                break;

            case GridLines.Both:
                writer.AddAttribute(HtmlTextWriterAttribute.Rules, "all", false);
                break;
            }

            // note: avoid ToString on the enum
            switch (HorizontalAlign)
            {
            case HorizontalAlign.Left:
                writer.AddAttribute(HtmlTextWriterAttribute.Align, "left", false);
                break;

            case HorizontalAlign.Center:
                writer.AddAttribute(HtmlTextWriterAttribute.Align, "center", false);
                break;

            case HorizontalAlign.Right:
                writer.AddAttribute(HtmlTextWriterAttribute.Align, "right", false);
                break;

            case HorizontalAlign.Justify:
                writer.AddAttribute(HtmlTextWriterAttribute.Align, "justify", false);
                break;
            }
#if NET_4_0
            if (g != GridLines.None && BorderWidth.IsEmpty)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Border, "1", false);
            }
#else
            // border (=0) is always present (and base class doesn't seems to add it)
            // but border is "promoted" to 1 if gridlines are present (with BorderWidth == 0)
            if (g == GridLines.None)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Border, "0", false);
            }
            else if (BorderWidth.IsEmpty)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Border, "1", false);
            }
            else
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Border, BorderWidth.Value.ToString(Helpers.InvariantCulture));
            }
#endif
#if !NET_2_0
            string s = BackImageUrl;
            if (s.Length > 0)
            {
                if (owner != null)
                {
                    s = owner.ResolveClientUrl(s);
                }
                s = String.Concat("url(", s, ")");
                writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundImage, s);
            }
#endif
        }
示例#18
0
 public void test()
 {
     GridLines test1 = new GridLines();
     test1.GenerateXGridLines();
 }
示例#19
0
 public App()
 {
     GridLines test = new GridLines();
     test.GenerateXGridLines();
 }
 internal ChartGridLines(GridLines renderGridLinesDef, object[] styleValues, Chart chart)
 {
     m_chart = chart;
     m_renderGridLinesDef = renderGridLinesDef;
     m_styleValues        = styleValues;
 }
        private static DeclarationList CreateCurrentDeclarations()
        {
            DeclarationList declarationList = new DeclarationList();
            int             num             = 1;

            declarationList[num++] = IDOwner.GetDeclaration();
            declarationList[num++] = ReportItem.GetDeclaration();
            num++;
            declarationList[num++] = Report.GetDeclaration();
            declarationList[num++] = PageSection.GetDeclaration();
            declarationList[num++] = Line.GetDeclaration();
            declarationList[num++] = Rectangle.GetDeclaration();
            declarationList[num++] = Image.GetDeclaration();
            num++;
            declarationList[num++] = CheckBox.GetDeclaration();
            declarationList[num++] = TextBox.GetDeclaration();
            declarationList[num++] = SubReport.GetDeclaration();
            declarationList[num++] = ActiveXControl.GetDeclaration();
            declarationList[num++] = DataRegion.GetDeclaration();
            num++;
            declarationList[num++] = ReportHierarchyNode.GetDeclaration();
            declarationList[num++] = Grouping.GetDeclaration();
            declarationList[num++] = Sorting.GetDeclaration();
            declarationList[num++] = List.GetDeclaration();
            declarationList[num++] = Pivot.GetDeclaration();
            declarationList[num++] = Matrix.GetDeclaration();
            declarationList[num++] = PivotHeading.GetDeclaration();
            declarationList[num++] = MatrixHeading.GetDeclaration();
            declarationList[num++] = MatrixColumn.GetDeclaration();
            num++;
            declarationList[num++] = MatrixRow.GetDeclaration();
            num++;
            declarationList[num++] = Subtotal.GetDeclaration();
            declarationList[num++] = Table.GetDeclaration();
            declarationList[num++] = TableColumn.GetDeclaration();
            num++;
            declarationList[num++] = TableGroup.GetDeclaration();
            declarationList[num++] = TableRow.GetDeclaration();
            num++;
            declarationList[num++] = OWCChart.GetDeclaration();
            declarationList[num++] = ChartColumn.GetDeclaration();
            num++;
            declarationList[num++] = ReportItemCollection.GetDeclaration();
            declarationList[num++] = ReportItemIndexer.GetDeclaration();
            num++;
            declarationList[num++] = Style.GetDeclaration();
            num++;
            declarationList[num++] = AttributeInfo.GetDeclaration();
            declarationList[num++] = Visibility.GetDeclaration();
            declarationList[num++] = ExpressionInfo.GetDeclaration();
            num++;
            declarationList[num++] = DataAggregateInfo.GetDeclaration();
            num++;
            declarationList[num++] = RunningValueInfo.GetDeclaration();
            num++;
            num++;
            declarationList[num++] = Filter.GetDeclaration();
            num++;
            declarationList[num++] = DataSource.GetDeclaration();
            num++;
            declarationList[num++] = DataSet.GetDeclaration();
            num++;
            declarationList[num++] = ReportQuery.GetDeclaration();
            declarationList[num++] = Field.GetDeclaration();
            num++;
            declarationList[num++] = ParameterValue.GetDeclaration();
            num++;
            num++;
            num++;
            num++;
            declarationList[num++] = ReportSnapshot.GetDeclaration();
            declarationList[num++] = SenderInformation.GetDeclaration();
            declarationList[num++] = InstanceInfo.GetDeclaration();
            declarationList[num++] = ReceiverInformation.GetDeclaration();
            declarationList[num++] = InstanceInfo.GetDeclaration();
            declarationList[num++] = DocumentMapNode.GetDeclaration();
            declarationList[num++] = InfoBase.GetDeclaration();
            declarationList[num++] = OffsetInfo.GetDeclaration();
            declarationList[num++] = InstanceInfo.GetDeclaration();
            declarationList[num++] = ReportItemInstanceInfo.GetDeclaration();
            declarationList[num++] = ReportInstanceInfo.GetDeclaration();
            declarationList[num++] = ReportItemColInstanceInfo.GetDeclaration();
            declarationList[num++] = LineInstanceInfo.GetDeclaration();
            declarationList[num++] = TextBoxInstanceInfo.GetDeclaration();
            declarationList[num++] = RectangleInstanceInfo.GetDeclaration();
            declarationList[num++] = CheckBoxInstanceInfo.GetDeclaration();
            declarationList[num++] = ImageInstanceInfo.GetDeclaration();
            declarationList[num++] = SubReportInstanceInfo.GetDeclaration();
            declarationList[num++] = ActiveXControlInstanceInfo.GetDeclaration();
            declarationList[num++] = ListInstanceInfo.GetDeclaration();
            declarationList[num++] = ListContentInstanceInfo.GetDeclaration();
            declarationList[num++] = MatrixInstanceInfo.GetDeclaration();
            declarationList[num++] = MatrixHeadingInstanceInfo.GetDeclaration();
            declarationList[num++] = MatrixCellInstanceInfo.GetDeclaration();
            declarationList[num++] = TableInstanceInfo.GetDeclaration();
            declarationList[num++] = TableGroupInstanceInfo.GetDeclaration();
            declarationList[num++] = TableRowInstanceInfo.GetDeclaration();
            declarationList[num++] = OWCChartInstanceInfo.GetDeclaration();
            declarationList[num++] = ChartInstanceInfo.GetDeclaration();
            declarationList[num++] = NonComputedUniqueNames.GetDeclaration();
            declarationList[num++] = InstanceInfoOwner.GetDeclaration();
            declarationList[num++] = ReportItemInstance.GetDeclaration();
            num++;
            declarationList[num++] = ReportInstance.GetDeclaration();
            declarationList[num++] = ReportItemColInstance.GetDeclaration();
            declarationList[num++] = LineInstance.GetDeclaration();
            declarationList[num++] = TextBoxInstance.GetDeclaration();
            declarationList[num++] = RectangleInstance.GetDeclaration();
            declarationList[num++] = CheckBoxInstance.GetDeclaration();
            declarationList[num++] = ImageInstance.GetDeclaration();
            declarationList[num++] = SubReportInstance.GetDeclaration();
            declarationList[num++] = ActiveXControlInstance.GetDeclaration();
            declarationList[num++] = ListInstance.GetDeclaration();
            declarationList[num++] = ListContentInstance.GetDeclaration();
            num++;
            declarationList[num++] = MatrixInstance.GetDeclaration();
            declarationList[num++] = MatrixHeadingInstance.GetDeclaration();
            num++;
            declarationList[num++] = MatrixCellInstance.GetDeclaration();
            num++;
            num++;
            declarationList[num++] = TableInstance.GetDeclaration();
            declarationList[num++] = TableRowInstance.GetDeclaration();
            declarationList[num++] = TableColumnInstance.GetDeclaration();
            declarationList[num++] = TableGroupInstance.GetDeclaration();
            num++;
            declarationList[num++] = OWCChartInstance.GetDeclaration();
            declarationList[num++] = ParameterInfo.GetDeclaration();
            num++;
            num++;
            num++;
            declarationList[num++] = InstanceInfo.GetDeclaration();
            num++;
            declarationList[num++] = RecordSetInfo.GetDeclaration();
            declarationList[num++] = RecordRow.GetDeclaration();
            declarationList[num++] = RecordField.GetDeclaration();
            declarationList[num++] = ValidValue.GetDeclaration();
            num++;
            declarationList[num++] = ParameterDataSource.GetDeclaration();
            declarationList[num++] = ParameterDef.GetDeclaration();
            num++;
            declarationList[num++] = ParameterBase.GetDeclaration();
            num++;
            declarationList[num++] = ProcessingMessage.GetDeclaration();
            declarationList[num++] = MatrixSubtotalHeadingInstanceInfo.GetDeclaration();
            declarationList[num++] = MatrixSubtotalCellInstance.GetDeclaration();
            declarationList[num++] = CodeClass.GetDeclaration();
            num++;
            declarationList[num++] = TableDetail.GetDeclaration();
            declarationList[num++] = TableDetailInstance.GetDeclaration();
            num++;
            declarationList[num++] = TableDetailInstanceInfo.GetDeclaration();
            num++;
            declarationList[num++] = Action.GetDeclaration();
            declarationList[num++] = ActionInstance.GetDeclaration();
            declarationList[num++] = Chart.GetDeclaration();
            declarationList[num++] = ChartHeading.GetDeclaration();
            declarationList[num++] = ChartDataPoint.GetDeclaration();
            num++;
            declarationList[num++] = MultiChart.GetDeclaration();
            declarationList[num++] = MultiChartInstance.GetDeclaration();
            num++;
            declarationList[num++] = Axis.GetDeclaration();
            declarationList[num++] = AxisInstance.GetDeclaration();
            declarationList[num++] = ChartTitle.GetDeclaration();
            declarationList[num++] = ChartTitleInstance.GetDeclaration();
            declarationList[num++] = ThreeDProperties.GetDeclaration();
            declarationList[num++] = PlotArea.GetDeclaration();
            declarationList[num++] = Legend.GetDeclaration();
            declarationList[num++] = GridLines.GetDeclaration();
            declarationList[num++] = ChartDataLabel.GetDeclaration();
            declarationList[num++] = ChartInstance.GetDeclaration();
            declarationList[num++] = ChartHeadingInstance.GetDeclaration();
            declarationList[num++] = ChartHeadingInstanceInfo.GetDeclaration();
            num++;
            declarationList[num++] = ChartDataPointInstance.GetDeclaration();
            declarationList[num++] = ChartDataPointInstanceInfo.GetDeclaration();
            num++;
            num++;
            declarationList[num++] = RenderingPagesRanges.GetDeclaration();
            num++;
            declarationList[num++] = IntermediateFormatVersion.GetDeclaration();
            declarationList[num++] = ImageInfo.GetDeclaration();
            declarationList[num++] = ActionItem.GetDeclaration();
            declarationList[num++] = ActionItemInstance.GetDeclaration();
            num++;
            num++;
            declarationList[num++] = DataValue.GetDeclaration();
            declarationList[num++] = DataValueInstance.GetDeclaration();
            num++;
            num++;
            declarationList[num++] = Tablix.GetDeclaration();
            declarationList[num++] = TablixHeading.GetDeclaration();
            declarationList[num++] = CustomReportItem.GetDeclaration();
            declarationList[num++] = CustomReportItemInstance.GetDeclaration();
            declarationList[num++] = CustomReportItemHeading.GetDeclaration();
            declarationList[num++] = CustomReportItemHeadingInstance.GetDeclaration();
            num++;
            num++;
            num++;
            num++;
            declarationList[num++] = CustomReportItemCellInstance.GetDeclaration();
            num++;
            num++;
            declarationList[num++] = DataValueCRIList.GetDeclaration();
            declarationList[num++] = BookmarkInformation.GetDeclaration();
            declarationList[num++] = InstanceInfo.GetDeclaration();
            declarationList[num++] = DrillthroughInformation.GetDeclaration();
            declarationList[num++] = InstanceInfo.GetDeclaration();
            num++;
            declarationList[num++] = CustomReportItemInstanceInfo.GetDeclaration();
            declarationList[num++] = ImageMapAreaInstanceList.GetDeclaration();
            declarationList[num++] = ImageMapAreaInstance.GetDeclaration();
            num++;
            declarationList[num++] = InstanceInfo.GetDeclaration();
            declarationList[num++] = SortFilterEventInfo.GetDeclaration();
            declarationList[num++] = EndUserSort.GetDeclaration();
            num++;
            num++;
            declarationList[num++] = RecordSetPropertyNames.GetDeclaration();
            num++;
            num++;
            num++;
            declarationList[num++] = PageSectionInstance.GetDeclaration();
            num++;
            declarationList[num++] = PageSectionInstanceInfo.GetDeclaration();
            declarationList[num++] = SimpleTextBoxInstanceInfo.GetDeclaration();
            declarationList[num++] = ScopeLookupTable.GetDeclaration();
            num++;
            declarationList[num++] = ReportDrillthroughInfo.GetDeclaration();
            declarationList[num++] = InstanceInfo.GetDeclaration();
            Global.Tracer.Assert(declarationList.Count == num, "(current.Count == index)");
            return(declarationList);
        }
示例#22
0
        /// <summary>
        /// Grid coordinates:
        ///		x: "normalized" [0..1] and scaled to the area-width
        ///		y: "axis" scale
        /// </summary>
        /// <param name="icrc"></param>
        void IRequireRender.Render(IChartRenderContext icrc)
        {
            if (ValueAxis == null)
            {
                return;
            }
            if (double.IsNaN(ValueAxis.Maximum) || double.IsNaN(ValueAxis.Minimum))
            {
                return;
            }
            // grid lines
            var tc       = new TickCalculator(ValueAxis.Minimum, ValueAxis.Maximum);
            var recycler = new Recycler <Path, ItemState>(GridLines.Where(tl => tl.Element != null).Select(tl => tl.Element), (ist) => {
                return(CreateElement(ist));
            });
            var mrecycler = new Recycler <Path, ItemState>(MinorGridLines.Where(tl => tl.Element != null).Select(tl => tl.Element), (ist) => {
                return(CreateSubElement(ist));
            });
            var itemstate  = new List <ItemState>();
            var mitemstate = new List <ItemState>();
            //_trace.Verbose($"grid range:{tc.Range} tintv:{tc.TickInterval}");
            var tixarray = tc.GetTicks().ToArray();
            var sc       = new ValueAxisSelectorContext(ValueAxis, icrc.SeriesArea, tixarray, tc.TickInterval);

            for (int ix = 0; ix < tixarray.Length; ix++)
            {
                var tick = tixarray[ix];
                //_trace.Verbose($"grid vx:{tick}");
                var state = new ItemState()
                {
                    Tick = tick
                };
                var current = recycler.Next(state);
                if (!current.Item1)
                {
                    // restore binding
                    if (PathStyle != null)
                    {
                        BindTo(this, nameof(PathStyle), current.Item2, FrameworkElement.StyleProperty);
                    }
                }
                state.Element = current.Item2;
                ApplyBinding(this, nameof(Visibility), state.Element, UIElement.VisibilityProperty);
                if (PathFormatter != null)
                {
                    sc.SetTick(ix);
                    // call for Style, String override
                    var format = PathFormatter.Convert(sc, typeof(Tuple <Style, String>), null, System.Globalization.CultureInfo.CurrentUICulture.Name);
                    if (format is Tuple <Style, String> ovx)
                    {
                        if (ovx.Item1 != null)
                        {
                            current.Item2.Style = ovx.Item1;
                        }
                    }
                }
                state.SetLocation(icrc.Area.Left, tick.Value);
                sc.Generated(tick);
                itemstate.Add(state);
                if (MinorGridLineCount != 0)
                {
                    // lay out minor divisions
                    var mintv = tc.TickInterval / (double)(MinorGridLineCount + 1);
                    var diry  = Math.Sign(tick.Index);
                    if (diry == 0)
                    {
                        // special case: zero
                        for (int mx = 1; mx <= MinorGridLineCount; mx++)
                        {
                            var mtick  = new SubtickState(tick.Index, mx, tick.Value + (double)mx * mintv);
                            var mstate = CreateSubtick(icrc, mrecycler, mtick);
                            if (mstate != null)
                            {
                                mitemstate.Add(mstate);
                            }
                            var mtick2  = new SubtickState(tick.Index, -mx, tick.Value + (double)(-mx) * mintv);
                            var mstate2 = CreateSubtick(icrc, mrecycler, mtick2);
                            if (mstate2 != null)
                            {
                                mitemstate.Add(mstate2);
                            }
                        }
                    }
                    else
                    {
                        for (int mx = 1; mx <= MinorGridLineCount; mx++)
                        {
                            var mtick  = new SubtickState(tick.Index, diry * mx, tick.Value + (double)(diry * mx) * mintv);
                            var mstate = CreateSubtick(icrc, mrecycler, mtick);
                            if (mstate != null)
                            {
                                mitemstate.Add(mstate);
                            }
                        }
                    }
                }
            }
            // VT and internal bookkeeping
            MinorGridLines = mitemstate;
            GridLines      = itemstate;
            Layer.Remove(mrecycler.Unused);
            Layer.Remove(recycler.Unused);
            Layer.Add(recycler.Created);
            Layer.Add(mrecycler.Created);
            Dirty = false;
        }
示例#23
0
        public override void AddAttributesToRender(HtmlTextWriter writer, WebControl owner)
        {
            base.AddAttributesToRender(writer, owner);
            if (writer == null)
            {
                return;
            }

            // note: avoid calling properties multiple times
            int i = CellSpacing;

            if (i != -1)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, i.ToString(Helpers.InvariantCulture), false);
                if (i == 0)
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.BorderCollapse, "collapse");
                }
            }

            i = CellPadding;
            if (i != -1)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, i.ToString(Helpers.InvariantCulture), false);
            }

            GridLines g = GridLines;

            switch (g)
            {
            case GridLines.Horizontal:
                writer.AddAttribute(HtmlTextWriterAttribute.Rules, "rows", false);
                break;

            case GridLines.Vertical:
                writer.AddAttribute(HtmlTextWriterAttribute.Rules, "cols", false);
                break;

            case GridLines.Both:
                writer.AddAttribute(HtmlTextWriterAttribute.Rules, "all", false);
                break;
            }

            // note: avoid ToString on the enum
            switch (HorizontalAlign)
            {
            case HorizontalAlign.Left:
                writer.AddAttribute(HtmlTextWriterAttribute.Align, "left", false);
                break;

            case HorizontalAlign.Center:
                writer.AddAttribute(HtmlTextWriterAttribute.Align, "center", false);
                break;

            case HorizontalAlign.Right:
                writer.AddAttribute(HtmlTextWriterAttribute.Align, "right", false);
                break;

            case HorizontalAlign.Justify:
                writer.AddAttribute(HtmlTextWriterAttribute.Align, "justify", false);
                break;
            }
            if (g != GridLines.None && BorderWidth.IsEmpty)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Border, "1", false);
            }
        }
示例#24
0
//-----------------------------此函數為設定表格的外觀--------------------------------
        public static void setupTopHeaderTableStyle(Table table, string strCssStyle, int intBorderWidth, string strTableWidth, int intCellPadding, int intCellSpacing, GridLines styleGridLines, bool bIsHaveHeader)
        {
            table.CssClass    = strCssStyle;
            table.BorderWidth = Unit.Pixel(intBorderWidth);
            table.Style.Add("WIDTH", strTableWidth);
            table.CellPadding = intCellPadding;
            table.CellSpacing = intCellSpacing;
            table.GridLines   = styleGridLines;
            table.BorderColor = System.Drawing.Color.Black;

            if (table.Rows.Count > 0)
            {
                int startIndex = 0;
                if (bIsHaveHeader)
                {
                    table.Rows[0].Attributes.Add("Class", "header1_table_first_row");
                    startIndex = 1;
                }
                if (table.Rows.Count > 0)
                {
                    for (int i = startIndex; i < table.Rows.Count; i++)
                    {
                        if (i % 2 == 0)
                        {
                            table.Rows[i].Attributes.Add("Class", "header1_tr_odd_row");
                        }
                        else
                        {
                            table.Rows[i].Attributes.Add("Class", "header1_tr_even_row");
                        }
                    }
                }
            }

            /*
             * if(ta.Rows.Count != 0)
             * {
             *      if(ta.Rows.Count > 0)
             *      {
             *              ta.Attributes.Add("width", "100%");
             *              ta.Attributes.Add("Class","header1_table");
             *              //----------------------設定表格的顏色-------------------------
             *              for (int i=1 ; i<ta.Rows.Count ; i++)
             *              {
             *                      if((i % 2)!=0)
             *                      {
             *                              //ta.Rows[i].BackColor = System.Drawing.Color.LightCyan;
             *                              ta.Rows[i].Attributes.Add("Class","header1_tr_odd_row");
             *                      }
             *                      else
             *                      {
             *                              ta.Rows[i].Attributes.Add("Class","header1_tr_even_row");
             *                      }
             *              }
             *
             *              if(bTitle == true)
             *              {
             *                      ta.Rows[0].Attributes.Add("Class","header1_table_first_row");
             *              }
             *      }
             * }
             */
        }
示例#25
0
        /// <internalonly/>
        /// <devdoc>
        ///    <para> Adds information about the background
        ///       image, callspacing, cellpadding, gridlines, and alignment to the list of attributes
        ///       to render.</para>
        /// </devdoc>
        public override void AddAttributesToRender(HtmlTextWriter writer, WebControl owner)
        {
            base.AddAttributesToRender(writer, owner);

            int n = CellSpacing;

            if (n >= 0)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, n.ToString(NumberFormatInfo.InvariantInfo));
                if (n == 0)
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.BorderCollapse, "collapse");
                }
            }

            n = CellPadding;
            if (n >= 0)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, n.ToString(NumberFormatInfo.InvariantInfo));
            }

            HorizontalAlign align = HorizontalAlign;

            if (align != HorizontalAlign.NotSet)
            {
                string alignValue = "Justify";

                switch (align)
                {
                case HorizontalAlign.Left:
                    alignValue = "Left";
                    break;

                case HorizontalAlign.Center:
                    alignValue = "Center";
                    break;

                case HorizontalAlign.Right:
                    alignValue = "Right";
                    break;

                case HorizontalAlign.Justify:
                    alignValue = "Justify";
                    break;
                }
                writer.AddAttribute(HtmlTextWriterAttribute.Align, alignValue);
            }

            GridLines gridLines = GridLines;

            if (gridLines != GridLines.None)
            {
                string rules = String.Empty;
                switch (GridLines)
                {
                case GridLines.Both:
                    rules = "all";
                    break;

                case GridLines.Horizontal:
                    rules = "rows";
                    break;

                case GridLines.Vertical:
                    rules = "cols";
                    break;
                }
                writer.AddAttribute(HtmlTextWriterAttribute.Rules, rules);
            }
        }
示例#26
0
        /// <include file='doc\TableStyle.uex' path='docs/doc[@for="TableStyle.AddAttributesToRender"]/*' />
        /// <internalonly/>
        /// <devdoc>
        ///    <para> Adds information about the background
        ///       image, callspacing, cellpadding, gridlines, and alignment to the list of attributes
        ///       to render.</para>
        /// </devdoc>
        public override void AddAttributesToRender(HtmlTextWriter writer, WebControl owner)
        {
            base.AddAttributesToRender(writer, owner);

            string s = BackImageUrl;

            if (s.Length != 0)
            {
                if (owner != null)
                {
                    s = owner.ResolveClientUrl(s);
                }
                writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundImage, "url(" + s + ")");
            }

            int n = CellSpacing;

            if (n >= 0)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, n.ToString(NumberFormatInfo.InvariantInfo));
                if (n == 0)
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.BorderCollapse, "collapse");
                }
            }

            n = CellPadding;
            if (n >= 0)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, n.ToString(NumberFormatInfo.InvariantInfo));
            }

            HorizontalAlign align = HorizontalAlign;

            if (align != HorizontalAlign.NotSet)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Align, Enum.Format(typeof(HorizontalAlign), align, "G"));
            }

            GridLines gridLines = GridLines;

            if (gridLines != GridLines.None)
            {
                string rules = String.Empty;
                switch (GridLines)
                {
                case GridLines.Both:
                    rules = "all";
                    break;

                case GridLines.Horizontal:
                    rules = "rows";
                    break;

                case GridLines.Vertical:
                    rules = "cols";
                    break;
                }
                writer.AddAttribute(HtmlTextWriterAttribute.Rules, rules);
            }
        }
示例#27
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GridLinesBuilder"/> class.
 /// </summary>
 /// <param name="component">The component.</param>
 public GridLinesBuilder(GridLines component)
 {
     _component = component;
 }
示例#28
0
        public void drawGridlines()
        {
            if (Points.Count != 4)
            {
                return;
            }
            Point p1, p2, p1h, p2h;
            Line  newLine;

            double x;
            double y;

            // Vertical Lines

            x  = ((Points[0].X * 2) + Points[1].X) / 3;
            y  = ((Points[0].Y * 2) + Points[1].Y) / 3;
            p1 = new Point(x, y);

            x  = ((Points[3].X * 2) + Points[2].X) / 3;
            y  = ((Points[3].Y * 2) + Points[2].Y) / 3;
            p2 = new Point(x, y);

            newLine = createLine(p1, p2);
            GridLines.Add(newLine);

            x  = (Points[0].X + (Points[1].X) * 2) / 3;
            y  = (Points[0].Y + (Points[1].Y) * 2) / 3;
            p1 = new Point(x, y);

            x  = (Points[3].X + (Points[2].X) * 2) / 3;
            y  = (Points[3].Y + (Points[2].Y) * 2) / 3;
            p2 = new Point(x, y);

            newLine = createLine(p1, p2);
            GridLines.Add(newLine);

            // Horizontal Lines
            // Mid
            x   = (Points[1].X + Points[2].X) / 2;
            y   = (Points[1].Y + Points[2].Y) / 2;
            p1h = new Point(x, y);

            x   = (Points[0].X + Points[3].X) / 2;
            y   = (Points[0].Y + Points[3].Y) / 2;
            p2h = new Point(x, y);

            newLine = createLine(p1h, p2h);
            GridLines.Add(newLine);

            // 1/3 Top
            x  = (Points[0].X * 2 + p2h.X) / 3;
            y  = (Points[0].Y * 2 + p2h.Y) / 3;
            p1 = new Point(x, y);

            x  = (Points[1].X * 2 + p1h.X) / 3;
            y  = (Points[1].Y * 2 + p1h.Y) / 3;
            p2 = new Point(x, y);

            newLine = createLine(p1, p2);
            GridLines.Add(newLine);

            // 2/3 Top
            x  = (Points[0].X + p2h.X * 2) / 3;
            y  = (Points[0].Y + p2h.Y * 2) / 3;
            p1 = new Point(x, y);

            x  = (Points[1].X + p1h.X * 2) / 3;
            y  = (Points[1].Y + p1h.Y * 2) / 3;
            p2 = new Point(x, y);

            newLine = createLine(p1, p2);
            GridLines.Add(newLine);

            // 1/3 Bottom
            x  = (p2h.X * 2 + Points[3].X) / 3;
            y  = (p2h.Y * 2 + Points[3].Y) / 3;
            p1 = new Point(x, y);

            x  = (p1h.X * 2 + Points[2].X) / 3;
            y  = (p1h.Y * 2 + Points[2].Y) / 3;
            p2 = new Point(x, y);

            newLine = createLine(p1, p2);
            GridLines.Add(newLine);

            // 2/3 Bottom
            x  = (p2h.X + Points[3].X * 2) / 3;
            y  = (p2h.Y + Points[3].Y * 2) / 3;
            p1 = new Point(x, y);

            x  = (p1h.X + Points[2].X * 2) / 3;
            y  = (p1h.Y + Points[2].Y * 2) / 3;
            p2 = new Point(x, y);

            newLine = createLine(p1, p2);
            GridLines.Add(newLine);

            foreach (Line l in GridLines)
            {
                l.IsHitTestVisible = false;
                l.StrokeThickness  = 1.5;
            }

            isGridlinesVisible = true;
        }
示例#29
0
        public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (SkipRender(context))
            {
                return;
            }
            var dataGrid = new TagBuilder("data-grid", null, IsInGrid);

            onRender?.Invoke(dataGrid);
            MergeBindingAttributeBool(dataGrid, context, ":compact", nameof(Compact), Compact);
            MergeAttributes(dataGrid, context, MergeAttrMode.Margin | MergeAttrMode.Visibility);
            dataGrid.MergeAttribute("key", Guid.NewGuid().ToString());             // disable vue reusing
            if (Height != null)
            {
                dataGrid.MergeStyle("height", Height.Value);
            }
            if (FixedHeader)
            {
                dataGrid.MergeAttribute(":fixed-header", "true");
            }
            if (HeadersVisibility == HeadersVisibility.None)
            {
                dataGrid.MergeAttribute(":hide-header", "true");
            }
            if (Style != DataGridStyle.Default)
            {
                dataGrid.AddCssClass($"data-grid-{Style.ToString().ToKebabCase()}");
            }

            if (Background != BackgroundStyle.Default)
            {
                dataGrid.AddCssClass("background-" + Background.ToString().ToKebabCase());
            }

            if (RowDetails != null)
            {
                dataGrid.MergeAttribute(":row-details", "true");
                dataGrid.MergeAttribute("row-details-activate", RowDetails.Activate.ToString().ToLowerInvariant());
                var vBind = RowDetails.GetBinding("Visible");
                if (vBind != null)
                {
                    dataGrid.MergeAttribute("row-details-visible", vBind.Path /*!without context!*/);
                }
            }
            var isb = GetBinding(nameof(ItemsSource));

            if (isb != null)
            {
                dataGrid.MergeAttribute(":items-source", isb.GetPath(context));
            }
            MergeBoolAttributeIfExists(dataGrid, context, nameof(Hover), Hover);
            MergeBoolAttributeIfExists(dataGrid, context, nameof(Striped), Striped);
            MergeBoolAttribute(dataGrid, context, nameof(Border), Border);
            MergeBoolAttribute(dataGrid, context, nameof(Sort), Sort);
            dataGrid.MergeAttribute(":route-query", "$query");             // always!
            if (!String.IsNullOrEmpty(EmptyPanelDelegate))
            {
                dataGrid.MergeAttribute(":empty-panel-callback", $"$delegate('{EmptyPanelDelegate}')");
            }


            var dblClickBind = GetBindingCommand(nameof(DoubleClick));

            if (dblClickBind != null)
            {
                // Function!
                dataGrid.MergeAttribute(":doubleclick", "() => " + dblClickBind.GetCommand(context));
            }

            if (MarkerStyle != RowMarkerStyle.None)
            {
                dataGrid.MergeAttribute("mark-style", MarkerStyle.ToString().ToKebabCase());
            }

            var mbind = GetBinding(nameof(Mark));

            if (mbind != null)
            {
                dataGrid.MergeAttribute("mark", mbind.Path);                 // without context!!!
            }
            else if (Mark != MarkStyle.Default)
            {
                throw new XamlException("The Mark property must be a binding");
            }
            var rbbind = GetBinding(nameof(RowBold));

            if (rbbind != null)
            {
                dataGrid.MergeAttribute("row-bold", rbbind.GetPath(context));
            }
            else if (RowBold != null)
            {
                throw new XamlException("The RowBold property must be a binding");
            }

            // TODO: binding for GridLines ???
            if (GridLines != GridLinesVisibility.None)
            {
                dataGrid.MergeAttribute("grid", GridLines.ToString());
            }

            var groupByBind = GetBinding(nameof(GroupBy));

            if (groupByBind != null)
            {
                dataGrid.MergeAttribute(":group-by", groupByBind.GetPath(context));
            }
            else if (_groupBy != null)
            {
                dataGrid.MergeAttribute(":group-by", _groupBy.GetJsValue(context));
            }

            if (AutoSelect != AutoSelectMode.None)
            {
                dataGrid.MergeAttribute("auto-select", AutoSelect.ToString().ToKebabCase());
            }

            dataGrid.RenderStart(context);
            Int32 colIndex = 0;

            foreach (var col in Columns)
            {
                col.RenderColumn(context, colIndex);
                colIndex++;
            }
            RenderRowDetails(context);
            RenderEmptyPanel(context);
            RenderFooter(context);
            dataGrid.RenderEnd(context);
        }
示例#30
0
 private void Execute(KeyRoutedEventArgs e)
 {
     if (KeyModifiers == (VirtualKeyModifiers.Control | VirtualKeyModifiers.Shift) && CurrentKey == VirtualKey.N && KeyState == CoreVirtualKeyStates.Down)
     {
         ClonePage.Execute(null);
     }
     else if (KeyModifiers == VirtualKeyModifiers.Control && CurrentKey == VirtualKey.N && KeyState == CoreVirtualKeyStates.Down)
     {
         NewPage.Execute(null);
     }
     else if (KeyModifiers == (VirtualKeyModifiers.Control | VirtualKeyModifiers.Shift) && CurrentKey == VirtualKey.S && KeyState == CoreVirtualKeyStates.Down)
     {
         SaveAs.Execute(null);
     }
     else if (KeyModifiers == VirtualKeyModifiers.Control && CurrentKey == VirtualKey.S && KeyState == CoreVirtualKeyStates.Down)
     {
         Save.Execute(null);
     }
     else if (KeyModifiers == VirtualKeyModifiers.Control && CurrentKey == VirtualKey.O && KeyState == CoreVirtualKeyStates.Down)
     {
         Open.Execute(null);
     }
     else if (KeyModifiers == VirtualKeyModifiers.Control && CurrentKey == VirtualKey.L && KeyState == CoreVirtualKeyStates.Down)
     {
         Library.Execute(null);
     }
     else if (KeyModifiers == VirtualKeyModifiers.Control && CurrentKey == (VirtualKey)186 && KeyState == CoreVirtualKeyStates.Down)
     {
         GridLines.Execute(null);
     }
     else if (KeyModifiers == VirtualKeyModifiers.Control && CurrentKey == VirtualKey.U && KeyState == CoreVirtualKeyStates.Down)
     {
         SmartGuide.Execute(null);
     }
     else if (KeyModifiers == VirtualKeyModifiers.Control && CurrentKey == VirtualKey.R && KeyState == CoreVirtualKeyStates.Down)
     {
         RulerVisibility.Execute(null);
     }
     else if (KeyModifiers == (VirtualKeyModifiers.Control | VirtualKeyModifiers.Shift) && CurrentKey == VirtualKey.A && KeyState == CoreVirtualKeyStates.Down)
     {
         UnSelect.Execute(null);
     }
     else if (KeyModifiers == VirtualKeyModifiers.Control && CurrentKey == VirtualKey.Number2 && KeyState == CoreVirtualKeyStates.Down)
     {
         Lock.Execute(null);
     }
     else if (KeyModifiers == VirtualKeyModifiers.Control && CurrentKey == VirtualKey.Number3 && KeyState == CoreVirtualKeyStates.Down)
     {
         UnLock.Execute(null);
     }
     else if (KeyModifiers == VirtualKeyModifiers.Control && CurrentKey == VirtualKey.C && KeyState == CoreVirtualKeyStates.Down)
     {
         Copy.Execute(null);
         e.Handled = true;
     }
     else if (KeyModifiers == VirtualKeyModifiers.Control && CurrentKey == VirtualKey.V && KeyState == CoreVirtualKeyStates.Down)
     {
         Paste.Execute(null);
         e.Handled = true;
     }
 }
示例#31
0
 public ChartGridLines(GridLines renderGridLinesDef, object[] styleValues, Chart chart)
 {
     this.m_chart = chart;
     this.m_renderGridLinesDef = renderGridLinesDef;
     this.m_styleValues        = styleValues;
 }