コード例 #1
0
ファイル: MainWindow.cs プロジェクト: deleteLater/CSharp
    protected void On_FontAction_Activated(object sender, EventArgs e)
    {
        FontSelectionDialog fontDlg =
            new FontSelectionDialog("Select Your Font");

        fontDlg.PreviewText = "样例字体  Example Text";
        //if click ok
        if (fontDlg.Run() == (int)ResponseType.Ok)
        {
            //get fontDesc
            Pango.FontDescription selectFont =
                Pango.FontDescription.FromString(fontDlg.FontName);

            //set font
            font_tag.FontDesc = selectFont;

            //if user selected some text
            //change selected text font
            //else change all text font
            TextIter start, end;
            if (TextView.Buffer.GetSelectionBounds(out start, out end))
            {
                TextView.Buffer.ApplyTag(font_tag, start, end);
            }
            else
            {
                TextView.ModifyFont(selectFont);
            }
        }
        //detory window
        fontDlg.Destroy();
    }
コード例 #2
0
    protected void OnFuenteActionActivated(object sender, EventArgs e)
    {
        FontSelectionDialog Fuente = new FontSelectionDialog("Fuente");

        if (Fuente.Run() == (int)ResponseType.Ok)
        {
            Editor.Formato_de_Texto(Fuente.FontName);
            Fuente.Destroy();
        }
        Fuente.Destroy();
    }
コード例 #3
0
        void CreateFontWidget()
        {
            var font = new Button(Stock.SelectFont);

            font.Clicked += delegate
            {
                var fs = new FontSelectionDialog(_("Select Font"));
                fs.Run();
                fs.Hide();
            };
            AttachAligned(0, 2, _("Font:"), 0.0, 0.5, font, 1, true);
        }
コード例 #4
0
    public void OnFontActivate(object o, EventArgs args)
    {
        string fontname = null;
        FontSelectionDialog openFontSelection = new FontSelectionDialog("RSVP Font");

        openFontSelection.SetFontName(fontName);
        openFontSelection.Run();
        fontname = openFontSelection.FontName;
        fontName = fontname;
        ShowWord(curWord);
        openFontSelection.Destroy();
    }
コード例 #5
0
    public void OnSettingsSelectFont(object sender, EventArgs args)
    {
        FontSelectionDialog fsd = new FontSelectionDialog("Select Font");

        try {
            fsd.SetFontName(Font);
            if (fsd.Run() == (int)Gtk.ResponseType.Ok)
            {
                Font = fsd.FontName;
            }
        }
        finally {
            fsd.Destroy();
        }
    }
コード例 #6
0
    protected void OnFontAction1Activated(object sender, EventArgs e)
    {
        FontSelectionDialog font = new FontSelectionDialog("Select font name");

        font.Response += delegate(object o, ResponseArgs resp) {
            if (resp.ResponseId == ResponseType.Ok)
            {
                Pango.FontDescription fontsel =
                    Pango.FontDescription.FromString(font.FontName);
                textview1.ModifyFont(fontsel);
            }
        };

        font.Run();
        font.Destroy();
    }
コード例 #7
0
    protected void changeFont(object o, EventArgs e)
    {
        FontSelectionDialog d = new FontSelectionDialog("FONT!");

        d.SetFontName(settings.font);
        if ((ResponseType)d.Run() == ResponseType.Ok)
        {
            for (int i = 0; i < notebook.NPages; i++)
            {
                ((TextView)((ScrolledWindow)notebook.GetNthPage(i)).Child).ModifyFont(Pango.FontDescription.FromString(d.FontName));
            }
        }
        settings.font = d.FontName;
        d.Destroy();
        settings.save();
        tree.ModifyFont(Pango.FontDescription.FromString(settings.font));
        return;
    }
コード例 #8
0
        protected virtual void OnPipeFontBrowseButtonClicked(object sender, System.EventArgs e)
        {
            FontSelectionDialog FontDlg = new FontSelectionDialog("Select Pipe Font");

            FontDlg.SetFontName(PipeFont);

            try
            {
                if (FontDlg.Run() == (int)ResponseType.Ok)
                {
                    PipeFont = FontDlg.FontName;
                }
            }
            finally
            {
                FontDlg.Destroy();
            }
        }