| View previous topic :: View next topic |
| Author |
Message |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Sat May 10, 2008 12:35 pm Post subject: |
|
|
Create a textbox then create a font and make the italic parameter valid, then send WM_SETFONT to the edit control. Then use SetTextColor (use GetDC to get the HDC paramater) then the color ref will be the function RGB(r,g,b)
CreateFont - http://msdn.microsoft.com/en-us/library/ms534214(VS.85).aspx
SetTextColor - http://msdn.microsoft.com/en-us/library/ms534209(VS.85).aspx
Then filter WM_NOTIFY and switch case for EN_CHANGE or EN_SETFOCUS and then SetDlgItemText to "" when changed if text is the default (GetDlgItemText and _tcscmp with default text)
_________________
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Sat May 10, 2008 12:43 pm Post subject: |
|
|
Cool. Thanks lurc. But what about the label one. Because that's a little more important to me.
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Sat May 10, 2008 12:54 pm Post subject: |
|
|
in the WNDCLASSEX struct definition change the Background struct thing to (HBRUSH)(COLOR_BTNSHADOW)
_________________
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Sat May 10, 2008 1:17 pm Post subject: |
|
|
| lurc wrote: | Create a textbox then create a font and make the italic parameter valid, then send WM_SETFONT to the edit control. Then use SetTextColor (use GetDC to get the HDC paramater) then the color ref will be the function RGB(r,g,b)
CreateFont - http://msdn.microsoft.com/en-us/library/ms534214(VS.85).aspx
SetTextColor - http://msdn.microsoft.com/en-us/library/ms534209(VS.85).aspx
Then filter WM_NOTIFY and switch case for EN_CHANGE or EN_SETFOCUS and then SetDlgItemText to "" when changed if text is the default (GetDlgItemText and _tcscmp with default text) |
Say I wanted to make the text color red (I'm not), would I do:
| Code: |
SetTextColor(dc, RGB(255, 0, 0));
|
or
| Code: |
SetTextColor(dc, RGB(FF, 00, 00);
|
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Sat May 10, 2008 1:53 pm Post subject: |
|
|
yes cept for the second one FF is hex so you gotta do 0xFF
_________________
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Sat May 10, 2008 5:11 pm Post subject: |
|
|
Hey how do I switch case for EN_SETFOCUS. Like, for the specific controls. Here's my current code, but I don't think it's right at all.
| Code: |
case WM_NOTIFY:
switch(LOWORD(wParam)) {
case IDC_NAME_EDIT:
switch(HIWORD(wParam)) {
case EN_SETFOCUS:
int len2 = GetWindowTextLength(GetDlgItem(hwnd, IDC_NAME_EDIT));
char Ndefault[] = "Enter name here...";
char *test;
test = (char*)GlobalAlloc(GPTR, len2+1);
GetDlgItemText(hwnd, IDC_NAME_EDIT, test, len2+1);
if(strcmp(test, Ndefault) == 0) {
SetDlgItemText(hwnd, IDC_NAME_EDIT, "");
}
GlobalFree((HANDLE)test);
break;
}
break;
}
break;
|
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Sat May 10, 2008 5:19 pm Post subject: |
|
|
God, one of the most annoying things is when people come in with errors and don't know how to fix them when the answer is right there.
you HAVE to learn to fix your own errors. Exp. Linking errors mean you have to link to the right lib so you google comctl and get the MSN page and find the right lib.
_________________
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Sat May 10, 2008 5:20 pm Post subject: |
|
|
Lol jeez, Blankrider. Way to hurt my feelings, jk. I know, but with this kind of error when most of the thread was based on this, it was quicker just to post and get an answer rather then google it. But we're past that lol.
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Sat May 10, 2008 5:33 pm Post subject: |
|
|
lol i went through the same thing except much more intelligent people told me that xP
_________________
|
|
| Back to top |
|
 |
|