コード例 #1
0
        private void FontStylePropertyTranslator(object host, string propertyName, object value)
        {
            WinFormsAdapter adapter = GetAdapter(host);

            if (adapter != null)
            {
                if (value is SW.FontStyle)
                {
                    SD.FontStyle style;
                    if ((SW.FontStyle)value == SW.FontStyles.Normal)
                    {
                        style = SD.FontStyle.Regular;
                    }
                    else
                    {
                        style = SD.FontStyle.Italic;
                    }
                    if (HostUtils.FontWeightIsBold(Host.FontWeight))
                    {
                        style |= SD.FontStyle.Bold;
                    }
                    adapter.Font = new SD.Font(CurrentFontFamily, CurrentFontSize, style);
                }
            }
        }
コード例 #2
0
        private void FontWeightPropertyTranslator(object host, string propertyName, object value)
        {
            WinFormsAdapter adapter = GetAdapter(host);

            if (adapter != null && value is SW.FontWeight)
            {
                SD.FontStyle style = CurrentFontStyle;
                if (HostUtils.FontWeightIsBold((SW.FontWeight)value))
                {
                    style |= SD.FontStyle.Bold;
                }
                adapter.Font = new SD.Font(CurrentFontFamily, CurrentFontSize, style);
            }
        }