| |

VerySource

 Forgot password?
 Register
Search
View: 587|Reply: 4

How to set the default properties of inherited controls? ? ? ?

[Copy link]

2

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-1-31 10:20:01
| Show all posts |Read mode
Can't find it on Baidu?
For example, I inherited the calendar
How to set its background color to red
public class jichengcalendar: Calendar
{
    public jichengcalendar ()
    {
       
    }
What should I write?
}
Please help
Reply

Use magic Report

0

Threads

26

Posts

21.00

Credits

Newbie

Rank: 1

Credits
21.00

 China

Post time: 2020-3-16 14:30:02
| Show all posts
Use BackColor property directly
public jichengcalendar ()
    {
       this.BackColor = Brushes.Red
    }
Reply

Use magic Report

0

Threads

27

Posts

21.00

Credits

Newbie

Rank: 1

Credits
21.00

 China

Post time: 2020-3-17 10:45:01
| Show all posts
correct.
Reply

Use magic Report

2

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

 Author| Post time: 2020-3-19 21:15:01
| Show all posts
Still not working, CS0029: Cannot implicitly convert type "System.Drawing.Brush" to "System.Drawing.Color"
The color.red I use doesn't matter but it doesn't report an error or the yellow default
Reply

Use magic Report

2

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 France

 Author| Post time: 2020-3-20 16:15:01
| Show all posts
I know what's wrong, I wrote an extra class, thanks
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list