Print Page | Close Window

How to change a skin attribute at runtime

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Skin Framework
Forum Description: Topics Related to Codejock Skin Framework
URL: http://forum.codejock.com/forum_posts.asp?TID=19602
Printed Date: 26 April 2024 at 4:46am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How to change a skin attribute at runtime
Posted By: Sergio
Subject: How to change a skin attribute at runtime
Date 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



Replies:
Posted By: Sergio
Date Posted: 28 March 2012 at 6:06am
Please help !

-------------
Sergio


Posted By: Sergio
Date 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


Posted By: Algae
Date 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.


Posted By: Sergio
Date 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


Posted By: Algae
Date 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.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net