Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6621147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:12:07+00:00 2026-05-25T21:12:07+00:00

I was trying to create two different kinds of buttons: buttons with background and

  • 0

I was trying to create two different kinds of buttons: buttons with background and buttons without background.
And unfortunately I can’t figure out how I can set some buttons to use the first style and some buttons to use the second.
Here’s a code sample (although i doubt it’ll help)
Is there some way to change the Style of the button in the .cs file, or any workaround?

//init hyperlink


    Button hyperlink = new Button();

    Label hyperlink_label = new Label();

    hyperlink_label.Text = hyperlink_text;

    hyperlink_label.ModifyFg(StateType.Normal, new Gdk.Color(0,0,0));

    hyperlink_label.ModifyFg(StateType.Prelight, new Gdk.Color(255,255,255));

    hyperlink_label.ModifyFg(StateType.Selected, new Gdk.Color(255,255,255));

    Pango.FontDescription hyperlinkFontDesc = new Pango.FontDescription();

    hyperlinkFontDesc.Family = "Adobe Garamond Pro";

    hyperlinkFontDesc.AbsoluteSize = hyperlink_fontSize * Pango.Scale.PangoScale;

    hyperlink_label.ModifyFont(hyperlinkFontDesc);

    hyperlink.Add(hyperlink_label);

    mainWindowFixed.Put(hyperlink, hyperlink_pos[0], hyperlink_pos[1]);





    //init startbutton

    Button startButton = new Button();

    Label startLabel = new Label();

    startLabel.Text = startButton_text;

    startButton.Settings.ThemeName = "Ludwig_AutoUpdater";

    startLabel.ModifyFg(StateType.Normal, new Gdk.Color(255,255,255));

    startLabel.ModifyFg(StateType.Prelight, new Gdk.Color(255,255,255));

    startLabel.ModifyFg(StateType.Selected, new Gdk.Color(255,255,255));

    Pango.FontDescription startLabelFontDesc = new Pango.FontDescription();

    startLabelFontDesc.Family = "Klavika bd";

    startLabelFontDesc.AbsoluteSize = startButton_fontSize * Pango.Scale.PangoScale;

    startButton.Add(startLabel);

    startButton.Child.ModifyFont(startLabelFontDesc);

    startButton.SetSizeRequest(startButton_size[0], startButton_size[1]);

    mainWindowFixed.Put(startButton, startButton_pos[0],startButton_pos[1]);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:12:09+00:00Added an answer on May 25, 2026 at 9:12 pm

    Don’t change the style of Gtk.Button. Create a custom widget derived from Gtk.Button and change that widget’s style. For example:

     public class BGButton : Gtk.Button {}
    

    and

     public class NoBGButton : Gtk.Button {}
    

    and now change the style of BGButton and NoBGButton.
    Then if you want a Button with a Background use BGButton , else use NoBGButton.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a simple form with two different submit buttons: one which
I'm trying to create a Foreign Key out of two values in two different
I am trying to create two different sets of settings for datepicker( http://keith-wood.name/datepick.html )
I'm trying to create two functions: get & set, that both accept an arbitrary
Hi every one i'm trying to create two divs. One div has a different
I'm trying to create two different routes on two different action methods like this:
I am trying to create two separate sessions- one for if the user is
I am trying to create two separate sessions- one for if the user is
I'm trying to create two ASP.NET Membership login pages for an ASP.NET website I'm
I am trying to create two select lists both filled with the same times.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.