Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

DataGridView Font ändern

Empfohlene Antworten

Veröffentlicht

Hallo,

wie die überschrift schon sagt, würde ich gerne mein ganzes Datagrid in z.b Verdana anzeigen lassen.

ich hab hier so einen kleinen Ansatz:

(habs in VC++ übersetzt)


this->dataGridView1->DefaultCellStyle->Font = gcnew Font("Verdana", 15);

vorher in C#

this.dataGridView1.DefaultCellStyle.Font = new Font("Verdana", 15);

hab ich was falsch übersetzt? hier der Fehler:
query_loader\Form1.h(201) : error C2061: Syntaxfehler: Bezeichner 'Font'

ok ich war vllt ein bisschen voreilig...

das fuzt dann wohl so:

dataGridViewCellStyle1->Font = (gcnew System::Drawing::Font(L"Verdana", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 				static_cast<System::Byte>(0)));

geht auch.

nur kann mir einer sagen, wieso hier nur jede zweite zeile in "Verdana" dargestellt ist?

hmm danke für den Tipp ;)

Bei mir läuft das einwandfrei.. Jede zeile wird in Verdana dargestellt.

Wo initialisiert du den befehl denn ?

Hab ihn einfach in Main_Load gepackt...

Kann ja sein das du den irgendwo beim füllen des datagrids initialisierts und es da bei Probleme gibt.

Sonst gerade keine idee...

hmm danke für den Tipp ;)

Bei mir läuft das einwandfrei.. Jede zeile wird in Verdana dargestellt.

Wo initialisiert du den befehl denn ?

Hab ihn einfach in Main_Load gepackt...

Kann ja sein das du den irgendwo beim füllen des datagrids initialisierts und es da bei Probleme gibt.

Sonst gerade keine idee...

wie hast du das denn genau gemacht?

Also ich hab in meiner Form1.h



DataGridViewCellStyle^  dataGridViewCellStyle1;


deklariert und dann in meiner Form1.cpp mit



dataGridViewCellStyle1 = (gcnew DataGridViewCellStyle());


im Konstruktor initialisiert dann in der Form1_Load



dataGridViewCellStyle1->Font = (gcnew System::Drawing::Font(L"Verdana", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0)));

this->dataGridView1->AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;



aufgerufen oder was auch immer..

leider sehe ich nur jede zweite zeile in Verdana.

Kann es sein, dass es an dem "AlternatingRowsDefaultCellStyle" liegt?

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.