AlexBB

This question should be addressed directly to Mick Doherty, a great guy who helped me to set custom tabPage control in motion.

Mick hi,

Your tabControl has been doing quite well in my major application. 6 weeks ago I had to switch to Vista and that caused innumerable problems in various areas but your TabControlDontNetrix survived the transition unscathed.

A few days ago I decided to set up another project with a form and a tabControl in it. I copied your entire class and the dll file and opened the form. Some strange things happened.

The tabs themselves are colored. If you remember (I had a long thread running in this forum a few months ago) the fact that the tabs were gray with MS tabControl caused me to seek help in the first place. Thus, in this new form, the tabs are fine but the pages themselved are blank (white). They do not have any background color at all. In other words the BackColor does not spread on to them. It is quite weird.

Also, if you remember, I was first surprised that the tabs were separated (padded) by spaces and I spent some time trying to bring them closer together. That failed, I came to terms with the separation and has come to like it as a matter of fact.

Now, in this new form the tabs are as close together as any in MS tabControl. Could you believe it

I don't know what to make of it. Your tabControl has made my life much easier because it is better visually in terms of selection and grasping the situation but I cannot afford to spend much time studying it in depth and trying to figure out why this happens. So, if you have any insight into this strange dichotomy: the same class behaves differently in two different projects, please, suggest a solution or perhaps an avenue where I could tinker a few lines of code.

Many thanks.





Re: Windows Forms General DotNetrix question

AlexBB

OK Mick,

You won't believe what is happening. This Vista is something. After about 4-5 hours of work (mostly debugging) I found that your TabControlDotNetrix began painting my seond form but my first form acquired the same malady: the tabs are colored but the pages are not. Vista made a tradeoff!

Aside from that VS2005 is screwing my desktop colors to immense degree. Once I bring it up the desctop shrinks, rich colors disappear and everything looks weird like they sometimes show in some commercials to enhance psychological effects: you see colored shadows where there were forms.

Very few people understgand how handle Vista and perhaps you will not be able to help. It is weird. I do not think your control has anything to do with it. There is no regularity at all.






Re: Windows Forms General DotNetrix question

AlexBB

It seems I found out what is going on but how to fix it

When I invoke (bring up) VS2005 it automatically sets up the screen color resolution to 8-bit instead of true colors (32 bits). If I go to Control Panel==>Displays, etc and change the setting, everything gets back to normal until I close and restart VS2005 again.

Anyone knows how to fix it

Thanks.






Re: Windows Forms General DotNetrix question

AlexBB

OK, I fixed that. VS2005 had a desktop link and in the property==>Compatibility over there I checked the box "run in 256 colors" for some reason earlier, sort of an idiotic experiment. This is why it would set the whole OS back to stone age.

OK, now my first form is back to normal and the second one is back to abnormal.






Re: Windows Forms General DotNetrix question

Mick Doherty

HI Alex,

You'd be better off contacting me via the Contact link on my site, I respond much quicker to email as I check them more often.

I don't use Vista as VS2003 is not supported. I don't use VS2005 because it doesn't handle custom collections or custom typeconverters very well. By this I mean that when building custom Controls, if the control has either of these then the Control will fail in the IDE after every rebuild (Have a look at the SelectedPanel property in PanelManager or look around for the various reports of "object of type xtype cannot be converted to object of type xtype"). These issues do not arise in a compiled dll, but if you add the source to an existing solution then you will see them all the time. I do have the express versions of VB2005 and C#2005 installed, but don't use them unless I have no custom typeconverters in my project, which is very rare since I basically just write custom controls.

Since I'm not using Vista, the following assumptions may be incorrect.

TabControlEx is a Framework 1.1 Control. Although it works just fine in VS2005, there were some changes made to the System.Windows.Forms.TabControl in Framework 2.0 which directly affect it. The main problem that you seem to be encountering is that the Framework 2.0 TabPage will automatically set the TabPages new UseVisualStyleBackColor property to true when Appearance is Normal. What this does is set the TabPage BackColor to Transparent. A much better solution would have been to Draw the Visual Style Texture, but I have no control over what MS does. You should reset this property to it's default in order for the texture to be drawn by TabPageEx.

The Issue of oversized tabs is caused by the System.Windows.Forms.TabControl not recieving WM_FONTCHANGE messages. This is due to the control being ownerdraw. I believe that this behavior is deliberate as there are no native methods in the Win32 TabControl to modify the size of an individual tab. Since the control uses GDI to measure the tab text, a GDI+ rendered string will not always fit into the same area. We can post the missing messages, but we must use GDI to draw the tab text rather than GDI+. This is fine for top and bottom aligned tabs, but becomes a major headache when we need to rotate the text for vertical tabs.

Due to the way in which TabControlEx is written, it is not so easy to correct these issues (it was not originally intended to be the control that it has become).

I am currently working on a Framework 2.0 subclass of TabControl and am hoping to have it finished soon. This will correct the tabsize issues seen in TabControlEx. The DrawMode property will also be restored. It will primarily only support the 3 standard appearances (although slightly modified), but will correct Visual Styles for alignments other than top as well as keep Visual styles when Drawmode is set to OwnerDrawFixed. It will also support Disabled Tabs and Mnemonics which is the main reason for it to exist in the first place. It may be further enhanced in the future, but for now I'll just keep it simple, although if you saw how much work was involved you might not agree that it's simple .





Re: Windows Forms General DotNetrix question

AlexBB

Mick hi,

Thank you very much. It is plenty. I do not need "immediate" response to my problems. I can always wait 24 hours because I have many other things to do.

You've explained everything quite well. I will reset the property (UseVisualStypeBackColor) and see how it works. Obviously I will be waining for your upgrade. It is a great control, I'll tell you It saves people a lot of time when your forms are very saturated as mine are.

Thanks a lot.






Re: Windows Forms General DotNetrix question

AlexBB

Mick hi,

Actually the situation is much better than I expected. There is no problem running your control in Vusta whatsoever. The problem I mentioned was caused it turned out by a placement control.BackColor statement at the beginning of the constructor. Once I've made it the last statement in the properties defined for the control, ALL colors came back up.

It is a great control for sure.