我在winform应用程序中使用MaterialSkin。我想要两种形式的不同颜色方案,但是当我打开第二种形式 - 两种形式的样式更改。
第一(主)形式的代码:
/**
* The application's global HTTP middleware stack.
*
* These middleware are run during every request to your application.
*
* @var array
*/
protected $middleware = [
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
];
/**
* The application's route middleware groups.
*
* @var array
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
'api' => [
'throttle:60,1',
'bindings',
],
];
第二种形式的代码:
public partial class Form1 : MaterialForm
{
private readonly MaterialSkinManager materialSkinManager = MaterialSkinManager.Instance;
public Form1()
{
InitializeComponent();
// Create a material theme manager and add the form to manage (this)
materialSkinManager.AddFormToManage(this);
materialSkinManager.Theme = MaterialSkinManager.Themes.DARK;
// Configure color schema
materialSkinManager.ColorScheme = new ColorScheme(
Primary.BlueGrey800, Primary.BlueGrey900,
Primary.BlueGrey500, Accent.LightBlue200, TextShade.WHITE);
}
private void materialRaisedButton3_Click(object sender, EventArgs e)
{
Form2 form2 = new Form2();
if(form2.ShowDialog() == DialogResult.OK)
{
MessageBox.Show("OK");
}
}
private void Form1_Load(object sender, EventArgs e)
{
}
请帮帮我
答案 0 :(得分:0)
MaterialSkinManager
是一个单例,这意味着它只有一个实例。因此,当您在第二个窗口中更改颜色方案时,它也会更改第一个窗口的颜色方案。
我查看了GitHub上的代码,我认为不支持两种不同的方案,这是有道理的,因为您希望UI看起来一致。