Exemple #1
0
        void XListbox_FontChanged(object sender, EventArgs e)
        {
            FontTracker = new font_tracker(this.Font);
            SizeF szf = FontTracker.MeasureString(this.CreateGraphics(), "X", scale_x, scale_y);

            ItemHeight = (int)(scale_y * szf.Height);
        }
Exemple #2
0
        public font_tracker GetFontResult()
        {
            font_tracker f = this.FontList.SelectedItem as font_tracker;

            return(f);
            //throw new Exception( "The method or operation is not implemented." );
        }
Exemple #3
0
        public static font_tracker GetFontTracker(string p, InitFontTracker init_font_tracker)
        {
            if (fonts == null)
            {
                fonts = new List <font_tracker>();
            }

            if (fonts.Count == 0)
            {
                fonts.Add(new font_tracker(p));
            }

            foreach (font_tracker f in fonts)
            {
                if (String.Compare(p, f.Name, true) == 0)
                {
                    return(f);
                }
            }
            font_tracker ft;

            fonts.Add(ft = new font_tracker(p));
            if (init_font_tracker != null)
            {
                init_font_tracker(ft);
            }
            return(ft);
        }
Exemple #4
0
        private void EditFont_Click(object sender, EventArgs e)
        {
            font_tracker f = (font_tracker)this.FontList.SelectedItem;

            //pickedFont = null;
            System.Windows.Forms.FontDialog fd = new System.Windows.Forms.FontDialog();
            fd.Font = f.f;

            DialogResult result = fd.ShowDialog();

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                f.f      = fd.Font;
                f.family = fd.Font.FontFamily.Name;
                f.size   = fd.Font.Size;
                f.style  = fd.Font.Style;
                f.unit   = fd.Font.Unit;
                f.InvokeChanged();
                foreach (Control c in f.Controls)
                {
                    c.Font = f.f;
                }
            }
            fd.Dispose();
        }
Exemple #5
0
 public Banner(string Message, MessageBoxButtons messageBoxButtons)
 {
     this.messageBoxButtons = messageBoxButtons;
     InitializeComponent();
     FontTracker = new font_tracker(this.Font);
     // TODO: Complete member initialization
     Text = Message;
 }
Exemple #6
0
        private void NewFont_Click(object sender, EventArgs e)
        {
            QueryNewName qnn = new QueryNewName("Enter a name for this font...");

            qnn.ShowDialog();
            if (qnn.DialogResult == DialogResult.OK)
            {
                font_tracker f = FontEditor.GetFontTracker(qnn.textBox1.Text);
                this.FontList.DataSource = null;
                this.FontList.DataSource = fonts;
            }
            qnn.Dispose();
        }
Exemple #7
0
        public XListbox()
        {
            DrawMode          = System.Windows.Forms.DrawMode.OwnerDrawFixed;
            MeasureItem      += new MeasureItemEventHandler(XListbox_MeasureItem);
            DrawItem         += new DrawItemEventHandler(XListbox_DrawItem);
            this.FontChanged += new EventHandler(XListbox_FontChanged);

            Scale(new SizeF(scale_x.ToFloat(), scale_y.ToFloat()));

            FontTracker = new font_tracker(this.Font);
            SizeF szf = FontTracker.MeasureString(this.CreateGraphics(), "X", scale_x, scale_y);

            ItemHeight = (int)(scale_y * szf.Height);
        }
Exemple #8
0
        public static System.Drawing.Font GetFontTracker(string p, string font_family, int font_size)
        {
            if (fonts.Count == 0)
            {
                fonts.Add(new font_tracker("Default"));
            }

            foreach (font_tracker f in fonts)
            {
                if (String.Compare(p, f.Name, true) == 0)
                {
                    return(f);
                }
            }
            font_tracker ft;

            fonts.Add(ft = new font_tracker(p, font_family, font_size));
            return(ft);
        }
Exemple #9
0
 public FontEditor(font_tracker font)
 {
     InitializeComponent();
     initial = font;
 }
Exemple #10
0
        public static bool Load(XPathNavigator r)
        {
            if (r.NodeType == XPathNodeType.Element)
            {
                switch (r.Name)
                {
                case "Font":
                    //string family = "Lucida Console";
                    //float size = 12.0f;
                    //GraphicsUnit unit = GraphicsUnit.Pixel;
                    //FontStyle style = FontStyle.Regular;
                    font_tracker ft       = null;
                    bool         everokay = false;
                    bool         okay;
                    for (okay = r.MoveToFirstAttribute(); okay; okay = r.MoveToNextAttribute())
                    {
                        everokay = true;
                        switch (r.Name)
                        {
                        case "name":
                            ft = FontEditor.GetFontTracker(r.Value);
                            break;

                        case "face":
                            ft.family = r.Value;
                            break;

                        case "size":
                            ft.size = Convert.ToSingle(r.Value);

                            break;

                        case "style":
                            switch (r.Value)
                            {
                            case "Regular":
                                ft.style = FontStyle.Regular;
                                break;

                            case "Bold":
                                ft.style = FontStyle.Bold;
                                break;

                            case "Italic":
                                ft.style = FontStyle.Italic;
                                break;

                            case "Strikeout":
                                ft.style = FontStyle.Strikeout;
                                break;
                            }
                            break;

                        case "units":
                            switch (r.Value)
                            {
                            case "Point":
                                ft.unit = GraphicsUnit.Point;
                                break;

                            case "Display":
                                ft.unit = GraphicsUnit.Display;
                                break;

                            case "Pixel":
                                ft.unit = GraphicsUnit.Pixel;
                                break;

                            default:
                                throw new Exception("Unsupported 'units' saved in font..");
                                //break;
                            }
                            break;
                        }
                        if (ft == null)
                        {
                            break;
                        }
                    }
                    ft.f = new Font(ft.family, ft.size, ft.style, ft.unit);
                    if (everokay)
                    {
                        r.MoveToParent();
                    }
                    return(true);
                }
            }
            return(false);
        }
Exemple #11
0
 public Banner(String content)
 {
     InitializeComponent();
     FontTracker = new font_tracker(this.Font);
     Text        = content;
 }
Exemple #12
0
 public Banner()
 {
     InitializeComponent();
     FontTracker = new font_tracker(this.Font);
 }