Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Skin Framework
  New Posts New Posts RSS Feed - How to change a skin attribute at runtime
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to change a skin attribute at runtime

 Post Reply Post Reply
Author
Message
Sergio View Drop Down
Senior Member
Senior Member
Avatar

Joined: 18 September 2006
Status: Offline
Points: 216
Post Options Post Options   Thanks (0) Thanks(0)   Quote Sergio Quote  Post ReplyReply Direct Link To This Post Topic: How to change a skin attribute at runtime
    Posted: 26 March 2012 at 5:27am
Hello,

I would like to know how can I change the attribute (dialog background color) of a skin after having loaded it. I'm currently using Codejock version 15.2.1.


I have tried :

XTPSkinManager()->GetSchema()->GetMetrics()->m_clrTheme[COLOR_BTNFACE + TMT_FIRSTCOLOR] = RGB(255,0,0);

or

XTPSkinManager()->GetSchema()->CreateProperty(_T("BtnFace"), XTP_SKINPROPERTY_COLOR, _T("230;230;230"));

or

XTPSkinManager()->GetSchema()->GetProperty(?) // ----> This method isn't public.

or

XTPColorManager()->SetColor(COLOR_BTNFACE, RGB(255,0,0));
XTPColorManager()->RefreshColors();


Please help, thanks.

Regards,
Sergio
Back to Top
Sergio View Drop Down
Senior Member
Senior Member
Avatar

Joined: 18 September 2006
Status: Offline
Points: 216
Post Options Post Options   Thanks (0) Thanks(0)   Quote Sergio Quote  Post ReplyReply Direct Link To This Post Posted: 28 March 2012 at 6:06am
Please help !
Sergio
Back to Top
Sergio View Drop Down
Senior Member
Senior Member
Avatar

Joined: 18 September 2006
Status: Offline
Points: 216
Post Options Post Options   Thanks (0) Thanks(0)   Quote Sergio Quote  Post ReplyReply Direct Link To This Post Posted: 03 July 2015 at 5:09am
Hello,

We now really need this feature. Could you please answer?

We want to modify skin attributes at runtime upon specific criterions, and we always want to use your skin project files without having to update them for each release.

Thanks in advance.
Sergio
Back to Top
Algae View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 January 2007
Location: United States
Status: Offline
Points: 217
Post Options Post Options   Thanks (0) Thanks(0)   Quote Algae Quote  Post ReplyReply Direct Link To This Post Posted: 21 July 2015 at 4:16pm
Hello Sergio,

I'm not sure if this will help you since I am somewhat unclear about your request and I do not have your version readily available.

At any rate, setting this permits skin colors to be applied:

XTPSkinManager()->SetApplyOptions(dwApplyOptions | xtpSkinApplyColors);

Also some "theme" types require setting the Luna for colors as well. See:

SetLunaTheme(XTPCurrentSystemTheme systemTheme)

Most of the skin features are illustrated within SkinMDISample. As far as I know, skins and colors can be dynamically changed readily but require lots of screen element redrawing. This could become a performance issue if you did it a lot.
Back to Top
Sergio View Drop Down
Senior Member
Senior Member
Avatar

Joined: 18 September 2006
Status: Offline
Points: 216
Post Options Post Options   Thanks (0) Thanks(0)   Quote Sergio Quote  Post ReplyReply Direct Link To This Post Posted: 23 November 2016 at 9:00am
Hello Algae,

We just need to do that when the application starts.

We want to avoid having to change every time the Office2010.cjstyles on the Skin Builder to merge our changes in a new Codejock Release. This is time consuming and not really easy to do.

So, we would like to load the factory skin Office2010 and then just update it by source code, and we won't have to make changes in Codejock folder anymore.

Could you please give us (just the line of code):
  • one example to change comboboxes border color
  • one example to change tab controls content background color
  • one example to change a background bitmap
Thanks in advance,
Sergio
Back to Top
Algae View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 January 2007
Location: United States
Status: Offline
Points: 217
Post Options Post Options   Thanks (0) Thanks(0)   Quote Algae Quote  Post ReplyReply Direct Link To This Post Posted: 23 November 2016 at 1:09pm

Combobox border color. Create a brush, then get XTPComboboxTheme to DrawBackground or DrawFrame.

DrawFrame(pDC->GetSafeHdc(), rc, 3, hBrush);

*See XTPComboBoxTheme.cpp

Tab control.

m_wndTabControl.GetPaintManager()->SetColor(xtpTabColorVisualStudio2010);

* See sample: GUI_OneNote

Bitmap background. I don't know of a CJ method for this. There may be one but this is what I use. It really depends on the background but this puts a bitmap on a designated client rect .. stretched to fit. Change the Blt to desired style.

// header
CBitmap m_bmp;

// init somewhere
m_bmp.LoadBitmap(IDB_MYBITMAP); // bitmap resource

// cpp
CPaintDC dc(this);      // device context for painting

CRect rClient;

 // where idc_bitmap_rect is your background area
CWnd *pWnd = (CWnd*)GetDlgItem(IDC_BITMAP_RECT);

pWnd->GetWindowRect(&rClient);
ScreenToClient(&rClient);

CDC      MemDC;
BITMAP   bit;

m_bmp.GetBitmap(&bit);
MemDC.CreateCompatibleDC(&dc);
MemDC.SelectObject(m_bmp);

dc.StretchBlt(rClient.left, rClient.top, rClient.Width(), rClient.Height(),
     &MemDC, 0, 0, bit.bmWidth, bit.bmHeight, SRCCOPY);

DeleteObject(MemDC);

This is probably not as complete as you might like, but should point you in the right direction. Hope it helps out.

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.184 seconds.