예제 #1
0
        private void afterSelected()
        {
            string ret = "";

            foreach (RadItem ri in this.Items)
            {
                RadCheckComboBoxItem chkcbx = ri as RadCheckComboBoxItem;
                if (chkcbx == null)
                {
                    return;
                }

                FillPrimitive fp = ri.Children[0] as FillPrimitive;
                TextPrimitive tp = ri.Children[2].Children[1].Children[0] as TextPrimitive;

                ret += chkcbx.Text
                       //+ ",Active=" + chkcbx.Active
                       //+ ",IsMouseOver=" + chkcbx.IsMouseOver
                       //+ ",BackColor=" + chkcbx.BackColor.ToString()
                       + ",FillPrimitive.BackColor=" + fp.BackColor.ToString()
                       + ",FillPrimitive.Visibility=" + fp.Visibility.ToString()
                       + ",FillPrimitive.Bounds=" + fp.Bounds.ToString()
                       //+ ",FillPrimitive.ForeColor=" + fp.ForeColor.ToString()
                       //+ ",TextPrimitive.BackColor=" + tp.BackColor.ToString()
                       + ",TextPrimitive.ForeColor=" + tp.ForeColor.ToString()
                       + ";\r\n";
            }

            System.Diagnostics.Debug.WriteLine(ret);
        }
예제 #2
0
        private void setSelectedColor(RadItem selectedItem)
        {
            foreach (RadItem ri in this.ComboBoxElement.ListBoxElement.Items)
            {
                if (ri == selectedItem)
                {
                    FillPrimitive fp = ri.Children[0] as FillPrimitive;
                    fp.Visibility    = ElementVisibility.Visible;
                    fp.GradientStyle = GradientStyles.Linear;
                    //fp.BackColor = Color.Orange;
                    fp.BackColor  = Color.FromArgb(245, 201, 154);
                    fp.BackColor2 = Color.FromArgb(250, 174, 96);
                    fp.BackColor3 = Color.FromArgb(248, 142, 42);
                    fp.BackColor4 = Color.FromArgb(250, 193, 101);

                    BorderPrimitive bp = ri.Children[1] as BorderPrimitive;
                    bp.Visibility = ElementVisibility.Hidden;

                    TextPrimitive tp = ri.Children[2].Children[1].Children[0] as TextPrimitive;
                    tp.ForeColor = Color.Black;
                }
                else
                {
                    FillPrimitive fp = ri.Children[0] as FillPrimitive;
                    //fp.BackColor = Color.White;
                    fp.Visibility = ElementVisibility.Hidden;

                    BorderPrimitive bp = ri.Children[1] as BorderPrimitive;
                    bp.Visibility = ElementVisibility.Hidden;

                    TextPrimitive tp = ri.Children[2].Children[1].Children[0] as TextPrimitive;
                    tp.ForeColor = Color.Black;
                }
            }
        }
예제 #3
0
        private bool CheckTextPrimitive(TextPrimitive primitive, string fontFamily, double fontSize,
                                        FontStyle fontStyle, FontWeight fontWeight)
        {
            do
            {
                if (!MathEx.AmostEqual(primitive.FontSize, fontSize))
                {
                    break;
                }

                if (primitive.FontFamily != fontFamily)
                {
                    break;
                }

                if (primitive.FontStyle != fontStyle)
                {
                    break;
                }

                if (primitive.FontWeight != fontWeight)
                {
                    break;
                }

                //
                return(false);
            } while (false);

            return(true);
        }
예제 #4
0
        protected override void CreateChildElements()
        {
            base.CreateChildElements();
            this.captionText               = new TextPrimitive();
            this.captionText.Class         = "TitleCaption";
            this.captionText.TextAlignment = ContentAlignment.MiddleCenter;
            int num1 = (int)this.captionText.SetValue(RibbonBarCaptionLayoutPanel.CaptionTextProperty, (object)true);
            int num2 = (int)this.captionText.BindProperty(TextPrimitive.TextProperty, (RadObject)this, RadItem.TextProperty, PropertyBindingOptions.OneWay);

            this.ribbonTextAndContextGroupPanel = new RibbonBarCaptionLayoutPanel();
            this.ribbonTextAndContextGroupPanel.Children.Add((RadElement)this.captionText);
            this.Children.Add((RadElement)this.ribbonTextAndContextGroupPanel);
            this.systemButtons                     = new StackLayoutElement();
            this.systemButtons.Orientation         = Orientation.Horizontal;
            this.systemButtons.StretchHorizontally = false;
            this.systemButtons.StretchVertically   = true;
            this.systemButtons.FitInAvailableSize  = true;
            this.systemButtons.Class               = "SystemButtonsContainer";
            this.Children.Add((RadElement)this.systemButtons);
            this.helpButton = new RadImageButtonElement();
            this.helpButton.StateManager            = new RibbonBarSystemButtonStateManager().StateManagerInstance;
            this.helpButton.ThemeRole               = "RibbonHelpButton";
            this.helpButton.Class                   = "HelpButton";
            this.helpButton.Click                  += new EventHandler(this.OnHelpButtonClick);
            this.helpButton.ButtonFillElement.Class = "CaptionButtonFill";
            this.helpButton.BorderElement.Class     = "CaptionButtonBorder";
            this.helpButton.StretchHorizontally     = false;
            this.helpButton.Visibility              = ElementVisibility.Collapsed;
            this.systemButtons.Children.Add((RadElement)this.helpButton);
            this.minimizeButton = new RadImageButtonElement();
            this.minimizeButton.StateManager            = new RibbonBarSystemButtonStateManager().StateManagerInstance;
            this.minimizeButton.ThemeRole               = "RibbonMinimizeButton";
            this.minimizeButton.Class                   = "MinimizeButton";
            this.minimizeButton.Image                   = (Image)Telerik\u002EWinControls\u002EUI\u002EResources.ribbon_minimize;
            this.minimizeButton.Click                  += new EventHandler(this.OnMinimize);
            this.minimizeButton.ButtonFillElement.Class = "CaptionButtonFill";
            this.minimizeButton.BorderElement.Class     = "CaptionButtonBorder";
            this.minimizeButton.StretchHorizontally     = false;
            this.systemButtons.Children.Add((RadElement)this.minimizeButton);
            this.maximizeButton = new RadImageButtonElement();
            this.maximizeButton.StateManager            = new RibbonBarSystemButtonStateManager().StateManagerInstance;
            this.maximizeButton.ThemeRole               = "RibbonMaximizeButton";
            this.maximizeButton.Class                   = "MaximizeButton";
            this.maximizeButton.Image                   = (Image)Telerik\u002EWinControls\u002EUI\u002EResources.ribbon_maximize;
            this.maximizeButton.Click                  += new EventHandler(this.OnMaximizeRestore);
            this.maximizeButton.ButtonFillElement.Class = "CaptionButtonFill";
            this.maximizeButton.BorderElement.Class     = "CaptionButtonBorder";
            this.maximizeButton.StretchHorizontally     = false;
            this.systemButtons.Children.Add((RadElement)this.maximizeButton);
            this.closeButton = new RadImageButtonElement();
            this.closeButton.StateManager            = new RibbonBarSystemButtonStateManager().StateManagerInstance;
            this.closeButton.ThemeRole               = "RibbonCloseButton";
            this.closeButton.Class                   = "CloseButton";
            this.closeButton.Image                   = (Image)Telerik\u002EWinControls\u002EUI\u002EResources.ribbon_close;
            this.closeButton.Click                  += new EventHandler(this.OnClose);
            this.closeButton.ButtonFillElement.Class = "CaptionButtonFill";
            this.closeButton.BorderElement.Class     = "CaptionButtonBorder";
            this.closeButton.StretchHorizontally     = false;
            this.systemButtons.Children.Add((RadElement)this.closeButton);
        }
예제 #5
0
            void SetText()
            {
                var font = GetFont(FontHeightDataField);
                var size = (int)(font.MeasureString(Name) / Scale);

                Label = new TextPrimitive(new Point(Width - 10 - size, (Height - FontHeightDataField) / 2), ColorGrey, Name, font);
            }
예제 #6
0
        /// <summary>
        /// create child items
        /// </summary>
        protected override void CreateChildElements()
        {
            this.borderPrimitive          = new BorderPrimitive();
            this.borderPrimitive.Class    = "RadPanelBorder";
            this.borderPrimitive.BoxStyle = BorderBoxStyle.OuterInnerBorders;

            this.fillPrimitive       = new FillPrimitive();
            fillPrimitive.BackColor  = Color.Transparent;
            fillPrimitive.BackColor2 = Color.Transparent;
            fillPrimitive.BackColor3 = Color.Transparent;
            fillPrimitive.BackColor4 = Color.Transparent;
            fillPrimitive.Class      = "RadPanelFill";

            this.textPrimitive           = new TextPrimitive();
            this.textPrimitive.Alignment = ContentAlignment.MiddleLeft;
            this.textPrimitive.BindProperty(TextPrimitive.TextProperty, this, RadItem.TextProperty, PropertyBindingOptions.TwoWay);

            this.imagePrimitive           = new ImagePrimitive();
            this.imagePrimitive.Alignment = ContentAlignment.MiddleLeft;


            this.Children.Add(this.fillPrimitive);
            this.Children.Add(this.borderPrimitive);
            this.Children.Add(this.textPrimitive);
            this.Children.Add(this.imagePrimitive);
        }
예제 #7
0
        private RadElement CreateHeaderColumnElement()
        {
            headerElement            = new RadElement();
            headerElement.Visibility = ElementVisibility.Collapsed;

            // fill
            headerColumnFill       = new FillPrimitive();
            headerColumnFill.Class = "RadSubMenuPanelHeaderFill";
            headerElement.Children.Add(headerColumnFill);

            // border
            headerColumnBorder       = new BorderPrimitive();
            headerColumnBorder.Class = "RadSubMenuPanelHeaderBorder";
            headerElement.Children.Add(headerColumnBorder);

            headerColumnElement                = new ImageAndTextLayoutPanel();
            headerColumnElement.Class          = "RadSubMenuPanelHeaderColumn";
            headerColumnElement.ZIndex         = 1;
            headerColumnElement.AngleTransform = 270;
            headerElement.Children.Add(headerColumnElement);

            // text
            headerColumnText = new TextPrimitive();
            headerColumnText.SetValue(ImageAndTextLayoutPanel.IsTextPrimitiveProperty, true);
            headerColumnText.Class = "RadMenuItemTextPrimitive";
            headerColumnElement.Children.Add(headerColumnText);

            // image
            headerColumnImage = new ImagePrimitive();
            headerColumnImage.SetValue(ImageAndTextLayoutPanel.IsImagePrimitiveProperty, true);
            headerColumnImage.Class = "RadMenuItemImagePrimitive";
            headerColumnElement.Children.Add(this.headerColumnImage);

            return(headerElement);
        }
예제 #8
0
            void SetText()
            {
                var    font = GetFont(FontHeightYes);
                string text = Viewer.Catalog.GetString("Yes");

                Yes = new TextPrimitive(new Point((Width - (int)(font.MeasureString(text) / Scale)) / 2, (Height - FontHeightYes) / 2), Color.Black, text, font);
            }
예제 #9
0
            public void DrawOnelineText(string text)
            {
                TextPrimitive primitive = new TextPrimitive(text);

                CheckExpectedImage(primitive, 200, 50, new Rect(10, 10, 200, 40),
                                   $@"GraphicsImplementation\Builtin\images\BuiltinPrimitiveRendererFacts.DrawText.DrawOnelineText_{text}.png");
            }
예제 #10
0
        public void DrawBoxModel(TextPrimitive textPrimitive, Rect rect, StyleRuleSet style)
        {
            GetBoxes(rect, style, out var borderBoxRect, out var paddingBoxRect, out var contentBoxRect);

            this.DrawBackground(style, paddingBoxRect);

            //Content
            //Content-box
            if (contentBoxRect.TopLeft.X < contentBoxRect.TopRight.X)//content should not be visible when contentBoxRect.TopLeft.X > contentBoxRect.TopRight.X
            {
                if (textPrimitive != null)
                {
                    //var textSize = style.CalcSize(text);
                    /*HACK Don't check text size because the size calculated by Typography is not accurate. */
                    /*if (textSize.Height < contentBoxRect.Height && textSize.Width < contentBoxRect.Width)*/
                    {
                        this.DrawText(textPrimitive, contentBoxRect, style);
                    }
                }
            }

            this.DrawBorder(style, borderBoxRect, paddingBoxRect);
            this.DrawOutline(style, borderBoxRect);

            this.DrawDebug(paddingBoxRect, contentBoxRect);
        }
 public void DrawTextPrimitive(TextMesh textMesh,
                               TextPrimitive textPrimitive, Rect rect, StyleRuleSet style, Vector offset)
 {
     this.SetTextMesh(textMesh);
     this.DrawText(textPrimitive, rect, style);
     this.SetTextMesh(null);
 }
예제 #12
0
        protected override void CreateChildElements()
        {
            this.textPrimitive      = new TextPrimitive();
            this.textPrimitive.Text = "RadToolStrip";

            this.Children.Add(this.textPrimitive);
        }
예제 #13
0
        protected override void CreateChildElements()
        {
            // fill
            this.fillPrimitive               = new FillPrimitive();
            this.fillPrimitive.Class         = "RadMenuHeaderItemFillPrimitive";
            this.fillPrimitive.BackColor     = Color.Empty;
            this.fillPrimitive.GradientStyle = GradientStyles.Solid;
            this.fillPrimitive.Name          = "MenuHeaderItemFill";
            this.Children.Add(this.fillPrimitive);

            // border
            this.borderPrimitive       = new BorderPrimitive();
            this.borderPrimitive.Class = "RadMenuHeaderItemBorderPrimitive";
            this.borderPrimitive.Name  = "MenuHeaderItemBorder";
            this.Children.Add(this.borderPrimitive);

            // image
            this.imagePrimitive = new ImagePrimitive();
            this.imagePrimitive.SetValue(ImageAndTextLayoutPanel.IsImagePrimitiveProperty, true);
            this.imagePrimitive.BindProperty(ImagePrimitive.ImageIndexProperty, this, RadButtonItem.ImageIndexProperty, PropertyBindingOptions.TwoWay);
            this.imagePrimitive.BindProperty(ImagePrimitive.ImageProperty, this, RadButtonItem.ImageProperty, PropertyBindingOptions.TwoWay);
            this.imagePrimitive.BindProperty(ImagePrimitive.ImageKeyProperty, this, RadButtonItem.ImageKeyProperty, PropertyBindingOptions.TwoWay);
            this.imagePrimitive.Class = "RadMenuHeaderItemImagePrimitive";
            this.Children.Add(this.imagePrimitive);

            this.textPrimitive       = new TextPrimitive();
            this.textPrimitive.Class = "RadMenuHeaderItemText";
            this.Children.Add(this.textPrimitive);

            this.textPrimitive.BindProperty(TextPrimitive.TextProperty, this, RadButtonItem.TextProperty, PropertyBindingOptions.TwoWay);
        }
예제 #14
0
        private RadElement CreateHeaderColumnElement()
        {
            this.headerElement            = new RadElement();
            this.headerElement.Visibility = ElementVisibility.Collapsed;
            this.headerColumnFill         = new FillPrimitive();
            this.headerColumnFill.Class   = "RadSubMenuPanelHeaderFill";
            this.headerElement.Children.Add((RadElement)this.headerColumnFill);
            this.headerColumnBorder       = new BorderPrimitive();
            this.headerColumnBorder.Class = "RadSubMenuPanelHeaderBorder";
            this.headerElement.Children.Add((RadElement)this.headerColumnBorder);
            this.headerColumnElement                = new ImageAndTextLayoutPanel();
            this.headerColumnElement.Class          = "RadSubMenuPanelHeaderColumn";
            this.headerColumnElement.ZIndex         = 1;
            this.headerColumnElement.AngleTransform = 270f;
            this.headerElement.Children.Add((RadElement)this.headerColumnElement);
            this.headerColumnText = new TextPrimitive();
            int num1 = (int)this.headerColumnText.SetValue(ImageAndTextLayoutPanel.IsTextPrimitiveProperty, (object)true);

            this.headerColumnText.Class = "RadMenuItemTextPrimitive";
            this.headerColumnElement.Children.Add((RadElement)this.headerColumnText);
            this.headerColumnImage = new ImagePrimitive();
            int num2 = (int)this.headerColumnImage.SetValue(ImageAndTextLayoutPanel.IsImagePrimitiveProperty, (object)true);

            this.headerColumnImage.Class = "RadMenuItemImagePrimitive";
            this.headerColumnElement.Children.Add((RadElement)this.headerColumnImage);
            return(this.headerElement);
        }
예제 #15
0
        protected override void CreateChildElements()
        {
            this.fillPrimitive               = new FillPrimitive();
            this.fillPrimitive.Class         = "RadMenuHeaderItemFillPrimitive";
            this.fillPrimitive.BackColor     = Color.Empty;
            this.fillPrimitive.GradientStyle = GradientStyles.Solid;
            this.fillPrimitive.Name          = "MenuHeaderItemFill";
            this.Children.Add((RadElement)this.fillPrimitive);
            this.borderPrimitive       = new BorderPrimitive();
            this.borderPrimitive.Class = "RadMenuHeaderItemBorderPrimitive";
            this.borderPrimitive.Name  = "MenuHeaderItemBorder";
            this.Children.Add((RadElement)this.borderPrimitive);
            this.imagePrimitive = new ImagePrimitive();
            int num1 = (int)this.imagePrimitive.SetValue(ImageAndTextLayoutPanel.IsImagePrimitiveProperty, (object)true);
            int num2 = (int)this.imagePrimitive.BindProperty(ImagePrimitive.ImageIndexProperty, (RadObject)this, RadButtonItem.ImageIndexProperty, PropertyBindingOptions.TwoWay);
            int num3 = (int)this.imagePrimitive.BindProperty(ImagePrimitive.ImageProperty, (RadObject)this, RadButtonItem.ImageProperty, PropertyBindingOptions.TwoWay);
            int num4 = (int)this.imagePrimitive.BindProperty(ImagePrimitive.ImageKeyProperty, (RadObject)this, RadButtonItem.ImageKeyProperty, PropertyBindingOptions.TwoWay);

            this.imagePrimitive.Class = "RadMenuHeaderItemImagePrimitive";
            this.Children.Add((RadElement)this.imagePrimitive);
            this.textPrimitive       = new TextPrimitive();
            this.textPrimitive.Class = "RadMenuHeaderItemText";
            this.Children.Add((RadElement)this.textPrimitive);
            int num5 = (int)this.textPrimitive.BindProperty(TextPrimitive.TextProperty, (RadObject)this, RadItem.TextProperty, PropertyBindingOptions.TwoWay);
            int num6 = (int)this.textPrimitive.BindProperty(VisualElement.FontProperty, (RadObject)this, VisualElement.FontProperty, PropertyBindingOptions.TwoWay);
        }
예제 #16
0
        protected override void InitializeFields()
        {
            base.InitializeFields();

            this.text       = new TextPrimitive();
            this.text.Class = "AlertWindowTextCaptionText";

            this.closeButton = new RadButtonElement();
            this.closeButton.SetDefaultValueOverride(RadButtonItem.DisplayStyleProperty, DisplayStyle.Image);
            this.closeButton.ThemeRole = "AlertCloseButton";

            this.pinButton = new RadToggleButtonElement();
            this.pinButton.SetDefaultValueOverride(RadButtonItem.DisplayStyleProperty, DisplayStyle.Image);
            this.pinButton.ThemeRole = "AlertWindowPinButton";

            this.optionsButton = new RadDropDownButtonElement();
            this.optionsButton.ArrowButton.SetDefaultValueOverride(RadElement.VisibilityProperty, ElementVisibility.Collapsed);
            this.optionsButton.ThemeRole = "AlertWindowOptionsButton";

            this.buttonsLayoutPanel            = new StackLayoutPanel();
            this.buttonsLayoutPanel.Class      = "AlertWindowButtonsLayoutPanel";
            this.mainLayoutPanel               = new DockLayoutPanel();
            this.mainLayoutPanel.Class         = "AlertWindowMainLayoutPanel";
            this.mainLayoutPanel.LastChildFill = true;

            this.MinSize = new System.Drawing.Size(0, 15);
        }
예제 #17
0
 void SetText()
 {
     foreach (int i in Enumerable.Range(0, Caption.Length))
     {
         int fontWidth = (int)(CaptionFont.MeasureString(Caption[i]) / Scale);
         CaptionText[i] = new TextPrimitive(new Point((Width - fontWidth) / 2, (Height - FontHeightButton) / 2 + FontHeightButton * (2 * i - Caption.Length + 1)), ColorGrey, Caption[i], CaptionFont);
     }
 }
예제 #18
0
        public void SetTitle(string s)
        {
            WindowTitle = s;
            int length = (int)(WindowTitleFont.MeasureString(s) / Scale);
            int x      = FullScreen ? (334 - length - 5) : 5;

            WindowTitleText = new TextPrimitive(new Point(x, (24 - FontHeightWindowTitle) / 2), ColorGrey, WindowTitle, WindowTitleFont);
        }
예제 #19
0
        private void SetDatePrimitive(float timestampS, int row)
        {
            int totalseconds = (int)timestampS;
            int hour         = (totalseconds / 3600) % 24;
            int minute       = (totalseconds / 60) % 60;

            DisplayedTimes[row] = new TextPrimitive(new Point(3, (row + 1) * RowHeight - (int)FontHeightTimestamp), Color.White, (hour < 10 ? "0" : "") + hour.ToString() + ":" + (minute < 10 ? "0" : "") + minute.ToString(), FontTimestamp);
        }
예제 #20
0
 private void SetText()
 {
     for (int i = 0; i < Caption.Length; i++)
     {
         int fontWidth = (int)(CaptionFont.MeasureString(Caption[i]) / Scale);
         CaptionText[i] = new TextPrimitive(new Point((Width - fontWidth) / 2, (Height - FontHeightButton) / 2 + FontHeightButton * (2 * i - Caption.Length + 1)), ColorGrey, Caption[i], CaptionFont);
     }
 }
예제 #21
0
        protected override void CreateChildElements()
        {
            this.fillPrimitive         = new FillPrimitive();
            fillPrimitive.Class        = "ListBoxItemSelectionFill";
            fillPrimitive.Visibility   = ElementVisibility.Hidden;
            fillPrimitive.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize;

            this.borderElement              = new BorderPrimitive();
            this.borderElement.Class        = "ListBoxItemSelectionBorder";
            this.borderElement.Visibility   = ElementVisibility.Hidden;
            this.borderElement.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize;

            this.imagePrimitive = new ImagePrimitive();
            this.imagePrimitive.SetValue(ImageAndTextLayoutPanel.IsImagePrimitiveProperty, true);
            this.imagePrimitive.BindProperty(ImagePrimitive.ImageIndexProperty, this, RadListBoxItem.ImageIndexProperty, PropertyBindingOptions.TwoWay);
            this.imagePrimitive.BindProperty(ImagePrimitive.ImageProperty, this, RadListBoxItem.ImageProperty, PropertyBindingOptions.TwoWay);
            this.imagePrimitive.BindProperty(ImagePrimitive.ImageKeyProperty, this, RadListBoxItem.ImageKeyProperty, PropertyBindingOptions.TwoWay);

            this.textPrimitive             = new TextPrimitive();
            this.textPrimitive.Class       = "ListBoxItemText";
            this.textPrimitive.UseMnemonic = false;
            this.textPrimitive.BindProperty(TextPrimitive.TextProperty, this, RadListBoxItem.TextProperty, PropertyBindingOptions.OneWay);
            this.textPrimitive.BindProperty(TextPrimitive.AlignmentProperty, this, RadListBoxItem.TextAlignmentProperty, PropertyBindingOptions.OneWay);

            this.descriptionTextPrimitive             = new TextPrimitive();
            this.descriptionTextPrimitive.Class       = "ListBoxItemDescriptionText";
            this.descriptionTextPrimitive.UseMnemonic = false;
            this.descriptionTextPrimitive.BindProperty(TextPrimitive.FontProperty, this, RadListBoxItem.DescriptionFontProperty, PropertyBindingOptions.OneWay);

            StackLayoutPanel textPanel = new StackLayoutPanel();

            textPanel.Orientation        = Orientation.Vertical;
            textPanel.EqualChildrenWidth = true;
            textPanel.Children.Add(this.textPrimitive);

            textSeparator = new RadMenuSeparatorItem();
            textSeparator.NotifyParentOnMouseInput = true;
            textSeparator.Class        = "ListBoxItemTextSeparator";
            textSeparator.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren;
            textSeparator.Visibility   = ElementVisibility.Collapsed;

            textPanel.Children.Add(textSeparator);
            textPanel.Children.Add(this.descriptionTextPrimitive);
            textPanel.SetValue(ImageAndTextLayoutPanel.IsTextPrimitiveProperty, true);

            this.layoutPanel = new ImageAndTextLayoutPanel();
            this.layoutPanel.StretchHorizontally = false;
            this.layoutPanel.BindProperty(ImageAndTextLayoutPanel.DisplayStyleProperty, this, RadListBoxItem.DisplayStyleProperty, PropertyBindingOptions.OneWay);
            this.layoutPanel.BindProperty(ImageAndTextLayoutPanel.ImageAlignmentProperty, this, RadListBoxItem.ImageAlignmentProperty, PropertyBindingOptions.OneWay);
            this.layoutPanel.BindProperty(ImageAndTextLayoutPanel.TextAlignmentProperty, this, RadListBoxItem.TextAlignmentProperty, PropertyBindingOptions.OneWay);
            this.layoutPanel.BindProperty(ImageAndTextLayoutPanel.TextImageRelationProperty, this, RadListBoxItem.TextImageRelationProperty, PropertyBindingOptions.OneWay);
            this.layoutPanel.Children.Add(this.imagePrimitive);
            this.layoutPanel.Children.Add(textPanel);

            this.Children.Add(fillPrimitive);
            this.Children.Add(this.borderElement);
            this.Children.Add(this.layoutPanel);
        }
예제 #22
0
        void SetDatePrimitive(float timestampS, int row)
        {
            int totalseconds = (int)timestampS;
            int hour         = (totalseconds / 3600) % 24;
            int minute       = (totalseconds / 60) % 60;
            var text         = $"{(hour < 10 ? "0" : "")}{hour}:{(minute < 10 ? "0" : "")}{minute}";

            DisplayedTimes[row] = new TextPrimitive(new Point(3, (row + 1) * RowHeight - (int)FontHeightTimestamp), Color.White, text, FontTimestamp);
        }
예제 #23
0
            void SetText()
            {
                var f1    = GetFont(FontHeightNumber);
                var f2    = GetFont(FontHeightLetters);
                var size1 = (int)(f1.MeasureString(Number) / Scale);
                var size2 = (int)(f2.MeasureString(Letters) / Scale);

                NumberText  = new TextPrimitive(new Point((Width - size1 - size2) / 2, (Height - FontHeightNumber) / 2), ColorGrey, Number, f1);
                LettersText = new TextPrimitive(new Point((Width - size1 - size2) / 2 + size1, (Height + FontHeightNumber) / 2 - FontHeightLetters), ColorGrey, Letters, f2);
            }
        public void DrawTextPrimitive(Vector offset, TextMesh textMesh,
                                      TextPrimitive textPrimitive, Rect rect, StyleRuleSet style)
        {
            textMesh.Clear();

            //draw
            this.SetTextMesh(textMesh);
            this.DrawText(textPrimitive, Rect.Offset(rect, offset), style);
            this.SetTextMesh(null);
        }
예제 #25
0
        protected override void CreateChildElements()
        {
            base.CreateChildElements();

            this.minMaxCloseButtonsStackLayoutPanel = new StackLayoutPanel();
            this.minMaxCloseButtonsStackLayoutPanel.EqualChildrenHeight = true;
            this.Children.Add(this.minMaxCloseButtonsStackLayoutPanel);

            this.systemButtons             = new StackLayoutPanel();
            this.systemButtons.Class       = "SystemButtonsStackLayout";
            this.systemButtons.Orientation = Orientation.Horizontal;
            this.systemButtons.Alignment   = ContentAlignment.MiddleRight;
            this.minMaxCloseButtonsStackLayoutPanel.Children.Add(this.systemButtons);

            this.minimizeButton = new RadImageButtonElement();
            this.minimizeButton.StateManager = new RibbonBarSystemButtonStateManager().StateManagerInstance;
            this.minimizeButton.ThemeRole    = "RibbonMinimizeButton";
            this.minimizeButton.Class        = "MinimizeButton";
            this.minimizeButton.Image        = Properties.Resources.ribbon_minimize;
            this.minimizeButton.Click       += new EventHandler(this.OnMinimize);

            ClassSelector selector       = new ClassSelector("ButtonFill");
            ClassSelector borderSelector = new ClassSelector("ButtonBorder");

            selector.GetSelectedElements(this.minimizeButton).First.Value.Class       = "CaptionButtonFill";
            borderSelector.GetSelectedElements(this.minimizeButton).First.Value.Class = "CaptionButtonBorder";
            this.systemButtons.Children.Add(minimizeButton);

            this.maximizeButton = new RadImageButtonElement();
            this.maximizeButton.StateManager = new RibbonBarSystemButtonStateManager().StateManagerInstance;
            this.maximizeButton.ThemeRole    = "RibbonMaximizeButton";
            this.maximizeButton.Class        = "MaximizeButton";
            this.maximizeButton.Image        = Properties.Resources.ribbon_maximize;
            this.maximizeButton.Click       += new EventHandler(this.OnMaximizeRestore);
            selector.GetSelectedElements(this.maximizeButton).First.Value.Class       = "CaptionButtonFill";
            borderSelector.GetSelectedElements(this.maximizeButton).First.Value.Class = "CaptionButtonBorder";
            this.systemButtons.Children.Add(maximizeButton);

            this.closeButton = new RadImageButtonElement();
            this.closeButton.StateManager = new RibbonBarSystemButtonStateManager().StateManagerInstance;
            this.closeButton.ThemeRole    = "RibbonCloseButton";
            this.closeButton.Class        = "CloseButton";
            this.closeButton.Image        = Properties.Resources.ribbon_close;
            this.closeButton.Click       += new EventHandler(this.OnClose);
            selector.GetSelectedElements(this.closeButton).First.Value.Class       = "CaptionButtonFill";
            borderSelector.GetSelectedElements(this.closeButton).First.Value.Class = "CaptionButtonBorder";
            this.systemButtons.Children.Add(closeButton);

            this.captionText               = new TextPrimitive();
            this.captionText.Class         = "TitleCaption";
            this.captionText.TextAlignment = ContentAlignment.MiddleCenter;
            captionText.SetValue(RibbonBarCaptionLayoutPanel.CaptionTextProperty, true);
            captionText.BindProperty(TextPrimitive.TextProperty, this, RadItem.TextProperty, PropertyBindingOptions.OneWay);
            this.captionText.FontChanged += new EventHandler(captionText_FontChanged);
        }
예제 #26
0
        protected override void CreateChildElements()
        {
            this.internalLayoutPanel       = (ImageAndTextLayoutPanel) new MenuImageAndTextLayout();
            this.internalLayoutPanel.Class = "RadMenuItemInternalLayoutPanel";
            this.Children.Add((RadElement)this.internalLayoutPanel);
            this.checkmark = new RadMenuCheckmark();
            int num1 = (int)this.checkmark.SetValue(ImageAndTextLayoutPanel.IsImagePrimitiveProperty, (object)true);

            this.checkmark.Alignment = ContentAlignment.MiddleCenter;
            this.checkmark.CheckElement.Alignment = ContentAlignment.MiddleCenter;
            this.checkmark.CheckElement.Class     = "RadMenuItemCheckPrimitive";
            this.internalLayoutPanel.Children.Add((RadElement)this.checkmark);
            this.imagePrimitive = new ImagePrimitive();
            int num2 = (int)this.imagePrimitive.SetValue(RadCheckmark.IsImageProperty, (object)true);

            this.imagePrimitive.Class     = "RadMenuItemImagePrimitive";
            this.imagePrimitive.Alignment = ContentAlignment.MiddleCenter;
            this.imagePrimitive.ZIndex    = this.checkmark.ZIndex + 1;
            this.checkmark.Children.Add((RadElement)this.imagePrimitive);
            this.textPanel = new StackLayoutPanel();
            this.textPanel.StretchHorizontally = false;
            this.textPanel.StretchVertically   = false;
            this.textPanel.Class              = "RadMenuItemTextPanel";
            this.textPanel.Orientation        = Orientation.Vertical;
            this.textPanel.EqualChildrenWidth = true;
            int num3 = (int)this.textPanel.SetValue(ImageAndTextLayoutPanel.IsTextPrimitiveProperty, (object)true);

            this.internalLayoutPanel.Children.Add((RadElement)this.textPanel);
            this.textPrimitive = new TextPrimitive();
            int num4 = (int)this.textPrimitive.SetValue(ImageAndTextLayoutPanel.IsTextPrimitiveProperty, (object)true);

            this.textPrimitive.Class = "RadMenuItemTextPrimitive";
            this.textPanel.Children.Add((RadElement)this.textPrimitive);
            this.textSeparator            = new LinePrimitive();
            this.textSeparator.Class      = "RadMenuItemTextSeparator";
            this.textSeparator.Visibility = ElementVisibility.Collapsed;
            this.textPanel.Children.Add((RadElement)this.textSeparator);
            this.descriptionTextPrimitive       = new TextPrimitive();
            this.descriptionTextPrimitive.Class = "RadMenuItemDescriptionText";
            this.textPanel.Children.Add((RadElement)this.descriptionTextPrimitive);
            this.shortcutTextPrimitive            = new TextPrimitive();
            this.shortcutTextPrimitive.Class      = "RadMenuItemShortcutPrimitive";
            this.shortcutTextPrimitive.Visibility = ElementVisibility.Collapsed;
            this.Children.Add((RadElement)this.shortcutTextPrimitive);
            this.arrowPrimitive               = new ArrowPrimitive();
            this.arrowPrimitive.Visibility    = ElementVisibility.Hidden;
            this.arrowPrimitive.Direction     = this.RightToLeft ? Telerik.WinControls.ArrowDirection.Left : Telerik.WinControls.ArrowDirection.Right;
            this.arrowPrimitive.Alignment     = ContentAlignment.MiddleLeft;
            this.arrowPrimitive.Class         = "RadMenuItemArrowPrimitive";
            this.arrowPrimitive.SmoothingMode = SmoothingMode.Default;
            this.arrowPrimitive.MinSize       = Size.Empty;
            this.arrowPrimitive.MaxSize       = Size.Empty;
            this.Children.Add((RadElement)this.arrowPrimitive);
        }
예제 #27
0
        protected override void CreateChildElements()
        {
            this.fillPrimitive              = new FillPrimitive();
            this.fillPrimitive.Class        = "ButtonFill";
            this.fillPrimitive.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize;

            this.borderPrimitive              = new BorderPrimitive();
            this.borderPrimitive.Class        = "ButtonBorder";
            this.borderPrimitive.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize;

            this.textPrimitive = new TextPrimitive();
            this.textPrimitive.SetValue(ImageAndTextLayoutPanel.IsTextPrimitiveProperty, true);
            this.textPrimitive.BindProperty(TextPrimitive.TextProperty, this, RadButtonItem.TextProperty, PropertyBindingOptions.OneWay);

            this.imagePrimitive = new ImagePrimitive();
            this.imagePrimitive.SetValue(ImageAndTextLayoutPanel.IsImagePrimitiveProperty, true);
            this.imagePrimitive.BindProperty(ImagePrimitive.ImageIndexProperty, this, RadButtonItem.ImageIndexProperty, PropertyBindingOptions.TwoWay);
            this.imagePrimitive.BindProperty(ImagePrimitive.ImageProperty, this, RadButtonItem.ImageProperty, PropertyBindingOptions.TwoWay);
            this.imagePrimitive.BindProperty(ImagePrimitive.ImageKeyProperty, this, RadButtonItem.ImageKeyProperty, PropertyBindingOptions.TwoWay);
            this.imagePrimitive.BindProperty(ImagePrimitive.UseSmallImageListProperty, this, RadButtonElement.UseSmallImageListProperty, PropertyBindingOptions.TwoWay);

            this.layoutPanel = new ImageAndTextLayoutPanel();
            this.layoutPanel.BindProperty(ImageAndTextLayoutPanel.AutoSizeModeProperty, this, RadButtonItem.AutoSizeModeProperty, PropertyBindingOptions.OneWay);
            this.layoutPanel.BindProperty(RadElement.StretchHorizontallyProperty, this, RadElement.StretchHorizontallyProperty, PropertyBindingOptions.OneWay);
            this.layoutPanel.BindProperty(RadElement.StretchVerticallyProperty, this, RadElement.StretchVerticallyProperty, PropertyBindingOptions.OneWay);
            this.layoutPanel.BindProperty(ImageAndTextLayoutPanel.DisplayStyleProperty, this, RadButtonItem.DisplayStyleProperty, PropertyBindingOptions.OneWay);

            this.layoutPanel.BindProperty(ImageAndTextLayoutPanel.ImageAlignmentProperty, this, RadButtonItem.ImageAlignmentProperty, PropertyBindingOptions.OneWay);
            this.layoutPanel.BindProperty(ImageAndTextLayoutPanel.TextAlignmentProperty, this, RadButtonItem.TextAlignmentProperty, PropertyBindingOptions.OneWay);
            this.layoutPanel.BindProperty(ImageAndTextLayoutPanel.TextImageRelationProperty, this, RadButtonItem.TextImageRelationProperty, PropertyBindingOptions.OneWay);

            this.layoutPanel.Children.Add(this.imagePrimitive);
            this.layoutPanel.Children.Add(this.textPrimitive);
            //p.p. 6.4.2009 fix bug with text layout
            this.textPrimitive.BindProperty(RadElement.AlignmentProperty, this, RadButtonItem.TextAlignmentProperty, PropertyBindingOptions.OneWay);
            this.imagePrimitive.BindProperty(RadElement.AlignmentProperty, this, RadButtonItem.ImageAlignmentProperty, PropertyBindingOptions.OneWay);
            //end add
            this.borderPrimitive.ZIndex = 2;
            this.borderPrimitive.BindProperty(RadElement.IsItemFocusedProperty, this, RadElement.IsFocusedProperty, PropertyBindingOptions.OneWay);

            FocusPrimitive focusPrimitive = new FocusPrimitive(this.borderPrimitive);

            focusPrimitive.ZIndex     = 4;
            focusPrimitive.Visibility = ElementVisibility.Hidden;
            focusPrimitive.Class      = "ButtonFocus";
            this.layoutPanel.ZIndex   = 3;

            focusPrimitive.BindProperty(RadElement.IsItemFocusedProperty, this, RadElement.IsFocusedProperty, PropertyBindingOptions.OneWay);

            this.Children.Add(this.fillPrimitive);
            this.Children.Add(this.layoutPanel);
            this.Children.Add(this.borderPrimitive);
            this.Children.Add(focusPrimitive);
        }
예제 #28
0
            public void DrawOneTextNode()
            {
                Node node      = new Node(1);
                var  primitive = new TextPrimitive("ImGUI立即");

                node.Primitive = primitive;
                node.Rect.X    = 1;
                node.Rect.Y    = 1;

                Util.DrawNodeToImage(out var imageRawBytes, node, 100, 30);
                Util.CheckExpectedImage(imageRawBytes, 100, 30, @"Rendering\images\NodeFacts.Draw.DrawOneTextNode.png");
            }
예제 #29
0
            public void DrawOneTextNodeAtPosition()
            {
                Node node      = new Node(1);
                var  primitive = new TextPrimitive("AAA");

                node.Primitive = primitive;
                node.Rect.X    = 50;
                node.Rect.Y    = 30;

                Util.DrawNodeToImage(out var imageRawBytes, node, 150, 60);
                Util.CheckExpectedImage(imageRawBytes, 150, 60, @"Rendering\images\NodeFacts.Draw.DrawOneTextNodeAtPosition.png");
            }
예제 #30
0
        protected override void InitializeFields()
        {
            base.InitializeFields();

            this.itemsLayoutPanel = new WrapLayoutPanel();
            this.textPrimitive    = new TextPrimitive();
            this.captionElement   = new FillPrimitive();
            this.bodyElement      = new FillPrimitive();
            this.groupLayoutPanel = new ElementWithCaptionLayoutPanel();

            this.NotifyParentOnMouseInput = true;
            this.items           = new RadItemOwnerCollection();
            this.items.ItemTypes = new Type[] { typeof(RadGalleryItem) };
        }