Win32 Window's Border color


Hi, how can I change window's (control) border color?
Ohh and what's the deafult font in .NET?
Thank you :).
Last edited on
Somebody?
I don't think you can change the border colour on a standard control without
making a owner draw control (because the painting for these is provided by windows)

with regard to the default font - maybe this will answer your question:
http://benhollis.net/blog/2007/04/11/setting-the-correct-default-font-in-net-windows-forms-apps/
Ohh and what's the deafult font in .NET?

The default font in .NET is Microsoft Sans Serif, if that is what you are asking. :)

Ohh TNX man :).
Well ,do you know how can I change the contolers border?
Help?
How can I change window's (control) border color?
Guys? Sombody? Please?
Often answered on usenet (NC)
you can ask on Win32 api newsgroup :
news://nntp.aioe.org/comp.os.ms-windows.programmer.win32
or http://tinyurl.com/cmhb5g by Google
OK ...
somebody?
Please Guys!!! :(
if you are talking about C++/CLI or C# - I have no idea as I don't use either of those.
closed account (z05DSL3A)
override onPaint and call ControlPaint.DrawBorder() something like:
1
2
3
4
5
protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            ControlPaint.DrawBorder(e.Graphics, base.ClientRectangle, this.BackColor, ButtonBorderStyle.Solid);
        }


Finally I made it!!!!!!!!!!
It made me search in google for long hours but finally I found it, I combined some code I found and code from MDSN and it finally did it!

I use CreateWindowEx and add extra style that called WS_EX_CLIENTEDGE, after that u need to add this code that change a bit the style so the client edge will be closer (I don't know how, but that's what it does I guess XD) and that's it .
Well tnx for helping me anyway .
this is the whole code of how to create a normal edit control with pure C++ code Win32:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
	#define _WIN32_WINNT 0x0502
#define _WIN32_IE 0x0600
#define _WINVER 0x0502 
#define ISOLATION_AWARE_ENABLED 1
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='X86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif 

// Visual Styles are enabled
....

HFONT DeafultFont = CreateFont(-11,0,0,0,FW_NORMAL,false,false,false,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,FF_DONTCARE,"Microsoft Sans Serif");
// DeafultFont 
.....

case WM_CREATE: {
		  hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "", 
        WS_CHILD | WS_VISIBLE, 
        5, 200, 100, 20, hwnd, (HMENU)22, GetModuleHandle(NULL), NULL);
SendMessage(hEdit ,WM_SETFONT,(WPARAM)DeafultFont ,MAKELPARAM(true,0));
//Creating the control
...
		case WM_GETDLGCODE:
	{
		if(wParam == VK_RETURN)
	{
		return 0;     // Pass Enter key on to EDIT control
		}
		// Escape and Tab still used for dialog navigation 
		return DLGC_WANTARROWS|DLGC_WANTCHARS;
		break;
	}
//Sending the WM_GETDLGCODE message 
...


Hope it helped somebody :)
Last edited on
There's just one thing that bothers me, I'm sure that I didn't really made a border, it's just a trick to make the edit control looks like it has a border, so If u know how can I really change the border color (cause I may want to change it :O) I'll be glad to hear how :D.
Last edited on
Topic archived. No new replies allowed.