示例#1
0
        /// <summary>
        /// Constructor with parameters</summary>
        /// <param name="fontFamilyName">Font family name for theme</param>
        /// <param name="fontSize">Font size</param>
        public D2dDiagramTheme(string fontFamilyName, float fontSize)
        {
            m_d2dTextFormat      = D2dFactory.CreateTextFormat(fontFamilyName, fontSize);
            m_fillBrush          = D2dFactory.CreateSolidBrush(SystemColors.Window);
            m_fillTitleBrush     = D2dFactory.CreateSolidBrush(Color.YellowGreen);
            m_textBrush          = D2dFactory.CreateSolidBrush(SystemColors.WindowText);
            m_outlineBrush       = D2dFactory.CreateSolidBrush(SystemColors.ControlDark);
            m_highlightBrush     = D2dFactory.CreateSolidBrush(SystemColors.Highlight);
            m_lastHighlightBrush = D2dFactory.CreateSolidBrush(SystemColors.Highlight);
            m_textHighlightBrush = D2dFactory.CreateSolidBrush(SystemColors.Highlight);
            m_hotBrush           = D2dFactory.CreateSolidBrush(SystemColors.HotTrack);
            m_dragSourceBrush    = D2dFactory.CreateSolidBrush(Color.SlateBlue);
            m_dropTargetBrush    = D2dFactory.CreateSolidBrush(Color.Chartreuse);
            m_ghostBrush         = D2dFactory.CreateSolidBrush(Color.White);
            m_hiddenBrush        = D2dFactory.CreateSolidBrush(Color.LightGray);
            m_templatedInstance  = D2dFactory.CreateSolidBrush(Color.Yellow);
            m_copyInstance       = D2dFactory.CreateSolidBrush(Color.Green);
            m_errorBrush         = D2dFactory.CreateSolidBrush(Color.Tomato);
            m_infoBrush          = D2dFactory.CreateSolidBrush(SystemColors.Info);
            m_hoverBorderBrush   = D2dFactory.CreateSolidBrush(SystemColors.ControlDarkDark);

            int fontHeight = (int)TextFormat.FontHeight;

            m_rowSpacing = fontHeight + PinMargin;
            m_pinOffset  = (fontHeight - m_pinSize) / 2;

            D2dGradientStop[] gradstops =
            {
                new D2dGradientStop(Color.White,             0),
                new D2dGradientStop(Color.LightSteelBlue, 1.0f),
            };
            m_fillLinearGradientBrush = D2dFactory.CreateLinearGradientBrush(gradstops);
            StrokeWidth = 2;
        }
示例#2
0
        private void CreateSharedResources()
        {
            // create text format object for various test modes
            m_generalTextFormat = D2dFactory.CreateTextFormat("Calibri"
                                                              , D2dFontWeight.Bold, D2dFontStyle.Normal, D2dFactory.FontSizeToPixel(16));

            m_generalTextFormat.WordWrapping = D2dWordWrapping.Wrap;
        }
示例#3
0
        /// <summary>
        /// Binds the adapter to the adaptable control; called in the order that the adapters
        /// were defined on the control</summary>
        /// <param name="control">Adaptable control</param>
        protected override void Bind(AdaptableControl control)
        {
            base.Bind(control);

            var d2dControl = control as D2dAdaptableControl;

            m_d2dGraphics              = d2dControl.D2dGraphics;
            d2dControl.ContextChanged += control_ContextChanged;
            m_scaleBrush = D2dFactory.CreateSolidBrush(control.ForeColor);
            m_textFormat = D2dFactory.CreateTextFormat(d2dControl.Font);
        }
示例#4
0
        private void UpdateToTheme()
        {
            D2dTextFormat textFormat = m_theme.TextFormat;

            if (m_centerText == null ||
                textFormat.FontFamilyName != m_centerText.FontFamilyName ||
                textFormat.FontSize != m_centerText.FontSize)
            {
                if (m_centerText != null)
                {
                    m_centerText.Dispose();
                }

                m_centerText = D2dFactory.CreateTextFormat(textFormat.FontFamilyName,
                                                           D2dFontWeight.Bold, D2dFontStyle.Normal, m_theme.TextFormat.FontHeight);
                m_centerText.TextAlignment      = D2dTextAlignment.Center;
                m_centerText.ParagraphAlignment = D2dParagraphAlignment.Center;
                m_fontHeight = m_theme.TextFormat.FontHeight;
            }
        }