Problem with TabControl alignment in VB.NET - vb.net

I'm having a weird behaviour with a left-aligned TabControl in VB.NET. Screenshot:
What I wanted was to have the tabs literally the same way they would be if rotated 90 degrees to the left.
Does it have something to do with the fact I'm not (god forbid) using the standard XP theme? Any solution to just make it work? (Even if it's hard, but I don't want a control that has a contrasting style, I want the program looking consistent)
Thanks!
Happy ending:

Ok, I solved the issue. If someone else has the same problem, use this control. It's free under MIT license. Screenshot by the author:
Note that the author made two controls. My advice: the second one has incorrect support for cleartype (It rotates after subpixel rendering), but it's easier to use, and has better padding control. Go for it! =)
EDIT
If you use C++ and need it for that, there's an approach. Picture of the result:
alt text http://www.codeguru.com/dbfiles/get_image.php?id=6385&lbl=CXPTABCTRL_GIF&ds=20040309
The author was very descriptive on how he did it, which is good, example:
(source: codeguru.com)
This is the link to the article.
Another very good approach is SkyBound's multi-purpose VisualStyles component. Seems that the binaries are free but the source is not, very fair deal. I'll check it out later, but if you need some visualstyles bug fixing, it seems like a choice.
(source: skybound.ca)
from the authors:
first and foremost, it quashes XP
theme bugs, silently, efficiently and
automatically. But it also provides a
simple set of classes which you can
use to draw your own controls using
the Windows XP Theme API.
Check this. and more from the author.
Problem solved!! =D

Yes, it is a bug in the visual styles renderer for the tab control. Looks like you already found a replacement. Another low-impact approach is to selectively disable visual styles for the control. It will revert back to battle-ship gray, correctly drawing vertical tabs. Tab page content will still render properly.
using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
public class FixedTabControl : TabControl {
[DllImportAttribute("uxtheme.dll")]
private static extern int SetWindowTheme(IntPtr hWnd, string appname, string idlist);
protected override void OnHandleCreated(EventArgs e) {
SetWindowTheme(this.Handle, "", "");
base.OnHandleCreated(e);
}
}

Related

VB control styles change for unknown reason and cannot change back

For some reason while I program in Microsoft Visual Basic 2010 Express OR VS Express for Desktop my controls seem to change style for an unknown reason.
This screenshot is in the DESIGN part of my programming:
And here is when I actually run the program:
I don't understand how it can change like that, I've tried changed properties on all the controls, but they just keep changing to whatever style that is...
I can update with more screenshots if need be.
Thanks
Answer given via a comment:
Using Application.EnableVisualStyles() Fixes the whole thing.
Thanks to #Plutonix for the answer!

How can I change the font in a CommandShell window in pharo or squeak?

In Pharo and Squeak, if it's installed you can type CommandShell open. and it will open a command window which is basically like a "bash shell" or "terminal window", but it is using a nearly microscopic sized default font. I can't seem to figure out how to change it.
I figured out that the general approach in smalltalk is to browse the implementation of a class and see if you can find out something you could say to the class to tell it what you want, or some way you could modify the class so it answers something different to some other class, causing the desired effect. Something like anInstanceOfCommandShell someViewOrControllerThingy setDefaultFont:blahblahblah or something like that.
It seems a CommandShell uses a ShellWindowMorph and that it accepts a setFont message. I'm rather new in Smalltalk and Squeak, and have no idea what to do next.
I'm using Pharo 2.0 but if someone knows how to do it in Squeak I'm sure it would be about the same.
Note that I've found the settings of pharo and that the regular settings changes affect the main transcript window, but do not affect the special CommandShellTranscript or its contents in any way.
The code I use to change the rest of the fonts programmatically was this answer from another question. which says to do this:
|font codeFont|
font := LogicalFont familyName: 'Consolas' pointSize: 10.
codeFont := LogicalFont familyName: 'Consolas' pointSize: 9.
StandardFonts listFont: codeFont.
...
You may override the ShellWindowMorph default #textStyle by the following one:
textStyle
" Answer a font for the text morph"
^ TextStyle default
The window should have a way to set the font directly from the shell menu (the top right arrow) or from the Settings Browser. You may modify any morph property by bringing the "Halo" menu over the morph you are interested (Alt+Shift+Left Click under MS Windows) and select the red icon. Then select Debug -> Explore morph and set the text style directly from the Explorer:
self textMorph setTextStyle: TextStyle default
ShellWindowMorph uses the system-wide DefaultFixedTextStyle.
In Squeak, you could change it like this:
TextConstants
at: #DefaultFixedTextStyle
put: (TextStyle fontArray: {StrikeFont fromUser}).

Is there an easy way to make a code TextBox?

Is there an easy way to make a code TextBox?
I'm trying to make my own limited/specialized version of XAMLPad.
Displaying the current XAML object tree in the top display is simple enough, using XamlReader.Parse() ... But I'd like the actual XAML code in the bottom window to show up in its appropriate colors.
Here is an example of something similar to what I want.
(source: usefulfreeware.net)
The above example looks pretty authentic, with the little expander/collapser thingies on the left side as well as close-to-standard coloration of XAML tokens.
I believe that this doesn't have to be created from scratch, so I'm asking SO if anyone knows where I might find automated support for this type of "code" display.
Kaxaml uses ICSharpCode.TextEditor, the text editor component from SharpDevelop.
Have a look at sharpdevelop - we use it for an internal iron python editor

Turn off auto-collapsing for VB.NET in Visual Studio?

The auto-collapse feature for code properties is neat AFTER you've got your properties all worked out, but while you're still editing them I find the feature to be REALLY annoying.
How can you disable it?
(I'm in VS2008 if it makes a difference)
Edit: I'm not talking about the Property Window... I'm talking about properties in code.
Private _firstName As String
Public Property FirstName() As String Implements IPerson.FirstName
Get
Return _firstName
End Get
Set(ByVal value As String)
_firstName = value
End Set
End Property
displays as
Public Property FirstName()...
From the EDIT menu, choose OUTLINING, STOP OUTLINING. You can also use the keyboard shortcut CTRL+M, CTRL+P.
This seems to be a "feature" of DevX Refactor for VB, which I also find terribly annoying. I found this thread on their forum which provides a couple of suggested solutions:
Add a key to the registry to make the DevExpress menu visible in VS and then go to the options page to disable auto-collapse or
Install a newer version of the add-in (Release 9.1.4 or above) which apparently doesn't behave this way anymore.
The stop outlining option never works for me. Also the Ctrl+M, Ctrl+M option only seems to work if I have the region collapsed highlighted. Ctrl+M, Ctrl+P does nothing for me. I went into options and unchecked the enter Outlining mode, but that didn't do anything either. At one point, when I had VS 2005 (now I have 2008), I managed to turn it off through a regedit hack. Though once I had to re-install VS 2005 and forgot the hack, so I've been living with this ever since. It's ultra annoying when you are looking for something where you are looking for a pattern of code and not the specific words of the code. I don't know why it is, but I do that a lot. Any helpwould be appreciated. Ty.
When the window is open, click on the pin in the upper right hand corner (the middle icon between the X and the down arrow). When you're done, click it again to enable auto hide again.

Change text color of commented program code?

I'm looking for a simple feature or work-around that can highlight commented program code as opposed to technical notes. Is there such a feature or other way to do it?
I want this to appear in light gray, as normal:
//avoids a ClassCastException. See bugfix #123
I want this to appear in orange so that it can safely be removed (the history for which would be under version control):
//public static void method() {
//}
I searched SO but no luck.
There is no such feature in IntelliJ Idea. Fortunately, there is even better way to avoid commented-out sections of code in your project.
The best option is to use Static Code Analysis tool such as Sonar - it has a rule which detects commented-out lines of code and reports the issue to you. After running such tool you can be certain you have no commented-out dead code in your project.
See the post about Commented-out code eradication with Sonar.