Class library: Button class and ButtonGroup class for DISCO-F746NG. クラスライブラリ: DISCO-F746NG 用の,Button クラス,ButtonGroup クラス.

Dependents:   F746_SpectralAnalysis_NoPhoto F746_Fourier_series_of_square_wave_01 F746_ButtonGroup_Demo F746_Mandelbrot ... more

Revision:
5:2cc388e91bde
Parent:
4:543ec60c2814
Child:
10:5ca60e724a76
--- a/button.cpp	Sat Dec 05 11:09:29 2015 +0000
+++ b/button.cpp	Tue Dec 08 14:19:41 2015 +0000
@@ -1,7 +1,7 @@
 //-----------------------------------------------------------
 //  Button class
 //
-//  2015/12/05, Copyright (c) 2015 MIKAMI, Naoki
+//  2015/12/08, Copyright (c) 2015 MIKAMI, Naoki
 //-----------------------------------------------------------
 
 #include "button.hpp"
@@ -21,12 +21,10 @@
             lcd_.SetBackColor(color);
             lcd_.SetTextColor(textColor);
 
-            sFONT *font = lcd_.GetFont();
-            uint16_t x0 = X_ + (W_ - (font->Width)*(STR_.length()))/2;
-            uint16_t y0 = Y_ + (H_ - font->Height)/2;
-
-            lcd_.DisplayStringAt(x0, y0, (uint8_t *)STR_.c_str(), LEFT_MODE);
-            
+            uint16_t x0 = X_ + (W_ - FONT_WIDTH_*(STR_.length()))/2;
+            uint16_t y0 = Y_ + (H_ - FONT_HEIGHT_)/2 + 1;
+            lcd_.DisplayStringAt(x0, y0, (uint8_t *)STR_.c_str(),
+                                 LEFT_MODE);
             lcd_.SetBackColor(BACK_COLOR_); // recover back color
         }            
     }