Solved

URGENT !!! CTabCtrl creation without border

Posted on 1998-07-16
6
616 Views
Last Modified: 2013-11-20
How can i create a ctabctrl without a bourder.
I have painted the CtabCtrl with black and i want the tab
items bourder or to be black too , or not to be created
as a border tabcontrol . How Can it be done or the border
to be black ???
0
Comment
Question by:moshei
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
6 Comments
 
LVL 2

Expert Comment

by:duneram
ID: 1319302
Hi,

In windows, every control in itself is a window.  Keep that in mind and you will always be able to find solutions.  Every window has the ability to have Window Styles.  You can find these styles in the include file:   winuser.h    In that file you will find a style named
WS_BORDER.

All of the window styles pretty much start with WS_   There are some extended styles you can use too like  WS_EX_TRANSPARENT   stuff like that.

With experimentation at run time you can modify the appearance of a given 'window' / 'control' by doing a (16 bits) GetWindowWord  and SetWindowWord to whatever window style you are setting.  If using 32 bits use GetWindowLong and SetWindowLong.

An example:
HWND hWnd = FindWindow("WordPadClass",NULL); // the WordPad app main window
long x = GetWindowLong(hWnd, GWL_STYLE);

Now if it contains the WS_BORDER, remove it then
x ~= WS_BORDER;
//call SetWindowLong and give it the new value of x (minus the WS_BORDER)
SetWindowLong(hWnd, GWL_STYLE,  x);

and the WS_BORDER style will be gone.


Hope this helps.   yOU Can use this methodology to change the 'style' of any window at runtime.



0
 

Author Comment

by:moshei
ID: 1319303
When Using the GetWindowLong i recieve a long number .
How Can i Know from this number whether the WS_BORDER is set
why is x~=WS_BORDER not working ( from your answer )
0
 
LVL 2

Expert Comment

by:duneram
ID: 1319304
Using  GetWindowLong(hWnd, GWL_STYLE)...

That number you receive from GetWindowLong is explained in Microsoft's knowledgebase in article #Q83366.

Essentially that number contains the full attributes for the style of a window.  You can check if  a given attribute is part of that number by masking & testing like this (in C)

Here is a function that will remove a given style for a window.

void CNoborderDlg::RemoveStyle(HWND hWnd, long Style)
{
    long x;
      x = GetWindowLong(hWnd, GWL_STYLE);
      if (x & Style)
      {
            x &= ~(Style) ; /* REMOVING IT FROM X */
            SetWindowLong(hWnd, GWL_STYLE, x);
      }

}
I typed it wrong in the first example so thats why it didn't work.  you can repeat that style of checking and setting for any of the attributes you are interested in.  I will take a look and see why it didn't work.
0
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 
LVL 2

Expert Comment

by:duneram
ID: 1319305
It looks like I was mistaken.  You are probably going to have to deal with the WM_PAINT command...


0
 
LVL 9

Accepted Solution

by:
Priyesh earned 70 total points
ID: 1319306
Hi moshie..
      Let oTabCtrl be u'r tabctrl object.. then.. the following code can help to remove border.
      HWnd hWnd =  oTabCtrl.m_hWnd ;
      long lCurStyle  = GetWindowLong(hWnd, GWL_STYLE);
      lCurStyle &= ~WS_BORDER ;
      SetWindowLong(hWnd, GWL_STYLE, lCurStyle);
Try it.

0
 
LVL 2

Expert Comment

by:duneram
ID: 1319307
same algorithm...
0

Featured Post

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question