Ejemplo n.º 1
0
        public VCImage(VisualControl parent, int shiftX, int shiftY, BitmapList bitmapList, int imageIndex) : base(parent, shiftX, shiftY)
        {
            BitmapList = bitmapList;
            ImageIndex = imageIndex;

            labelCost = new VCLabelM2(this, 0, Height - 12, Program.formMain.fontSmallC, FormMain.Config.CommonCost, 16, "");
            labelCost.StringFormat.LineAlignment = StringAlignment.Far;
            labelCost.Visible    = false;// Текст перекрывается иконкой. Поэтому рисуем вручную
            labelCost.ManualDraw = true;

            shiftlabelLevel = bitmapList.Size >= 128 ? FormMain.Config.GridSize : 6;
            labelLevel      = new VCLabelM2(this, 0, shiftlabelLevel - 2, Program.formMain.fontMedCaptionC, FormMain.Config.CommonLevel, 16, "");
            labelLevel.StringFormat.LineAlignment = StringAlignment.Near;
            labelLevel.StringFormat.Alignment     = StringAlignment.Far;
            labelLevel.Visible    = false;
            labelLevel.ManualDraw = true;

            labelQuantity = new VCLabelM2(this, 0, FormMain.Config.GridSize, Program.formMain.fontMedCaptionC, FormMain.Config.CommonQuantity, 16, "");
            labelQuantity.StringFormat.LineAlignment = StringAlignment.Far;
            labelQuantity.StringFormat.Alignment     = StringAlignment.Far;
            labelQuantity.Visible    = false;
            labelQuantity.ManualDraw = true;

            labelPopupQuantity = new VCLabelM2(this, 0, 0, Program.formMain.fontSmall, FormMain.Config.CommonPopupQuantity, sizePopupBackground, "");
            labelPopupQuantity.StringFormat.LineAlignment = StringAlignment.Center;
            labelPopupQuantity.StringFormat.Alignment     = StringAlignment.Center;
            labelPopupQuantity.Width      = sizePopupBackground;
            labelPopupQuantity.Visible    = false;
            labelPopupQuantity.ManualDraw = true;

            brushPopupQuantity = new SolidBrush(FormMain.Config.CommonPopupQuantityBack);

            ValidateSize();
        }
        public VCTabControl(VisualControl parent, int shiftX, int shiftY, BitmapList bitmapList) : base(parent, shiftX, shiftY)
        {
            BitmapList = bitmapList;
            ActivePage = -1;

            lblCaptionPage = new VCLabelM2(this, 0, BitmapList.Size + FormMain.Config.GridSize, Program.formMain.fontSmallBC, FormMain.Config.CommonCaptionPage, 24, "");
            lblCaptionPage.StringFormat.LineAlignment = StringAlignment.Center;
            lblCaptionPage.ShowBorder = true;
            lblCaptionPage.Color      = Color.LightGreen;
        }
Ejemplo n.º 3
0
        public BitmapList(BitmapList fromList, int newSize, int borderWidth, Bitmap mask)
        {
            if (mask != null)
            {
                Debug.Assert(mask.Width == newSize);
                Debug.Assert(mask.Height == newSize);
            }

            Debug.Assert(newSize < fromList.Size);

            Size         = newSize;
            WithDisabled = fromList.WithDisabled;
            WithOver     = fromList.WithOver;
            CreateArrays(fromList.Count);

            for (int i = 0; i < fromList.Count; i++)
            {
                ReplaceImageWithResize(fromList, i, borderWidth, mask);
            }
        }
Ejemplo n.º 4
0
        public VCFormPage(VisualControl parent, int shiftX, int shiftY, List <VCFormPage> list, BitmapList bitmapList, int imageIndex, string caption, EventHandler onClick) : base(parent, shiftX, shiftY, bitmapList, imageIndex)
        {
            UseFilter           = false;
            HighlightUnderMouse = true;
            Caption             = caption;

            Page = new VisualControl()
            {
                Visible = false
            };
            Page.Click += Page_Click;
            Click      += onClick;

            listPages   = list;
            indexInList = listPages.Count;
            listPages.Add(this);

            ArrangeControls();
        }
 public VCIconButton(VisualControl parent, int shiftX, int shiftY, BitmapList bitmapList, int imageIndex) : base(parent, shiftX, shiftY, bitmapList, imageIndex)
 {
     UseFilter = true;
     //HighlightUnderMouse = true;
 }
Ejemplo n.º 6
0
 public VCMenuCell(VisualControl parent, int shiftX, int shiftY, BitmapList bitmapList) : base(parent, shiftX, shiftY, bitmapList, -1)
 {
     UseFilter = true;
 }
Ejemplo n.º 7
0
 public VCTabButton(VisualControl parent, int shiftX, int shiftY, BitmapList bitmapList, int imageIndex) : base(parent, shiftX, shiftY, bitmapList, imageIndex)
 {
     HighlightUnderMouse = true;
 }
        internal override void Draw(Graphics g)
        {
            Debug.Assert(Width > 0);

            if (Visible || ManualDraw)
            {
                if ((BitmapList != null) && (ImageIndex >= 0))
                {
                    BitmapList.DrawImage(g, ImageIndex, ImageIsEnabled, ImageIsOver, Left + ShiftImage.X, Top + ShiftImage.Y);
                }

                if (Text.Length > 0)
                {
                    if ((preparedText != Text) || (preparedColor != Color))
                    {
                        bmpPreparedText?.Dispose();
                        bmpPreparedText = Font.GetBitmap(Text, Color);
                        preparedText    = Text;
                        preparedColor   = Color;
                    }
                }
            }

            base.Draw(g);

            if (Visible || ManualDraw)
            {
                if (Text.Length > 0)
                {
                    int x;
                    int y;
                    switch (StringFormat.Alignment)
                    {
                    case StringAlignment.Near:
                        x = Left;
                        break;

                    case StringAlignment.Center:
                        x = Left + ((Width - bmpPreparedText.Width) / 2);
                        break;

                    default:
                        x = Left + Width - bmpPreparedText.Width;
                        break;
                    }

                    Debug.Assert(x >= Left);

                    switch (StringFormat.LineAlignment)
                    {
                    case StringAlignment.Near:
                        y = Top;
                        break;

                    case StringAlignment.Center:
                        y = Top + ((Height - bmpPreparedText.Height) / 2);
                        break;

                    default:
                        y = Top + Height - bmpPreparedText.Height;
                        break;
                    }
                    //Debug.Assert(y >= Top);

                    Debug.Assert(bmpPreparedText.Width + LeftMargin <= Width, $"Текст {Text} занимает {bmpPreparedText.Width} пикселей (LeftMargin {LeftMargin}), не вмещаясь в {Width}.");

                    g.DrawImageUnscaled(bmpPreparedText, x + LeftMargin, y + TopMargin);
                }
            }
        }