Register for your free account! | Forgot your password?

You last visited: Today at 00:51

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



GDI+

Discussion on GDI+ within the C/C++ forum part of the Coders Den category.

Reply
 
Old   #1
 
Doktor.'s Avatar
 
elite*gold: 0
Join Date: Aug 2011
Posts: 1,190
Received Thanks: 549
GDI+

Wurde leider in Google nicht fündig, ich hab mir eine Form erstellt und die Opacity auf 0.1 gesetzt, also sogut wie nicht sichtbar.
Jetzt würde ich aber gerne mit GDI+ einen Text in die Form schreiben, das Problem dabei ist aber das der Text mit Transparent wird und somit dann irgendwie nutzlos.

Code:
QWidget *m = new QWidget;
m->setGeometry(50, 50, 150, 150);
m->setWindowTitle("Test");
m->show();
m->setWindowOpacity(0.1);

DWORD gdiStartup;
GdiplusStartupInput gdiStartupInp;
GdiplusStartup(&gdiStartup, &gdiStartupInp, NULL);

SolidBrush brush_Red(Color(255, 255, 0, 0));
HWND h = FindWindowA(0, "Test");
Graphics gdiGraphic(GetDC(h));

FontFamily  fontFamily(L"Times New Roman");
Font        font(&fontFamily, 24, FontStyleRegular, UnitPixel);
PointF      pointF(1, 1);
gdiGraphic.DrawString(L"Test Text", 9, &font, pointF, &brush_Red);
Frage: Wie schaff ich es mit GDI+ auf die Transparente Form zu schreiben, so dass der Text voll sichtbar ist, aber die Form transparent bleibt?
Doktor. is offline  
Old 12/09/2013, 15:47   #2
 
XxharCs's Avatar
 
elite*gold: 34
Join Date: Apr 2011
Posts: 1,475
Received Thanks: 1,228
Nie GDI+ verwendet, aber dies sollte dir helfen.
Musst es halt an deine Zwecke anpassen:
XxharCs is offline  
Old 12/09/2013, 18:51   #3
 
Doktor.'s Avatar
 
elite*gold: 0
Join Date: Aug 2011
Posts: 1,190
Received Thanks: 549
Quote:
Originally Posted by XxharCs View Post
Nie GDI+ verwendet, aber dies sollte dir helfen.
Musst es halt an deine Zwecke anpassen:
Quote:
Originally Posted by MSDN
The first line uses an alpha component of 255, so it is opaque. The second and third lines use an alpha component of 128, so they are semitransparent;
Hab 255 als auch 128 ausprobiert, passt sich immer wieder am Fenster an.

Zur Not kann ich auch auf QPainter wechseln, sofern jemand weis wie es damit gehen würde.
Doktor. is offline  
Old 12/11/2013, 14:59   #4
 
Doktor.'s Avatar
 
elite*gold: 0
Join Date: Aug 2011
Posts: 1,190
Received Thanks: 549
Niemand eine Idee?
Doktor. is offline  
Reply




All times are GMT +1. The time now is 00:52.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.