11. Dezember 200817 j Servus, ich würde gerne so ein paar abfragen machen und jenachdem welche parameter true oder false sind, etwas bestimmtes machen. nun sieht mein code so aus: if((Form1::util->getFontItalic()) && !(Form1::util->getFontBold())) this->dataGridView1->RowTemplate->DefaultCellStyle->Font = (gcnew ::Font(fontFamily, size, FontStyle::Italic, GraphicsUnit::Point, static_cast<System::Byte>(0))); else if((Form1::util->getFontBold()) && !(Form1::util->getFontItalic())) this->dataGridView1->RowTemplate->DefaultCellStyle->Font = (gcnew ::Font(fontFamily, size, FontStyle::Bold, GraphicsUnit::Point, static_cast<System::Byte>(0))); else this->dataGridView1->RowTemplate->DefaultCellStyle->Font = (gcnew ::Font(fontFamily, size, FontStyle::Regular, GraphicsUnit::Point, static_cast<System::Byte>(0))); ich würde das aber gerne ein bisschen einfach machen und nicht immer wieder alles hinschreiben. es ändert sich immer nur das FontStyle. für Hilfe wäre ich dankbar. Grüsse Grey
11. Dezember 200817 j hmm... if((Form1::util->getFontItalic()) && !(Form1::util->getFontBold())) this->dataGridView1->RowTemplate->DefaultCellStyle->Font.Style = FontStyle::Italic; else if((Form1::util->getFontBold()) && !(Form1::util->getFontItalic())) this->dataGridView1->RowTemplate->DefaultCellStyle->Font.Style = FontStyle::Bold; else this->dataGridView1->RowTemplate->DefaultCellStyle->Font.Style = FontStyle::Regular;
11. Dezember 200817 j Ich bin zwar nicht so fit in .NET, aber ginge nicht so etwas: switch true case a && !B a b c d; break; case a && !C x y z; break otherwise tu was anderes Phil
11. Dezember 200817 j Nein, in .Net will er konstante Werte im Case haben. Vgl Errormessage: Error 1 A constant value is expected
11. Dezember 200817 j FontStyle style = FontStyle::Regular; if((Form1::util->getFontItalic()) && !(Form1::util->getFontBold())) style = FontStyle::Italic; else if((Form1::util->getFontBold()) && !(Form1::util->getFontItalic())) style = FontStyle::Bold; this->dataGridView1->RowTemplate->DefaultCellStyle->Font = (gcnew ::Font(fontFamily, size, style, GraphicsUnit::Point, static_cast<System::Byte>(0))); [/PHP]
12. Dezember 200817 j FontStyle style = FontStyle::Regular; if((Form1::util->getFontItalic()) && !(Form1::util->getFontBold())) style = FontStyle::Italic; else if((Form1::util->getFontBold()) && !(Form1::util->getFontItalic())) style = FontStyle::Bold; this->dataGridView1->RowTemplate->DefaultCellStyle->Font = (gcnew ::Font(fontFamily, size, style, GraphicsUnit::Point, static_cast<System::Byte>(0))); [/PHP] danke, so hat es geklappt
Archiv
Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.