Esempio n. 1
0
        public static FontFamily DefaultFontFamily()
        {
            if (Win32FontHelper.c_defaultFontFamilyName.Length > 0)
            {
                return(new FontFamily(Win32FontHelper.c_defaultFontFamilyName));
            }

            if (Win32FontHelper.isInFontFamilyArray("\u5fae\u8edf\u6b63\u9ed1\u9ad4"))
            {
                Win32FontHelper.c_defaultFontFamilyName = "\u5fae\u8edf\u6b63\u9ed1\u9ad4";
                return(new FontFamily("\u5fae\u8edf\u6b63\u9ed1\u9ad4"));
            }
            if (Win32FontHelper.isInFontFamilyArray("Microsoft JhengHei"))
            {
                Win32FontHelper.c_defaultFontFamilyName = "Microsoft JhengHei";
                return(new FontFamily("Microsoft JhengHei"));
            }
            if (Win32FontHelper.isInFontFamilyArray("\u5fae\u8edf\u96c5\u9ed1\u9ad4"))
            {
                Win32FontHelper.c_defaultFontFamilyName = "\u5fae\u8edf\u96c5\u9ed1\u9ad4";
                return(new FontFamily("\u5fae\u8edf\u96c5\u9ed1\u9ad4"));
            }
            if (Win32FontHelper.isInFontFamilyArray("Microsoft YaHei"))
            {
                Win32FontHelper.c_defaultFontFamilyName = "Microsoft YaHei";
                return(new FontFamily("Microsoft YaHei"));
            }
            if (Win32FontHelper.isInFontFamilyArray("\u7d30\u660e\u9ad4")) // MingLiU
            {
                Win32FontHelper.c_defaultFontFamilyName = "\u7d30\u660e\u9ad4";
                return(new FontFamily("\u7d30\u660e\u9ad4"));
            }
            if (Win32FontHelper.isInFontFamilyArray("\u65b0\u7d30\u660e\u9ad4")) // MingLiU
            {
                Win32FontHelper.c_defaultFontFamilyName = "\u65b0\u7d30\u660e\u9ad4";
                return(new FontFamily("\u65b0\u7d30\u660e\u9ad4"));
            }
            if (Win32FontHelper.isInFontFamilyArray("MingLiU"))
            {
                Win32FontHelper.c_defaultFontFamilyName = "MingLiU";
                return(new FontFamily("MingLiU"));
            }
            if (Win32FontHelper.isInFontFamilyArray("SimHei"))
            {
                Win32FontHelper.c_defaultFontFamilyName = "SimHei";
                return(new FontFamily("SimHei"));
            }
            if (Win32FontHelper.isInFontFamilyArray("SimSun"))
            {
                Win32FontHelper.c_defaultFontFamilyName = "SimSun";
                return(new FontFamily("SimSun"));
            }
            if (Win32FontHelper.isInFontFamilyArray("Arial Unicode MS"))
            {
                Win32FontHelper.c_defaultFontFamilyName = "Arial Unicode MS";
                return(new FontFamily("Arial Unicode MS"));
            }
            Win32FontHelper.c_defaultFontFamilyName = "Arial";
            return(new FontFamily("Arial"));
        }
Esempio n. 2
0
        public void SetFontHeight(long newHeightInPixel)
        {
            using (Graphics g = this.CreateGraphics())
            {
                // @zonble
                // The unit of the height passed within the variable
                // "newHeightInPixel" is pixel, however, we need to know
                // the hieght in point, and then we are able to set the height
                // of a font object. So, we need to convert itfrom pixel to
                // point. BTW, during this conversion, we need to know the
                // current screen resolution (DPI).

                // the input is in px, but Font needs pt, so scale back
                float             newHeight = (float)newHeightInPixel * 72.0F / g.DpiX;
                BIServerConnector callback  = BIServerConnector.SharedInstance;
                if (callback != null)
                {
                    if (callback.hasLoaderConfigKey("IMEUnawareComposingBufferHeightPt"))
                    {
                        // take this in ppt
                        newHeight = (float)Int64.Parse(callback.stringValueForLoaderConfigKey("IMEUnawareComposingBufferHeightPt"));
                    }
                }

                FontFamily fontFamily = Win32FontHelper.DefaultFontFamily();
                Font       font       = new Font(fontFamily, newHeight, FontStyle.Regular, GraphicsUnit.Point, ((byte)(136)));
                this.Font = font;
                fontFamily.Dispose();
                font.Dispose();
                g.Dispose();
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Create a new panel with rows of buttons, which contain the symbol
        /// characters.
        /// </summary>
        /// <param name="panelName">The name of the new panel</param>
        /// <param name="buttonNames">The array of symbol strings.</param>
        private void CreateButtonPanel(string panelName, string[] buttonNames)
        {
            int    i     = 0;
            double lines = Math.Ceiling(buttonNames.Length / 10.0);
            Panel  p     = new Panel();

            p.Name       = panelName;
            p.MouseMove += new MouseEventHandler(BIForm_MouseMove);

            p.Size     = new Size(250, (int)lines * 25 + 15);
            p.Location = new Point(0, u_symbolList.Height + 5);
            p.Visible  = false;
            foreach (string name in buttonNames)
            {
                int    row = i / 10;
                int    col = i % 10;
                int    y   = row * 25;
                int    x   = col * 25;
                Button b   = new Button();
                b.Location = new Point(x, y);
                b.Size     = new Size(25, 25);
                b.TabIndex = 0;
                b.Text     = name;
                b.UseVisualStyleBackColor = false;
                b.Font   = new Font(Win32FontHelper.DefaultFontFamily(), 10);
                b.Click += new EventHandler(SendString);
                p.Controls.Add(b);
                i++;
            }
            u_panelButtons.Controls.Add(p);
        }
Esempio n. 4
0
        public BIInputBufferForm()
        {
            CheckForIllegalCrossThreadCalls = false;
            InitializeComponent();
            FontFamily fontFamily = Win32FontHelper.DefaultFontFamily();

            this.Font                    = new Font(fontFamily, this.m_fontSize, FontStyle.Regular, GraphicsUnit.Point, ((byte)(136)));
            this.m_promptFont            = new Font(fontFamily, 10.0F);
            this.m_promptDescriptionFont = new Font(fontFamily, 9.0F);
            fontFamily.Dispose();
        }
Esempio n. 5
0
        public BICandidateForm()
        {
            CheckForIllegalCrossThreadCalls = false;

            InitializeComponent();

            #region Initializing the basical variables.
            FontFamily fontFamily = Win32FontHelper.DefaultFontFamily();

            if (fontFamily.Name.Equals("\u5fae\u8edf\u6b63\u9ed1\u9ad4") ||
                fontFamily.Name.Equals("Microsoft JhengHei"))
            {
                this.Font = new Font(fontFamily, this.m_fontSize,
                                     FontStyle.Bold, GraphicsUnit.Point, ((byte)(136)));
            }
            else
            {
                this.Font = new Font(fontFamily, this.m_fontSize,
                                     FontStyle.Regular, GraphicsUnit.Point, ((byte)(136)));
            }
            fontFamily.Dispose();
            this.m_indicatorFont = new Font("Arial", 7, FontStyle.Bold,
                                            GraphicsUnit.Point, ((byte)(136)));
            this.m_selectionKeyFont = new Font("Arial", 8, FontStyle.Bold,
                                               GraphicsUnit.Point, ((byte)(136)));
            this.m_promptFont = new Font("Arial", 8, FontStyle.Regular,
                                         GraphicsUnit.Point, ((byte)(136)));

            #region Color Schema
            this.m_borderColor               = Color.FromArgb(149, 149, 149);
            this.m_backgroundColor           = Color.Black;
            this.m_patternColor              = Color.FromArgb(32, 32, 32);
            this.m_foregroundColor           = Color.White;
            this.m_hilightColor              = Color.FromArgb(140, 91, 156);
            this.m_hilightEndColor           = Color.FromArgb(140, 91, 156);
            this.m_hilightForegroundColor    = Color.White;
            this.m_indicatorColor            = Color.FromArgb(183, 183, 183);
            this.m_keyBackgroundColor        = Color.FromArgb(154, 154, 154);
            this.m_keyForgroundColor         = Color.FromArgb(80, 80, 80);
            this.m_keyHilightBackgroundColor = Color.FromArgb(234, 209, 239);
            #endregion

            #endregion
        }