示例#1
0
        public int CompareTo(object obj)
        {
            sColor val = (sColor)obj;

            if (this.isNamedColor && !val.isNamedColor)
            {
                return(1);
            }
            else if (!this.isNamedColor && val.isNamedColor)
            {
                return(-1);
            }

            if (val.pName.CompareTo(this.pName) < 0)
            {
                return(1);
            }
            else if (val.pName.Equals(this.pName))
            {
                return(0);
            }
            else
            {
                return(-1);
            }
        }
示例#2
0
 public sGraphicRectangel(sAttribute attr, bool filled, float linewidth, sColor color)
     : base(attr)
 {
     pFilled    = filled;
     pLineWidth = linewidth;
     pColor     = color;
 }
示例#3
0
        public sGraphicFont(sAttribute attr, Int32 x, Int32 y, String text, float size, sFont font, sColor color, sColor backColor, cProperty.eHAlign hAlignment, cProperty.eVAlign vAlignment)
            : base(attr)
        {
            //pAttr = attr;

            pX = x;
            pY = y;

            pText  = text;
            pSize  = size;
            pFont  = font;
            pColor = color;

            if (backColor != null)
            {
                pTranparent = false;
                pBackColor  = backColor;
            }
            else
            {
                pTranparent = true;
            }

            pHAlignment = hAlignment;
            pVAlignment = vAlignment;
        }
示例#4
0
        public sGraphicRectangel(Int32 x, Int32 y, Int32 width, Int32 height, bool filled, float linewidth, sColor color)
            : base(x, y, width, height)
        {
            //Console.WriteLine("sGraphicRectangel: " + x + ":" + y + " " + width + "x" + height);
            pFilled    = filled;
            pLineWidth = linewidth;
            pColor     = color;

            pZPosition = 1000;
        }
示例#5
0
 public sAttributeProgress(sAttribute parent, XmlNode node)
     : base(parent, node)
 {
     if (node.Attributes["backgroundColor"] != null)
     {
         pBackgroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value);
     }
     else
     {
         pBackgroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["Background"];
     }
 }
示例#6
0
            public override void PaintValue(PaintValueEventArgs pe)
            {
                // choose the right bitmap based on the value
                String g     = (String)pe.Value;
                sColor color = (sColor)cDataBase.pColors.get(g);

                // draw that bitmap onto the surface provided.
                if (color != null)
                {
                    pe.Graphics.FillRectangle(new SolidBrush(color.Color), pe.Bounds);
                }
                else
                {
                    pe.Graphics.DrawRectangle(new Pen(Color.Black, 1.0F), pe.Bounds);
                }
            }
示例#7
0
        private void init(sAttribute parent, XmlNode node)
        {
            if (node == null)
            {
                return;
            }

            myNode = node;

            _pParent = parent;

            if (node.Attributes["size"] != null)
            {
                parsePair(node.Attributes["size"].Value, parent, out pWidth, out pHeight);
            }
            else
            {
                pWidth  = parent.pWidth;
                pHeight = parent.pHeight;
            }

            if (node.Attributes["position"] != null)
            {
                String pos = node.Attributes["position"].Value;
                if (pos == "fill")
                {
                    pRelativX = 0;
                    pRelativY = 0;
                    pWidth    = parent.pWidth;
                    pHeight   = parent.pHeight;
                }
                else
                {
                    parsePair(pos, parent, out pRelativX, out pRelativY, pWidth, pHeight);
                }
            }
            else
            {
                pRelativX = 0;
                pRelativY = 0;
            }
            pAbsolutX = parent.pAbsolutX + pRelativX;
            pAbsolutY = parent.pAbsolutY + pRelativY;

            if (node.Attributes["name"] != null)
            {
                pName = node.Attributes["name"].Value.Trim();
            }
            else
            {
                pName = "";
            }

            if (node.Attributes["zPosition"] != null)
            {
                pZPosition = Convert.ToInt32(node.Attributes["zPosition"].Value.Trim());
            }
            else
            {
                pZPosition = 0;
            }

            if (node.Attributes["transparent"] != null)
            {
                pTransparent = Convert.ToUInt32(node.Attributes["transparent"].Value.Trim()) != 0;
            }
            else
            {
                pTransparent = false;
            }

            if (node.Attributes["borderWidth"] != null)
            {
                pBorderWidth = Convert.ToUInt32(node.Attributes["borderWidth"].Value.Trim());
            }
            else
            {
                pBorderWidth = 0;
            }

            if (node.Attributes["borderColor"] != null)
            {
                pBorderColor = (sColor)cDataBase.pColors.get(node.Attributes["borderColor"].Value.Trim());
            }
            else
            {
                pBorderColor = null;
            }

            pBorder = (pBorderWidth > 0 && pBorderColor != null);

            if (node.Attributes["name"] != null && node.Attributes["position"] == null && node.Attributes["size"] == null && node.Name == "screen")
            {
                pTransparent = false;
            }
        }
示例#8
0
        public sAttribute(XmlNode node)
        {
            if (node == null)
            {
                return;
            }

            myNode = node;
            if (node.Attributes["size"] != null)
            {
                pWidth  = Convert.ToInt32(node.Attributes["size"].Value.Substring(0, node.Attributes["size"].Value.IndexOf(',')).Trim());
                pHeight = Convert.ToInt32(node.Attributes["size"].Value.Substring(node.Attributes["size"].Value.IndexOf(',') + 1).Trim());
            }
            else
            {
                pWidth  = (Int32)(cDataBase.pResolution.getResolution().Xres);
                pHeight = (Int32)(cDataBase.pResolution.getResolution().Yres);
            }
            if (node.Attributes["position"] != null)
            {
                String sRelativeX = node.Attributes["position"].Value.Substring(0, node.Attributes["position"].Value.IndexOf(',')).Trim();
                if (sRelativeX.Equals("center"))
                {
                    pRelativX = (Int32)(cDataBase.pResolution.getResolution().Xres - pWidth) >> 1 /*1/2*/;
                }
                else
                {
                    pRelativX = Convert.ToInt32(sRelativeX);
                }
            }
            else//To display panels
            {
                pRelativX = 0;
            }
            pAbsolutX = pRelativX;

            if (node.Attributes["position"] != null)
            {
                String sRelativeY = node.Attributes["position"].Value.Substring(node.Attributes["position"].Value.IndexOf(',') + 1).Trim();
                if (sRelativeY.Equals("center"))
                {
                    pRelativY = (Int32)(cDataBase.pResolution.getResolution().Yres - pHeight) >> 1 /*1/2*/;
                }
                else
                {
                    pRelativY = Convert.ToInt32(sRelativeY);
                }
            }
            else// To display panels
            {
                pRelativY = 0;
            }
            pAbsolutY = pRelativY;


            if (node.Attributes["name"] != null)
            {
                pName = node.Attributes["name"].Value.Trim();
            }

            if (node.Attributes["zPosition"] != null)
            {
                pZPosition = Convert.ToInt32(node.Attributes["zPosition"].Value.Trim());
            }
            else
            {
                pZPosition = 0;
            }

            if (node.Attributes["transparent"] != null)
            {
                pTransparent = Convert.ToUInt32(node.Attributes["transparent"].Value.Trim()) != 0;
            }
            else
            {
                pTransparent = false;
            }

            if (node.Attributes["borderWidth"] != null)
            {
                pBorderWidth = Convert.ToUInt32(node.Attributes["borderWidth"].Value.Trim());
            }
            else
            {
                pBorderWidth = 0;
            }

            if (node.Attributes["borderColor"] != null)
            {
                pBorderColor = (sColor)cDataBase.pColors.get(node.Attributes["borderColor"].Value.Trim());
            }
            else
            {
                pBorderColor = (sColor)cDataBase.pColors.get("transparent");
            }

            if (pBorderWidth > 0 && pBorderColor != null)
            {
                pBorder = true;
            }
            else
            {
                pBorder = false;
            }

            if (node.Attributes["name"] != null && node.Attributes["position"] == null && node.Attributes["size"] == null && node.Name == "screen")
            {
                pTransparent = false;
            }
        }
示例#9
0
        public sAttribute(sAttribute parent, XmlNode node)
        {
            if (node == null)
            {
                return;
            }

            myNode = node;

            _pParent = parent;

            try
            {
                pWidth  = Convert.ToInt32(node.Attributes["size"].Value.Substring(0, node.Attributes["size"].Value.IndexOf(',')).Trim());
                pHeight = Convert.ToInt32(node.Attributes["size"].Value.Substring(node.Attributes["size"].Value.IndexOf(',') + 1).Trim());
            }
            catch
            {
                pWidth  = (int)cDataBase.pResolution.getResolution().Xres;
                pHeight = (int)cDataBase.pResolution.getResolution().Yres;
            }


            try
            {
                String sRelativeX = node.Attributes["position"].Value.Substring(0, node.Attributes["position"].Value.IndexOf(',')).Trim();
                if (sRelativeX.Equals("center"))
                {
                    pRelativX = (Int32)(cDataBase.pResolution.getResolution().Xres - pWidth) >> 1 /*1/2*/;
                }
                else
                {
                    pRelativX = Convert.ToInt32(sRelativeX);
                }
            } catch
            {
                pRelativX = 0;
            }
            pAbsolutX = parent.pAbsolutX + pRelativX;

            try
            {
                String sRelativeY = node.Attributes["position"].Value.Substring(node.Attributes["position"].Value.IndexOf(',') + 1).Trim();
                if (sRelativeY.Equals("center"))
                {
                    pRelativY = (Int32)(cDataBase.pResolution.getResolution().Yres - pHeight) >> 1 /*1/2*/;
                }
                else
                {
                    pRelativY = Convert.ToInt32(sRelativeY);
                }
            }
            catch
            {
                pRelativY = 0;
            }
            pAbsolutY = parent.pAbsolutY + pRelativY;


            if (node.Attributes["name"] != null)
            {
                pName = node.Attributes["name"].Value.Trim();
            }
            else
            {
                pName = "";
            }

            if (node.Attributes["zPosition"] != null)
            {
                pZPosition = Convert.ToInt32(node.Attributes["zPosition"].Value.Trim());
            }
            else
            {
                pZPosition = 0;
            }

            if (node.Attributes["transparent"] != null)
            {
                pTransparent = Convert.ToUInt32(node.Attributes["transparent"].Value.Trim()) != 0;
            }
            else
            {
                pTransparent = false;
            }

            if (node.Attributes["borderWidth"] != null)
            {
                pBorderWidth = Convert.ToUInt32(node.Attributes["borderWidth"].Value.Trim());
            }
            else
            {
                pBorderWidth = 0;
            }

            if (node.Attributes["borderColor"] != null)
            {
                pBorderColor = (sColor)cDataBase.pColors.get(node.Attributes["borderColor"].Value.Trim());
            }
            else
            {
                pBorderColor = null;
            }

            if (pBorderWidth > 0 && pBorderColor != null)
            {
                pBorder = true;
            }
            else
            {
                pBorder = false;
            }
        }
        /// <summary>
        /// ///////////////////////////////////////////////////////////////////
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="node"></param>

        public sAttributeLabel(sAttribute parent, XmlNode node)
            : base(parent, node)
        {
            pWindowStyle = (sWindowStyle)cDataBase.pWindowstyles.get();

            if (myNode.Attributes["text"] != null)
            {
                pText = myNode.Attributes["text"].Value;
            }

            if (myNode.Attributes["font"] != null)
            {
                pFont     = cDataBase.getFont(myNode.Attributes["font"].Value);
                pFontSize = pFont.Size;
            }
            else
            {
                pFont     = cDataBase.getFont("Regular");
                pFontSize = 16;
            }

            if (myNode.Attributes["backgroundColor"] != null)
            {
                pBackgroundColor = (sColor)cDataBase.pColors.get(myNode.Attributes["backgroundColor"].Value);
            }
            else if ((sColor)pWindowStyle.pColors["LabelBackground"] != null)
            {
                pBackgroundColor = (sColor)pWindowStyle.pColors["LabelBackground"];
            }
            else
            {
                pBackgroundColor = (sColor)pWindowStyle.pColors["Background"];
            }

            if (myNode.Attributes["foregroundColor"] != null)
            {
                pForegroundColor = (sColor)cDataBase.pColors.get(myNode.Attributes["foregroundColor"].Value);
            }
            else
            {
                pForegroundColor = (sColor)pWindowStyle.pColors["LabelForeground"];
            }

            if (myNode.Attributes["valign"] != null)
            {
                pValign = myNode.Attributes["valign"].Value.ToLower() == "top" ? cProperty.eVAlign.Top :
                          myNode.Attributes["valign"].Value.ToLower() == "center" ? cProperty.eVAlign.Center :
                          cProperty.eVAlign.Bottom;
            }

            if (myNode.Attributes["halign"] != null)
            {
                pHalign = myNode.Attributes["halign"].Value.ToLower() == "left" ? cProperty.eHAlign.Left :
                          myNode.Attributes["halign"].Value.ToLower() == "center" ? cProperty.eHAlign.Center :
                          cProperty.eHAlign.Right;
            }

            if (myNode.Attributes["noWrap"] != null)
            {
                pNoWrap = Convert.ToUInt32(myNode.Attributes["noWrap"].Value.ToLower()) != 0 ? true : false;
            }

            if (pText == null || pText.Length == 0)
            {
                // Show text for elements without render attribute, if they have a font attribute
                if (myNode.Attributes["font"] != null)
                {
                    if (myNode.Attributes["name"] != null && myNode.Attributes["source"] == null)
                    {
                        // show name
                        pText = myNode.Attributes["name"].Value;
                    }
                }
            }

            if (pText == null || pText.Length > 0)
            {
                if (Name.Length > 0)
                {
                    pPreviewText = cPreviewText.getText(parent.Name, Name);
                }
            }
        }
        public override void paint(object sender, System.Windows.Forms.PaintEventArgs e)
        {
            if (!pAttr.pTransparent)
            {
                //Background
                Int32 tx = (Int32)pAttr.pAbsolutX;
                Int32 ty = (Int32)pAttr.pAbsolutY;
                Int32 tw = (Int32)pAttr.pWidth;
                Int32 th = (Int32)pAttr.pHeight;

                if (((sAttributeListbox)pAttr).pBackgroundPixmap != null)
                {
                    new sGraphicImage(pAttr, ((sAttributeListbox)pAttr).pBackgroundPixmapName).paint(sender, e);
                }
                else
                {
                    new sGraphicRectangel((Int32)(tx > 0 ? tx : 0), (Int32)(ty > 0 ? ty : 0), (Int32)(tw > 0 ? tw : 0), (Int32)(th > 0 ? th : 0), true, (float)1.0, ((sAttributeListbox)pAttr).pListboxBackgroundColor).paint(sender, e);
                }
            }

            //BorderLayout
            Int32 x = pAttr.pAbsolutX, xm = pAttr.pAbsolutX + pAttr.pWidth;

            if (((sAttributeListbox)pAttr).pbpTopLeftName != null)
            {
                new sGraphicImage(pAttr,
                                  ((sAttributeListbox)pAttr).pbpTopLeftName,
                                  x - (Int32)(((sAttributeListbox)pAttr).pbpLeft != null ? ((sAttributeListbox)pAttr).pbpLeft.Width : 0),
                                  pAttr.pAbsolutY - (Int32)((sAttributeListbox)pAttr).pbpTopLeft.Height
                                  ).paint(sender, e);
                //painter.blit(tl, ePoint(x, pos.top()));
                //x += (UInt32)pAttr.pbpTopLeft.Width;
            }

            if (((sAttributeListbox)pAttr).pbpTopRightName != null)
            {
                //xm -= (UInt32)pAttr.pbpTopRight.Width;
                new sGraphicImage(pAttr,
                                  ((sAttributeListbox)pAttr).pbpTopRightName,
                                  xm + (Int32)(((sAttributeListbox)pAttr).pbpRight != null ? ((sAttributeListbox)pAttr).pbpRight.Width : 0) - (Int32)((sAttributeListbox)pAttr).pbpTopRight.Width,
                                  pAttr.pAbsolutY - (Int32)((sAttributeListbox)pAttr).pbpTopRight.Height
                                  ).paint(sender, e);
                //painter.blit(tr, ePoint(xm, pos.top()), pos);
            }

            if (((sAttributeListbox)pAttr).pbpTopName != null)
            {
                x += (Int32)(((sAttributeListbox)pAttr).pbpTopLeft != null ? ((sAttributeListbox)pAttr).pbpTopLeft.Width : 0) - (Int32)(((sAttributeListbox)pAttr).pbpLeft != null ? ((sAttributeListbox)pAttr).pbpLeft.Width : 0);
                int diff = (((sAttributeListbox)pAttr).pbpRight != null ? ((sAttributeListbox)pAttr).pbpRight.Width : 0) - (((sAttributeListbox)pAttr).pbpTopRight != null ? ((sAttributeListbox)pAttr).pbpTopRight.Width : 0);
                xm -= (Int32)(diff > 0 ? diff : -diff);
                while (x < xm)
                {
                    new sGraphicImage(pAttr,
                                      ((sAttributeListbox)pAttr).pbpTopName,
                                      x,
                                      pAttr.pAbsolutY - (Int32)((sAttributeListbox)pAttr).pbpTop.Height,
                                      xm - x,
                                      (Int32)((sAttributeListbox)pAttr).pbpTop.Height
                                      ).paint(sender, e);
                    //painter.blit(t, ePoint(x, pos.top()), eRect(x, pos.top(), xm - x, pos.height()));
                    x += (Int32)((sAttributeListbox)pAttr).pbpTop.Width;
                }
            }

            x  = pAttr.pAbsolutX;
            xm = pAttr.pAbsolutX + pAttr.pWidth;

            if (((sAttributeListbox)pAttr).pbpBottomLeftName != null)
            {
                new sGraphicImage(pAttr,
                                  ((sAttributeListbox)pAttr).pbpBottomLeftName,
                                  x - (Int32)(((sAttributeListbox)pAttr).pbpLeft != null ? ((sAttributeListbox)pAttr).pbpLeft.Width : 0),
                                  pAttr.pAbsolutY + pAttr.pHeight
                                  ).paint(sender, e);
                //painter.blit(bl, ePoint(pos.left(), pos.bottom()-bl->size().height()));
                //x += (UInt32)pAttr.pbpBottomLeft.Width;
            }

            if (((sAttributeListbox)pAttr).pbpBottomRightName != null)
            {
                //xm -= (UInt32)pAttr.pbpBottomRight.Width;
                new sGraphicImage(pAttr,
                                  ((sAttributeListbox)pAttr).pbpBottomRightName,
                                  xm + (Int32)(((sAttributeListbox)pAttr).pbpRight != null ? ((sAttributeListbox)pAttr).pbpRight.Width : 0) - (Int32)((sAttributeListbox)pAttr).pbpBottomRight.Width,
                                  pAttr.pAbsolutY + pAttr.pHeight
                                  ).paint(sender, e);
                //painter.blit(br, ePoint(xm, pos.bottom()-br->size().height()), eRect(x, pos.bottom()-br->size().height(), pos.width() - x, bl->size().height()));
            }

            if (((sAttributeListbox)pAttr).pbpBottomName != null)
            {
                x += (Int32)(((sAttributeListbox)pAttr).pbpBottomLeft != null ? ((sAttributeListbox)pAttr).pbpBottomLeft.Width : 0) - (Int32)(((sAttributeListbox)pAttr).pbpLeft != null ? ((sAttributeListbox)pAttr).pbpLeft.Width : 0);
                int diff = (((sAttributeListbox)pAttr).pbpRight != null ? ((sAttributeListbox)pAttr).pbpRight.Width : 0) - (((sAttributeListbox)pAttr).pbpBottomRight != null ? ((sAttributeListbox)pAttr).pbpBottomRight.Width : 0);
                xm -= (Int32)(diff > 0 ? diff : -diff);
                while (x < xm)
                {
                    new sGraphicImage(pAttr,
                                      ((sAttributeListbox)pAttr).pbpBottomName,
                                      x,
                                      pAttr.pAbsolutY + pAttr.pHeight,
                                      xm - x,
                                      (Int32)((sAttributeListbox)pAttr).pbpBottom.Height
                                      ).paint(sender, e);
                    //painter.blit(b, ePoint(x, pos.bottom()-b->size().height()), eRect(x, pos.bottom()-b->size().height(), xm - x, pos.height()));
                    x += (Int32)((sAttributeListbox)pAttr).pbpBottom.Width;
                }
            }

            Int32 y = 0;

            //if (pAttr.pbpTopLeft != null)
            //    y = (UInt32)pAttr.pbpTopLeft.Height;

            y += pAttr.pAbsolutY;

            Int32 ym = pAttr.pAbsolutY + pAttr.pHeight;

            //if (pAttr.pbpBottomLeft != null)
            //    ym -= (UInt32)pAttr.pbpBottomLeft.Height;

            if (((sAttributeListbox)pAttr).pbpLeftName != null)
            {
                while (y < ym)
                {
                    new sGraphicImage(pAttr,
                                      ((sAttributeListbox)pAttr).pbpLeftName,
                                      pAttr.pAbsolutX - (Int32)((sAttributeListbox)pAttr).pbpLeft.Width,
                                      y,
                                      (Int32)((sAttributeListbox)pAttr).pbpLeft.Width,
                                      ym - y
                                      ).paint(sender, e);
                    //painter.blit(l, ePoint(pos.left(), y), eRect(pos.left(), y, pos.width(), ym - y));
                    y += (Int32)((sAttributeListbox)pAttr).pbpLeft.Height;
                }
            }

            y = 0;

            //if (pAttr.pbpTopRight != null)
            //    y = (UInt32)pAttr.pbpTopRight.Height;

            y += pAttr.pAbsolutY;

            ym = pAttr.pAbsolutY + pAttr.pHeight;
            //if (pAttr.pbpBottomRight != null)
            //    ym -= (UInt32)pAttr.pbpBottomRight.Height;

            if (((sAttributeListbox)pAttr).pbpRightName != null)
            {
                while (y < ym)
                {
                    new sGraphicImage(pAttr,
                                      ((sAttributeListbox)pAttr).pbpRightName,
                                      pAttr.pAbsolutX + pAttr.pWidth,
                                      y,
                                      (Int32)((sAttributeListbox)pAttr).pbpRight.Width,
                                      ym - y
                                      ).paint(sender, e);
                    //painter.blit(r, ePoint(pos.right() - r->size().width(), y), eRect(pos.right()-r->size().width(), y, r->size().width(), ym - y));
                    y += (Int32)((sAttributeListbox)pAttr).pbpRight.Height;
                }
            }

            // scrollbar
            //painter.clip(eRect(m_scrollbar->position() - ePoint(5, 0), eSize(5, m_scrollbar->size().height())));

            // entries
            if (((sAttributeListbox)pAttr).pPreviewEntries != null)
            {
                if (((sAttributeListbox)pAttr).pPreviewEntries.Count >= 1)
                {
                    int itemHeight = ((sAttributeListbox)pAttr).pItemHeight;

                    sFont font     = null;
                    float fontSize = 0;
                    if (((sAttributeListbox)pAttr).pFont != null)
                    {
                        font     = ((sAttributeListbox)pAttr).pFont;
                        fontSize = font.Size;
                    }
                    else
                    {
                        font     = cDataBase.getFont("Regular");
                        fontSize = 20;
                    }


                    cProperty.eHAlign halign     = cProperty.eHAlign.Left;
                    cProperty.eVAlign valign     = cProperty.eVAlign.Top;
                    sColor            foreground = ((sAttributeListbox)pAttr).pListboxSelectedForegroundColor;
                    sColor            background = ((sAttributeListbox)pAttr).pListboxSelectedBackgroundColor;
                    String            entry      = ((sAttributeListbox)pAttr).pPreviewEntries[0];

                    // Selection Pixmap
                    if (((sAttributeListbox)pAttr).pSelectionPixmapName != null)
                    {
                        new sGraphicImage(null, ((sAttributeListbox)pAttr).pSelectionPixmapName, pAttr.pAbsolutX, pAttr.pAbsolutY, pAttr.pWidth, ((sAttributeListbox)pAttr).pItemHeight).paint(sender, e);
                    }
                    else
                    {
                        new sGraphicRectangel(pAttr.pAbsolutX, pAttr.pAbsolutY, pAttr.pWidth, ((sAttributeListbox)pAttr).pItemHeight, true, 1.0F, ((sAttributeListbox)pAttr).pListboxSelectedBackgroundColor).paint(sender, e);
                    }

                    if (pAttr.pTransparent)
                    {
                        new sGraphicFont(null, pAttr.pAbsolutX, pAttr.pAbsolutY, entry, fontSize, font, foreground, halign, valign).paint(sender, e);
                    }
                    else
                    {
                        new sGraphicFont(null, pAttr.pAbsolutX, pAttr.pAbsolutY, entry, fontSize, font, foreground, background == null ? new sColor(Color.Black) : background, halign, valign).paint(sender, e);
                    }

                    if (((sAttributeListbox)pAttr).pPreviewEntries.Count > 1)
                    {
                        foreground = ((sAttributeListbox)pAttr).pListboxForegroundColor;
                        background = ((sAttributeListbox)pAttr).pListboxBackgroundColor;

                        for (int i = 1; i < ((sAttributeListbox)pAttr).pPreviewEntries.Count; i++)
                        {
                            //Listen Einträge
                            if (i * itemHeight >= pAttr.pHeight)
                            {
                                // Abbrechen wenn Höhe der Listen Einträge größer als Höhe der Liste
                                break;
                            }

                            entry = ((sAttributeListbox)pAttr).pPreviewEntries[i];

                            // NonSelection Pixmap
                            if (((sAttributeListbox)pAttr).pBackgroundPixmapName != null)
                            {
                                new sGraphicImage(null, ((sAttributeListbox)pAttr).pBackgroundPixmapName, pAttr.pAbsolutX, pAttr.pAbsolutY + i * itemHeight, pAttr.pWidth, ((sAttributeListbox)pAttr).pItemHeight).paint(sender, e);
                            }
                            else
                            {
                                new sGraphicRectangel(pAttr.pAbsolutX, pAttr.pAbsolutY + i * itemHeight, pAttr.pWidth, ((sAttributeListbox)pAttr).pItemHeight, true, 1.0F, ((sAttributeListbox)pAttr).pListboxBackgroundColor).paint(sender, e);
                            }

                            if (pAttr.pTransparent)
                            {
                                new sGraphicFont(null, pAttr.pAbsolutX, pAttr.pAbsolutY + i * itemHeight, entry, fontSize, font, foreground, halign, valign).paint(sender, e);
                            }
                            else
                            {
                                new sGraphicFont(null, pAttr.pAbsolutX, pAttr.pAbsolutY + i * itemHeight, entry, fontSize, font, foreground, background == null ? new sColor(Color.Black) : background, halign, valign).paint(sender, e);
                            }
                        }
                    }
                }
                else
                {
                    // Selection Pixmap
                    if (((sAttributeListbox)pAttr).pSelectionPixmapName != null)
                    {
                        new sGraphicImage(pAttr, ((sAttributeListbox)pAttr).pSelectionPixmapName).paint(sender, e);
                    }
                    else
                    {
                        new sGraphicRectangel(pAttr.pAbsolutX, pAttr.pAbsolutY, pAttr.pWidth, ((sAttributeListbox)pAttr).pItemHeight, true, 1.0F, ((sAttributeListbox)pAttr).pListboxSelectedBackgroundColor).paint(sender, e);
                    }
                }
            }
        }
示例#12
0
        /// <summary>
        /// ///////////////////////////////////////////////////////////////////
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="node"></param>

        public sAttributeLabel(sAttribute parent, XmlNode node)
            : base(parent, node)
        {
            pWindowStyle = (sWindowStyle)cDataBase.pWindowstyles.get();

            if (myNode.Attributes["text"] != null)
            {
                pText = myNode.Attributes["text"].Value;
            }

            if (myNode.Attributes["font"] != null)
            {
                String tmpfont  = myNode.Attributes["font"].Value;
                float  size     = Convert.ToSingle(tmpfont.Substring(tmpfont.IndexOf(';') + 1));
                String fontname = tmpfont.Substring(0, tmpfont.IndexOf(';'));
                pFont     = cDataBase.getFont(fontname);
                pFontSize = size;
            }
            else
            {
                pFont     = cDataBase.getFont("Regular");
                pFontSize = 16;
            }

            if (myNode.Attributes["backgroundColor"] != null)
            {
                pBackgroundColor = (sColor)cDataBase.pColors.get(myNode.Attributes["backgroundColor"].Value);
            }
            else if ((sColor)pWindowStyle.pColors["LabelBackground"] != null)
            {
                pBackgroundColor = (sColor)pWindowStyle.pColors["LabelBackground"];
            }
            else
            {
                pBackgroundColor = (sColor)pWindowStyle.pColors["Background"];
            }

            if (myNode.Attributes["foregroundColor"] != null)
            {
                pForegroundColor = (sColor)cDataBase.pColors.get(myNode.Attributes["foregroundColor"].Value);
            }
            else
            {
                pForegroundColor = (sColor)pWindowStyle.pColors["LabelForeground"];
            }

            if (myNode.Attributes["valign"] != null)
            {
                pValign = myNode.Attributes["valign"].Value.ToLower() == "top" ? cProperty.eVAlign.Top :
                          myNode.Attributes["valign"].Value.ToLower() == "center" ? cProperty.eVAlign.Center :
                          cProperty.eVAlign.Bottom;
            }

            if (myNode.Attributes["halign"] != null)
            {
                pHalign = myNode.Attributes["halign"].Value.ToLower() == "left" ? cProperty.eHAlign.Left :
                          myNode.Attributes["halign"].Value.ToLower() == "center" ? cProperty.eHAlign.Center :
                          cProperty.eHAlign.Right;
            }

            if (myNode.Attributes["noWrap"] != null)
            {
                pNoWrap = Convert.ToUInt32(myNode.Attributes["noWrap"].Value.ToLower()) != 0 ? true : false;
            }


            if (pText == null || pText.Length > 0)
            {
                if (Name.Length > 0)
                {
                    pPreviewText = cPreviewText.getText(parent.Name, Name);
                }
            }
        }
示例#13
0
        public sAttributeListbox(sAttribute parent, XmlNode node)
            : base(parent, node)
        {
            if (node.Attributes["backgroundColor"] != null)
            {
                pListboxBackgroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value);
            }
            else
            {
                pListboxBackgroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxBackground"];
            }

            if (node.Attributes["foregroundColor"] != null)
            {
                pListboxForegroundColor = (sColor)cDataBase.pColors.get(node.Attributes["foregroundColor"].Value);
            }
            else
            {
                pListboxForegroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxForeground"];
            }

            if (myNode.Attributes["font"] != null)
            {
                pFont     = cDataBase.getFont(myNode.Attributes["font"].Value);
                pFontSize = pFont.Size;
            }

            if (myNode.Attributes["secondfont"] != null)
            {
                pFontSecond     = cDataBase.getFont(myNode.Attributes["secondfont"].Value);
                pFontSecondSize = pFontSecond.Size;
            }

            //if (node.HasChildNodes && node.FirstChild.Attributes["type"] != null && node.FirstChild.Attributes["type"].Value.ToLower() == "templatedmulticontent")
            //{
            //    String input = node.FirstChild.InnerText;
            //    Match match = Regex.Match(input, @"""itemHeight"": (\d+)");
            //    if (match.Success)
            //        pItemHeight = Int16.Parse(match.Groups[1].ToString());

            //    //MessageBox.Show(match.Groups[1].ToString());

            //}

            //if (node.Attributes["backgroundColor"] != null)
            //    pListboxSelectedBackgroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value);
            //else
            pListboxSelectedBackgroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxSelectedBackground"];

            //if (node.Attributes["backgroundColor"] != null)
            //    pListboxSelectedForegroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value);
            //else
            pListboxSelectedForegroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxSelectedForeground"];


            //if (node.Attributes["backgroundColor"] != null)
            //    pListboxMarkedBackgroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value);
            //else
            pListboxMarkedBackgroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxMarkedBackground"];

            //if (node.Attributes["backgroundColor"] != null)
            //    pListboxMarkedForegroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value);
            //else
            pListboxMarkedForegroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxMarkedForeground"];


            //if (node.Attributes["backgroundColor"] != null)
            //    pListboxMarkedAndSelectedBackgroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value);
            //else
            pListboxMarkedAndSelectedBackgroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxMarkedAndSelectedBackground"];

            //if (node.Attributes["backgroundColor"] != null)
            //    pListboxMarkedAndSelectedForegroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value);
            //else
            pListboxMarkedAndSelectedForegroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxMarkedAndSelectedForeground"];


            if (node.Attributes["backgroundPixmap"] != null)
            {
                pBackgroundPixmapName = node.Attributes["backgroundPixmap"].Value;
                try
                {
                    pBackgroundPixmap = Image.FromFile(cDataBase.getPath(pBackgroundPixmapName));
                }
                catch (FileNotFoundException)
                {
                    pBackgroundPixmap = null;
                }
            }
            if (node.Attributes["selectionPixmap"] != null)
            {
                pSelectionPixmapName = node.Attributes["selectionPixmap"].Value;
                try
                {
                    pSelectionPixmap = Image.FromFile(cDataBase.getPath(pSelectionPixmapName));
                }
                catch (FileNotFoundException)
                {
                    pSelectionPixmap = null;
                }
            }

            if (myNode.Attributes["scrollbarMode"] != null)
            {
                pScrollbarMode = myNode.Attributes["scrollbarMode"].Value.ToLower() == "showAlways".ToLower() ? cProperty.eScrollbarMode.showAlways :
                                 myNode.Attributes["scrollbarMode"].Value.ToLower() == "showOnDemand".ToLower() ? cProperty.eScrollbarMode.showOnDemand :
                                 cProperty.eScrollbarMode.showNever;
            }

            sWindowStyle style = (sWindowStyle)cDataBase.pWindowstyles.get();

            sWindowStyle.sBorderSet borderset = (sWindowStyle.sBorderSet)style.pBorderSets["bsListboxEntry"];

            if (borderset != null)
            {
                if (borderset.pbpTopLeftName.Length > 0)
                {
                    pbpTopLeftName = borderset.pbpTopLeftName;
                    pbpTopLeft     = borderset.pbpTopLeft;
                }
                if (borderset.pbpTopName.Length > 0)
                {
                    pbpTopName = borderset.pbpTopName;
                    pbpTop     = borderset.pbpTop;
                }
                if (borderset.pbpTopRightName.Length > 0)
                {
                    pbpTopRightName = borderset.pbpTopRightName;
                    pbpTopRight     = borderset.pbpTopRight;
                }


                if (borderset.pbpLeftName.Length > 0)
                {
                    pbpLeftName = borderset.pbpLeftName;
                    pbpLeft     = borderset.pbpLeft;
                }
                if (borderset.pbpRightName.Length > 0)
                {
                    pbpRightName = borderset.pbpRightName;
                    pbpRight     = borderset.pbpRight;
                }


                if (borderset.pbpBottomLeftName.Length > 0)
                {
                    pbpBottomLeftName = borderset.pbpBottomLeftName;
                    pbpBottomLeft     = borderset.pbpBottomLeft;
                }
                if (borderset.pbpBottomName.Length > 0)
                {
                    pbpBottomName = borderset.pbpBottomName;
                    pbpBottom     = borderset.pbpBottom;
                }
                if (borderset.pbpBottomRightName.Length > 0)
                {
                    pbpBottomRightName = borderset.pbpBottomRightName;
                    pbpBottomRight     = borderset.pbpBottomRight;
                }
            }


            if (node.Attributes["itemHeight"] != null)
            {
                pItemHeight = Convert.ToInt32(node.Attributes["itemHeight"].Value.Trim());
            }
            else
            if (pItemHeight == 0)
            {
                pItemHeight = 20;
            }


            String entries = cPreviewText.getText(parent.Name, Name);

            if (entries.Length > 0)
            {
                pPreviewEntries = new List <string>(entries.Split('|'));
            }
            else
            {
                for (int i = 1; i < 50; i++)
                {
                    pPreviewEntries.Add("List entry " + i);
                }
            }
        }
示例#14
0
        /// <summary>
        /// ///////////////////////////////////////////////////////////////////
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="node"></param>

        public sAttributeLabel(sAttribute parent, XmlNode node)
            : base(parent, node)
        {
            pWindowStyle = (sWindowStyle)cDataBase.pWindowstyles.get();

            if (myNode.Attributes["text"] != null)
            {
                pText = myNode.Attributes["text"].Value;
            }

            if (myNode.Attributes["font"] != null)
            {
                sFont[] fonts = cDataBase.getFonts();

                float  size     = 0;
                String fontname = "";

                String tmpfont = myNode.Attributes["font"].Value;
                try
                {
                    size      = Convert.ToSingle(tmpfont.Substring(tmpfont.IndexOf(';') + 1));
                    fontname  = tmpfont.Substring(0, tmpfont.IndexOf(';'));
                    pFont     = cDataBase.getFont(fontname);
                    pFontSize = size;
                }
                catch
                {
                    // In <fonts> suchen
                    sFont query = Array.Find(fonts, x => x.Name.Equals(tmpfont));
                    if (query != null)
                    {
                        size      = query.Size;
                        fontname  = query.FontName;
                        pFont     = cDataBase.getFont(fontname);
                        pFontSize = size;
                    }
                    else
                    {
                        MessageBox.Show("Font '" + tmpfont + "' not found!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            else
            {
                pFont     = cDataBase.getFont("Regular");
                pFontSize = 16;
            }

            if (myNode.Attributes["backgroundColor"] != null)
            {
                pBackgroundColor = (sColor)cDataBase.pColors.get(myNode.Attributes["backgroundColor"].Value);
            }
            else if ((sColor)pWindowStyle.pColors["LabelBackground"] != null)
            {
                pBackgroundColor = (sColor)pWindowStyle.pColors["LabelBackground"];
            }
            else
            {
                pBackgroundColor = (sColor)pWindowStyle.pColors["Background"];
            }

            if (myNode.Attributes["foregroundColor"] != null)
            {
                pForegroundColor = (sColor)cDataBase.pColors.get(myNode.Attributes["foregroundColor"].Value);
            }
            else
            {
                pForegroundColor = (sColor)pWindowStyle.pColors["LabelForeground"];
            }

            if (myNode.Attributes["valign"] != null)
            {
                pValign = myNode.Attributes["valign"].Value.ToLower() == "top" ? cProperty.eVAlign.Top :
                          myNode.Attributes["valign"].Value.ToLower() == "center" ? cProperty.eVAlign.Center :
                          cProperty.eVAlign.Bottom;
            }

            if (myNode.Attributes["halign"] != null)
            {
                pHalign = myNode.Attributes["halign"].Value.ToLower() == "left" ? cProperty.eHAlign.Left :
                          myNode.Attributes["halign"].Value.ToLower() == "center" ? cProperty.eHAlign.Center :
                          cProperty.eHAlign.Right;
            }

            if (myNode.Attributes["noWrap"] != null)
            {
                pNoWrap = Convert.ToUInt32(myNode.Attributes["noWrap"].Value.ToLower()) != 0 ? true : false;
            }

            if (pText == null || pText.Length == 0)
            {
                // Show text for elements without render attribute, if they have a font attribute
                if (myNode.Attributes["font"] != null)
                {
                    if (myNode.Attributes["name"] != null && myNode.Attributes["source"] == null)
                    {
                        // show name
                        pText = myNode.Attributes["name"].Value;
                    }
                }
            }

            if (pText == null || pText.Length > 0)
            {
                if (Name.Length > 0)
                {
                    pPreviewText = cPreviewText.getText(parent.Name, Name);
                }
            }
        }
示例#15
0
        public sAttributeListbox(sAttribute parent, XmlNode node)
            : base(parent, node)
        {
            if (node.Attributes["backgroundColor"] != null)
            {
                pListboxBackgroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value);
            }
            else
            {
                pListboxBackgroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxBackground"];
            }

            if (node.Attributes["foregroundColor"] != null)
            {
                pListboxForegroundColor = (sColor)cDataBase.pColors.get(node.Attributes["foregroundColor"].Value);
            }
            else
            {
                pListboxForegroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxForeground"];
            }


            //if (node.Attributes["backgroundColor"] != null)
            //    pListboxSelectedBackgroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value);
            //else
            pListboxSelectedBackgroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxSelectedBackground"];

            //if (node.Attributes["backgroundColor"] != null)
            //    pListboxSelectedForegroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value);
            //else
            pListboxSelectedForegroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxSelectedForeground"];


            //if (node.Attributes["backgroundColor"] != null)
            //    pListboxMarkedBackgroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value);
            //else
            pListboxMarkedBackgroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxMarkedBackground"];

            //if (node.Attributes["backgroundColor"] != null)
            //    pListboxMarkedForegroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value);
            //else
            pListboxMarkedForegroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxMarkedForeground"];


            //if (node.Attributes["backgroundColor"] != null)
            //    pListboxMarkedAndSelectedBackgroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value);
            //else
            pListboxMarkedAndSelectedBackgroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxMarkedAndSelectedBackground"];

            //if (node.Attributes["backgroundColor"] != null)
            //    pListboxMarkedAndSelectedForegroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value);
            //else
            pListboxMarkedAndSelectedForegroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxMarkedAndSelectedForeground"];


            if (node.Attributes["backgroundPixmap"] != null)
            {
                pBackgroundPixmapName = node.Attributes["backgroundPixmap"].Value;
                try
                {
                    pBackgroundPixmap = Image.FromFile(cDataBase.getPath(pBackgroundPixmapName));
                }
                catch (FileNotFoundException)
                {
                    pBackgroundPixmap = null;
                }
            }
            if (node.Attributes["selectionPixmap"] != null)
            {
                pSelectionPixmapName = node.Attributes["selectionPixmap"].Value;
                try
                {
                    pSelectionPixmap = Image.FromFile(cDataBase.getPath(pSelectionPixmapName));
                }
                catch (FileNotFoundException)
                {
                    pSelectionPixmap = null;
                }
            }

            if (myNode.Attributes["scrollbarMode"] != null)
            {
                pScrollbarMode = myNode.Attributes["scrollbarMode"].Value.ToLower() == "showAlways".ToLower() ? cProperty.eScrollbarMode.showAlways :
                                 myNode.Attributes["scrollbarMode"].Value.ToLower() == "showOnDemand".ToLower() ? cProperty.eScrollbarMode.showOnDemand :
                                 cProperty.eScrollbarMode.showNever;
            }

            sWindowStyle style = (sWindowStyle)cDataBase.pWindowstyles.get();

            sWindowStyle.sBorderSet borderset = (sWindowStyle.sBorderSet)style.pBorderSets["bsListboxEntry"];

            if (borderset != null)
            {
                if (borderset.pbpTopLeftName.Length > 0)
                {
                    pbpTopLeftName = borderset.pbpTopLeftName;
                    pbpTopLeft     = borderset.pbpTopLeft;
                }
                if (borderset.pbpTopName.Length > 0)
                {
                    pbpTopName = borderset.pbpTopName;
                    pbpTop     = borderset.pbpTop;
                }
                if (borderset.pbpTopRightName.Length > 0)
                {
                    pbpTopRightName = borderset.pbpTopRightName;
                    pbpTopRight     = borderset.pbpTopRight;
                }


                if (borderset.pbpLeftName.Length > 0)
                {
                    pbpLeftName = borderset.pbpLeftName;
                    pbpLeft     = borderset.pbpLeft;
                }
                if (borderset.pbpRightName.Length > 0)
                {
                    pbpRightName = borderset.pbpRightName;
                    pbpRight     = borderset.pbpRight;
                }


                if (borderset.pbpBottomLeftName.Length > 0)
                {
                    pbpBottomLeftName = borderset.pbpBottomLeftName;
                    pbpBottomLeft     = borderset.pbpBottomLeft;
                }
                if (borderset.pbpBottomName.Length > 0)
                {
                    pbpBottomName = borderset.pbpBottomName;
                    pbpBottom     = borderset.pbpBottom;
                }
                if (borderset.pbpBottomRightName.Length > 0)
                {
                    pbpBottomRightName = borderset.pbpBottomRightName;
                    pbpBottomRight     = borderset.pbpBottomRight;
                }
            }


            if (node.Attributes["itemHeight"] != null)
            {
                pItemHeight = Convert.ToInt32(node.Attributes["itemHeight"].Value.Trim());
            }
            else
            {
                pItemHeight = 20;
            }


            String entries = cPreviewText.getText(parent.Name, Name);

            if (entries.Length > 0)
            {
                pPreviewEntries = entries.Split('|');
            }
        }
示例#16
0
        public sAttributeScreen(XmlNode node)
            : base(node)
        {
            if (node == null)
            {
                return;
            }


            pZPosition = -100;

            if (node.Attributes["title"] != null)
            {
                pTitle = node.Attributes["title"].Value;
            }

            if (node.Attributes["flags"] != null)
            {
                switch (node.Attributes["flags"].Value)
                {
                case "wfNoBorder":
                    pFlags = eFlags.wfNoBorder;
                    break;

                case "wfBorder":
                default:
                    pFlags = eFlags.wfBorder;
                    break;
                }
            }

            pWindowStyle = (sWindowStyle)cDataBase.pWindowstyles.get();

            if (node.Attributes["backgroundColor"] != null)
            {
                pBackgroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value);
            }
            else if (node.Name == "screen" && node.Attributes["position"] == null)
            {
                pBackgroundColor = (sColor)cDataBase.pColors.get("transparent");
            }
            else
            {
                pBackgroundColor = (sColor)pWindowStyle.pColors["Background"];
            }

            if (node.Attributes["labelforeground"] != null)
            {
                pTitle = node.Attributes["labelforeground"].Value;
            }
            else
            {
                pLabelForegroundColor = (sColor)pWindowStyle.pColors["LabelForeground"];
            }

            pTitleFont = pWindowStyle.pFont;
            pTitleSize = pWindowStyle.pTitleSize * (((float)pTitleFont.Scale) / 100.0F);

            pTitleXOff = pWindowStyle.pXOff;
            pTitleYOff = pWindowStyle.pYOff;

            /*pbpTopLeft = ((sWindowStyle.sBorderSet)pWindowStyle.pBorderSets["bsWindow"]).pbpTopLeft;
             * pbpTop = ((sWindowStyle.sBorderSet)pWindowStyle.pBorderSets["bsWindow"]).pbpTop;
             * pbpTopRight = ((sWindowStyle.sBorderSet)pWindowStyle.pBorderSets["bsWindow"]).pbpTopRight;
             * pbpLeft = ((sWindowStyle.sBorderSet)pWindowStyle.pBorderSets["bsWindow"]).pbpLeft;
             * pbpRight = ((sWindowStyle.sBorderSet)pWindowStyle.pBorderSets["bsWindow"]).pbpRight;
             * pbpBottomLeft = ((sWindowStyle.sBorderSet)pWindowStyle.pBorderSets["bsWindow"]).pbpBottomLeft;
             * pbpBottom = ((sWindowStyle.sBorderSet)pWindowStyle.pBorderSets["bsWindow"]).pbpBottom;
             * pbpBottomRight = ((sWindowStyle.sBorderSet)pWindowStyle.pBorderSets["bsWindow"]).pbpBottomRight;*/

            sWindowStyle style = (sWindowStyle)cDataBase.pWindowstyles.get();

            sWindowStyle.sBorderSet borderset = (sWindowStyle.sBorderSet)style.pBorderSets["bsWindow"];

            if (borderset != null)
            {
                if (borderset.pbpTopLeftName.Length > 0)
                {
                    pbpTopLeftName = borderset.pbpTopLeftName;
                    pbpTopLeft     = borderset.pbpTopLeft;
                }
                if (borderset.pbpTopName.Length > 0)
                {
                    pbpTopName = borderset.pbpTopName;
                    pbpTop     = borderset.pbpTop;
                }
                if (borderset.pbpTopRightName.Length > 0)
                {
                    pbpTopRightName = borderset.pbpTopRightName;
                    pbpTopRight     = borderset.pbpTopRight;
                }


                if (borderset.pbpLeftName.Length > 0)
                {
                    pbpLeftName = borderset.pbpLeftName;
                    pbpLeft     = borderset.pbpLeft;
                }
                if (borderset.pbpRightName.Length > 0)
                {
                    pbpRightName = borderset.pbpRightName;
                    pbpRight     = borderset.pbpRight;
                }


                if (borderset.pbpBottomLeftName.Length > 0)
                {
                    pbpBottomLeftName = borderset.pbpBottomLeftName;
                    pbpBottomLeft     = borderset.pbpBottomLeft;
                }
                if (borderset.pbpBottomName.Length > 0)
                {
                    pbpBottomName = borderset.pbpBottomName;
                    pbpBottom     = borderset.pbpBottom;
                }
                if (borderset.pbpBottomRightName.Length > 0)
                {
                    pbpBottomRightName = borderset.pbpBottomRightName;
                    pbpBottomRight     = borderset.pbpBottomRight;
                }
            }
        }
示例#17
0
        public override void paint(object sender, System.Windows.Forms.PaintEventArgs e)
        {
            Graphics g = e.Graphics;

            System.Drawing.Font font = null;
            String name = "";

            try
            {
                if (pFont.FontFamily != null) //Only do this if the font is valid
                {
                    name = pFont.FontFamily.GetName(0);

                    font = new System.Drawing.Font(pFont.FontFamily, pSize, pFont.FontStyle, GraphicsUnit.Pixel);
                }
                else
                {
                    Console.WriteLine("Font painting failed! (" + pFont.Name + ")");
                }
            }
            catch (Exception error)
            {
                Console.WriteLine("Font painting failed! (" + pFont.Name + ")\n" + error);

                /*String errormessage = error.Message + ":\n\n";
                 * errormessage += error.StackTrace + "\n\n";
                 * errormessage += error.Source + "\n\n";
                 * errormessage += error.TargetSite + "\n\n";
                 * errormessage += name + "\n\n";
                 *
                 * //This message box is annoying
                 * MessageBox.Show(errormessage,
                 *  error.Message,
                 *  MessageBoxButtons.OK,
                 *  MessageBoxIcon.Information,
                 *  MessageBoxDefaultButton.Button1);*/

                return;
            }

            if (!pTranparent)
            {
                new sGraphicRectangel(pAttr, true, 1.0F, pBackColor).paint(sender, e);
            }

            StringFormat format = new StringFormat();

            // Horizontal
            if (pHAlignment == cProperty.eHAlign.Left)
            {
                format.Alignment = StringAlignment.Near;
            }
            else if (pHAlignment == cProperty.eHAlign.Center)
            {
                format.Alignment = StringAlignment.Center;
            }
            else
            {
                format.Alignment = StringAlignment.Far;
            }

            // Vertical
            //format.LineAlignment = StringAlignment.Center;

            if (pVAlignment == cProperty.eVAlign.Top)
            {
                format.LineAlignment = StringAlignment.Near;
            }
            else if (pVAlignment == cProperty.eVAlign.Center)
            {
                format.LineAlignment = StringAlignment.Center;
            }
            else
            {
                format.LineAlignment = StringAlignment.Far;
            }

            if (font != null)
            {
                SizeF StringSize = g.MeasureString(pText, font);
                if (pColor == null) //MOD
                {
                    pColor = new sColor(Properties.Settings.Default.FallbackColor);
                    if (MyGlobaleVariables.ShowMsgFallbackColor == true)
                    {
                        DialogResult dr = new DialogResult();
                        if (pAttr != null)
                        {
                            dr = MessageBox.Show(fMain.GetTranslation("Using 'fallback color' for: '") + pAttr.Name + "'" + Environment.NewLine + Environment.NewLine +
                                                 fMain.GetTranslation("Show this message again?"), fMain.GetTranslation("Information"), MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                        }
                        else
                        {
                            dr = MessageBox.Show(fMain.GetTranslation("Using 'fallback color'") + Environment.NewLine + Environment.NewLine +
                                                 fMain.GetTranslation("Show this message again?"), fMain.GetTranslation("Information"), MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                        }

                        if (dr == DialogResult.No)
                        {
                            MyGlobaleVariables.ShowMsgFallbackColor = false;
                        }
                    }
                }


                Color penColor = pColor.Color;
                if (cProperties.getPropertyBool("enable_alpha"))
                {
                    penColor = pColor.ColorAlpha;
                }

                //int x = pX;
                int y = pY;

                float height = pHeight;

                if (pAttr != null && pAttr.GetType() == typeof(sAttributeLabel) && ((sAttributeLabel)pAttr).noWrap)
                {
                    height = StringSize.Height < pHeight ? StringSize.Height : pHeight;
                    if (pVAlignment == cProperty.eVAlign.Center)
                    {
                        y += (pHeight - (Int32)StringSize.Height) / 2;
                    }
                    else if (pVAlignment == cProperty.eVAlign.Bottom)
                    {
                        y += (pHeight - (Int32)StringSize.Height);
                    }
                }

                g.DrawString(pText,
                             font,
                             new SolidBrush(penColor),
                             new RectangleF(pX, y, pWidth, height),
                             format);
            }
        }