예제 #1
0
        /// <summary>
        /// Initializes a new instance of the CellRenderer class with default settings
        /// </summary>
        protected CellRenderer() : base()
        {
            this.format = "";

            this.grayTextBrush = new SolidBrush(SystemColors.GrayText);
            this.padding       = CellPadding.Empty;
        }
예제 #2
0
        /// <summary>
        /// Raises the MouseEnter event
        /// </summary>
        /// <param name="e">A CellMouseEventArgs that contains the event data</param>
        public virtual void OnMouseEnter(CellMouseEventArgs e)
        {
            this.Bounds = e.CellRect;

            if (e.Cell == null)
            {
                this.Padding = CellPadding.Empty;
            }
            else
            {
                this.Padding = e.Cell.Padding;
            }

            bool tooltipActive = e.Table.ToolTip.Active;

            if (tooltipActive)
            {
                e.Table.ToolTip.Active = false;
            }

            e.Table.ResetMouseEventArgs();

            e.Table.ToolTip.SetToolTip(e.Table, e.Cell.ToolTipText);

            if (tooltipActive)
            {
                e.Table.ToolTip.Active = true;
            }
        }
예제 #3
0
 /// <summary>
 /// Initializes a new instance of the CellStyle class with default settings
 /// </summary>
 public CellStyle()
 {
     this.backColor = new Color( 0, 0, 1 );
     this.foreColor = new Color( 0, 0, 1 );
     this.font      = null;
     this.padding   = CellPadding.Empty;
 }
예제 #4
0
        /// <summary>
        /// Initializes a new instance of the CellRenderer class with default settings
        /// </summary>
        protected CellRenderer() : base()
        {
            this.format         = "";
            this.formatProvider = System.Globalization.CultureInfo.CurrentUICulture;

            this.grayTextBrush = new SolidBrush(SystemColors.GrayText);
            this.padding       = CellPadding.Empty;
        }
예제 #5
0
파일: Table.cs 프로젝트: tianzhifeng/EPC
        public override string Render()
        {
            string html = "<table {0}>{1}</table>";
            string attr = this.getAttr();

            attr += " border=\"" + this.Border.ToString() + "\" cellpadding=\"" + CellPadding.ToString() + "\" cellspacing=\"" + CellSpacing.ToString() + "\"";
            string childControlHtml = this.renderChildControl();

            return(String.Format(html, attr, childControlHtml));
        }
예제 #6
0
        /// <summary>
        /// Raises the PaintCell event
        /// </summary>
        /// <param name="e">A PaintCellEventArgs that contains the event data</param>
        public virtual void OnPaintCell(PaintCellEventArgs e)
        {
            this.Bounds = e.CellRect;

            if (e.Cell != null)
            {
                this.Padding = e.Cell.Padding;

                // Cell settings supercede Column/Row settings

                bool alignmentSet     = false;
                bool lineAlignmentSet = false;
                if (e.Cell.CellStyle != null)
                {
                    CellStyle style = e.Cell.CellStyle;
                    if (style.IsAlignmentSet)
                    {
                        alignmentSet   = true;
                        this.Alignment = style.Alignment;
                    }
                    if (style.IsLineAlignmentSet)
                    {
                        lineAlignmentSet   = true;
                        this.LineAlignment = style.LineAlignment;
                    }
                }

                if (!alignmentSet)
                {
                    this.Alignment = e.Table.ColumnModel.Columns[e.Column].Alignment;
                }
                if (!lineAlignmentSet)
                {
                    this.LineAlignment = e.Table.TableModel.Rows[e.Row].Alignment;
                }

                this.Format = e.Table.ColumnModel.Columns[e.Column].Format;

                this.Font = e.Cell.Font;
            }
            else
            {
                this.Padding       = CellPadding.Empty;
                this.Alignment     = ColumnAlignment.Left;
                this.LineAlignment = RowAlignment.Center;
                this.Format        = string.Empty;
                this.Font          = null;
            }

            // paint the Cells background
            this.OnPaintBackground(e);

            // paint the Cells foreground
            this.OnPaint(e);
        }
예제 #7
0
        /// <summary>
        /// Raises the MouseMove event
        /// </summary>
        /// <param name="e">A CellMouseEventArgs that contains the event data</param>
        public virtual void OnMouseMove(CellMouseEventArgs e)
        {
            this.Bounds = e.CellRect;

            if (e.Cell == null)
            {
                this.Padding = CellPadding.Empty;
            }
            else
            {
                this.Padding = e.Cell.Padding;
            }
        }
예제 #8
0
        /// <summary>
        /// Initializes a new instance of the CellRenderer class with default settings
        /// </summary>
        protected CellRenderer()
            : base()
        {
            this.format = string.Empty;

            // this.formatProvider was initialised using System.Globalization.CultureInfo.CurrentUICulture,
            // but this means formatProvider can be set to a Neutral Culture which does not cantain Numberic
            // and DateTime formatting information.  System.Globalization.CultureInfo.CurrentCulture is
            // guaranteed to include this formatting information and thus avoids crashes during formatting.
            this.formatProvider = System.Globalization.CultureInfo.CurrentCulture;

            this.grayTextBrush = new SolidBrush(SystemColors.GrayText);
            this.padding       = CellPadding.Empty;
        }
예제 #9
0
        /// <summary>
        /// Raises the LostFocus event
        /// </summary>
        /// <param name="e">A CellFocusEventArgs that contains the event data</param>
        public virtual void OnLostFocus(CellFocusEventArgs e)
        {
            this.Bounds = e.CellRect;

            if (e.Cell == null)
            {
                this.Padding = CellPadding.Empty;
            }
            else
            {
                this.Padding = e.Cell.Padding;
            }

            e.Table.Invalidate(e.CellRect);
        }
예제 #10
0
        /// <summary>
        /// Raises the MouseEnter event
        /// </summary>
        /// <param name="e">A CellMouseEventArgs that contains the event data</param>
        public virtual void OnMouseEnter(CellMouseEventArgs e)
        {
            this.Bounds = e.CellRect;

            this.Padding = e.Cell == null ? CellPadding.Empty : e.Cell.Padding;

            bool tooltipActive = e.Table.ToolTip.Active;

            if (tooltipActive)
            {
                e.Table.ToolTip.Active = false;
            }

            e.Table.ResetMouseEventArgs();

            if (tooltipActive)
            {
                if (e.Cell != null)
                {
                    CellToolTipEventArgs args = new CellToolTipEventArgs(e.Cell, new Point(e.X, e.Y));

                    // The default tooltip is to show the full text for any cell that has been truncated
                    if (e.Cell.IsTextTrimmed)
                    {
                        args.ToolTipText = e.Cell.Text;
                    }

                    // Allow the outside world to modify the text or cancel this tooltip
                    e.Table.OnCellToolTipPopup(args);

                    // Even if this tooltip has been cancelled we need to get rid of the old tooltip
                    if (args.Cancel)
                    {
                        e.Table.ToolTip.SetToolTip(e.Table, string.Empty);
                    }
                    else
                    {
                        e.Table.ToolTip.SetToolTip(e.Table, args.ToolTipText);
                    }
                }
                else
                {
                    e.Table.ToolTip.SetToolTip(e.Table, string.Empty);
                }
                e.Table.ToolTip.Active = true;
            }
        }
예제 #11
0
        /// <summary>
        /// Render the <see cref="Panel"/> to the output parameter specified.
        /// </summary>
        /// <param name="output">Output stream that contains the HTML used to represent the <see cref="Panel"/>.</param>
        protected override void Render(HtmlTextWriter output)
        {
            output.Write("<div>");

            if (this.BorderStyle != System.Web.UI.WebControls.BorderStyle.NotSet)
            {
                output.AddStyleAttribute(HtmlTextWriterStyle.BorderStyle, this.BorderStyle.ToString());
                output.AddStyleAttribute(HtmlTextWriterStyle.BorderWidth, this.BorderWidth.ToString());
                output.AddStyleAttribute(HtmlTextWriterStyle.BorderColor, Utils.Color2Hex(this.BorderColor));
            }

            if (this.BackColor != Color.Empty)
            {
                output.AddStyleAttribute(HtmlTextWriterStyle.BorderColor, Utils.Color2Hex(this.BackColor));
            }

            if (Height.Value > 0)
            {
                output.AddAttribute(HtmlTextWriterAttribute.Height, Height.ToString());
            }

            if (Width.Value > 0)
            {
                output.AddAttribute(HtmlTextWriterAttribute.Width, Width.ToString());
            }

            output.AddAttribute(HtmlTextWriterAttribute.Cellspacing, CellSpacing.ToString());
            output.AddAttribute(HtmlTextWriterAttribute.Cellpadding, CellPadding.ToString());

            output.RenderBeginTag(HtmlTextWriterTag.Table);             // Open TABLE 1

            foreach (Panel panel in _panels)
            {
                output.RenderBeginTag(HtmlTextWriterTag.Tr);
                output.RenderBeginTag(HtmlTextWriterTag.Td);
                panel.ScriptDirectory = ScriptDirectory;
                panel.ExternalScript  = ExternalScript;
                panel.ImagesDirectory = ImagesDirectory;
                panel.RenderControl(output);
                output.RenderEndTag();
                output.RenderEndTag();
            }
            output.RenderEndTag();             // Close TABLE 1

            output.Write("</div>");
        }
예제 #12
0
        /// <summary>
        /// Raises the DoubleClick event
        /// </summary>
        /// <param name="e">A CellMouseEventArgs that contains the event data</param>
        public virtual void OnDoubleClick(CellMouseEventArgs e)
        {
            this.Bounds = e.CellRect;

            if (e.Cell == null)
            {
                this.Padding = CellPadding.Empty;
            }
            else
            {
                this.Padding = e.Cell.Padding;
            }

            if (e.Table.EditStartAction == EditStartAction.DoubleClick && e.Table.IsCellEditable(e.CellPos))
            {
                e.Table.EditCell(e.CellPos);
            }
        }
예제 #13
0
        /// <summary>
        /// Raises the MouseDown event
        /// </summary>
        /// <param name="e">A CellMouseEventArgs that contains the event data</param>
        public virtual void OnMouseDown(CellMouseEventArgs e)
        {
            if (!e.Table.Focused)
            {
                if (!(e.Table.IsEditing && e.Table.EditingCell == e.CellPos && e.Table.EditingCellEditor is IEditorUsesRendererButtons))
                {
                    e.Table.Focus();
                }
            }

            this.Bounds = e.CellRect;

            if (e.Cell == null)
            {
                this.Padding = CellPadding.Empty;
            }
            else
            {
                this.Padding = e.Cell.Padding;
            }
        }
예제 #14
0
        /// <summary>
        /// Raises the PaintCell event
        /// </summary>
        /// <param name="e">A PaintCellEventArgs that contains the event data</param>
        public virtual void OnPaintCell(PaintCellEventArgs e)
        {
            this.Bounds = e.CellRect;

            if (e.Cell != null)
            {
                this.Padding = e.Cell.Padding;

                this.Alignment     = e.Table.ColumnModel.Columns[e.Column].Alignment;
                this.LineAlignment = e.Table.TableModel.Rows[e.Row].Alignment;

                this.Format = e.Table.ColumnModel.Columns[e.Column].Format;

                this.Font = e.Cell.Font;
            }
            else
            {
                this.Padding = CellPadding.Empty;

                this.Alignment     = ColumnAlignment.Left;
                this.LineAlignment = RowAlignment.Center;

                this.Format = "";

                this.Font = null;
            }

            // if the font is null, use the default font
            if (this.Font == null)
            {
                this.Font = Control.DefaultFont;
            }

            // paint the Cells background
            this.OnPaintBackground(e);

            // paint the Cells foreground
            this.OnPaint(e);
        }
예제 #15
0
        /// <summary>
        /// Render this control to the output parameter specified.
        /// </summary>
        /// <param name="output"> The HTML writer to write out to </param>
        protected override void Render(HtmlTextWriter output)
        {
            DojoSeminar seminar = new DojoSeminar(seminarID);

            output.Write("<table id=\"{0}\"", UniqueID);

            if (!CellPadding.IsEmpty)
            {
                output.Write(" CellPadding=\"{0}\"", CellPadding.ToString());
            }
            if (!CellSpacing.IsEmpty)
            {
                output.Write(" CellPadding=\"{0}\"", CellSpacing.ToString());
            }
            output.Write(" border=\"0\"");
            output.Write(" width=\"100%\"");
            output.Write(">");

            // Output Title
            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            if (subtitleCssClass != "")
            {
                output.WriteAttribute("class", subtitleCssClass);
            }
            output.WriteLine(HtmlTextWriter.TagRightChar);
            output.Write(seminar.Name);
            output.WriteEndTag("td");
            output.WriteEndTag("tr");

            // Output Subtitle
            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            if (subtitleCssClass != "")
            {
                output.WriteAttribute("class", subtitleCssClass);
            }
            output.WriteLine(HtmlTextWriter.TagRightChar);
            output.Write(seminar.Description);
            output.WriteEndTag("td");
            output.WriteEndTag("tr");

            // Output Dates
            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            if (datesCssClass != "")
            {
                output.WriteAttribute("class", datesCssClass);
            }
            output.WriteLine(HtmlTextWriter.TagRightChar);
            output.Write(seminar.ConstructDateLongString());
            output.WriteEndTag("td");
            output.WriteEndTag("tr");

            // Output Menu
            if (seminar.RegistrationEnabled)
            {
                output.WriteFullBeginTag("tr");
                output.WriteBeginTag("td");
                if (menuCssClass != "")
                {
                    output.WriteAttribute("class", menuCssClass);
                }
                output.WriteLine(HtmlTextWriter.TagRightChar);
                output.WriteBeginTag("a");
                output.WriteAttribute("href", Page.ResolveUrl(string.Format(registrationUrlFormat, seminar.ID)));
                output.Write(HtmlTextWriter.TagRightChar);
                output.Write("Register");
                output.WriteEndTag("a");
                output.WriteEndTag("td");
                output.WriteEndTag("tr");
            }

            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            output.Write(HtmlTextWriter.TagRightChar);

            if (seminar.DetailsOverrideUrl.Length > 0)
            {
                try
                {
                    HttpContext.Current.Server.Execute(seminar.DetailsOverrideUrl, output);
                }
                catch
                {
                    if (errorPath != null)
                    {
                        HttpContext.Current.Server.Execute(errorPath, output);
                    }
                    else
                    {
                        output.Write("Could not find overriden details for seminar!");
                    }
                }
            }
            else if (seminar.Details.Length > 0)
            {
                output.Write(seminar.Details);
            }
            else
            {
                output.Write("<b>No details were specified for this seminar.</b>");
            }

            output.WriteEndTag("td");
            output.WriteEndTag("tr");
            output.WriteEndTag("table");
        }