コード例 #1
0
ファイル: DigitButton.cs プロジェクト: hikakankan/Multex
        private void paint_pat(MVGraphics g, string[] pat, Rectangle rect)
        {
            Color c_pattern = settings.CalcAreaTextColor;

            for (int i = 0; i < dvcount; i++)
            {
                for (int j = 0; j < dhcount; j++)
                {
                    if (pat[i][j] == '1')
                    {
                        //int bx = (width - hgap) * j / dhcount + hgap / 2;
                        //int by = (height - hgap * 2) * i / dvcount + hgap;
                        //int bw = (width - hgap) / dhcount;
                        //int bh = (height - hgap * 2) / dvcount;
                        int bx = rect.Width * j / dhcount;
                        int by = rect.Height * i / dvcount;
                        int bw = rect.Width / dhcount;
                        int bh = rect.Height / dvcount;
                        g.setColor(c_pattern);
                        g.fillRect(bx, by + rect.Y, bw + 1, bh + 1);
                    }
                }
            }
        }
コード例 #2
0
ファイル: DigitButton.cs プロジェクト: hikakankan/Multex
        public void paint(MVGraphics g)
        {
            Color     c_upd_back   = settings.CalcAreaUpdatingBackColor;
            Color     c_dst_back   = settings.CalcAreaDestinationBackColor;
            Color     c_src_back   = settings.CalcAreaSourceBackColor;
            Color     c_frame_back = settings.CalcAreaFrameBackColor;
            Color     c_frame      = settings.CalcAreaFrameColor;
            Color     c_underline  = settings.CalcAreaUnderlineColor;
            Rectangle frame_rect   = get_frame_rect();

            if (frm)
            {
                // 枠の内部を塗りつぶす
                if (updating)
                {
                    g.setColor(c_upd_back);
                }
                else if (destination)
                {
                    g.setColor(c_dst_back);
                }
                else if (source)
                {
                    g.setColor(c_src_back);
                }
                else
                {
                    g.setColor(c_frame_back);
                }
                g.fillRect(frame_rect);
                // 枠を描く
                g.setColor(c_frame);
                g.drawRect(frame_rect);
            }
            if (ul)
            {
                // アンダーラインを描く
                g.setColor(c_underline);
                //g.drawLine(0, ULHeight(), width - 1, ULHeight());
                //g.drawLine(0, ULHeight(), XWidth() - 1, ULHeight());
                g.drawLine(0, ULHeight(), XWidth() + 1, ULHeight());
            }
            //System.out.println(number);
            if (number != -1)
            {
                paint_pat(g, pattern[number], frame_rect);
            }
            else if (sym.Equals("add"))
            {
                paint_pat(g, pattern_add, frame_rect);
            }
            else if (sym.Equals("sub"))
            {
                paint_pat(g, pattern_sub, frame_rect);
            }
            else if (sym.Equals("mult"))
            {
                paint_pat(g, pattern_mult, frame_rect);
            }
            else if (sym.Equals("div"))
            {
                paint_pat(g, pattern_div, frame_rect);
            }
            else if (!sym.Equals(""))
            {
                paint_pat(g, pattern_ast, frame_rect);
            }
        }