Notifications
Clear all

[Closed] dotNet tabControls align vertical?

 PEN

I’m finaly just getting back to using tabControlEX and I’m using it as

tab.alignment=tab.alignment.top

But I’m getting scroll buttons ontop of the last of three tabs. No mater how wide I set it I get them. Is there any way to torun them off?

I Paul,

is this what your get ?


 try (TestForm.close()) catch ()
 (
 dotNet.loadAssembly @"C:\TabControlEX.dll"
 
 Global TestForm = (dotNetObject "MaxCustomControls.MaxForm")
 Global tabControl1 = (dotnetobject "Dotnetrix.Controls.TabControlEx")
 
 fn cleanup e arg = (TestForm=tabControl1=undefined)
 
 -->tabControl1
 tabControl1.Alignment = tabControl1.Alignment.Top
 tabControl1.Appearance = tabControl1.Appearance.Bevel
 tabControl1.dock = tabControl1.dock.Fill
 tabControl1.BackColor = tabControl1.BackColor.DimGray
 tabControl1.forecolor = tabControl1.forecolor.white
 tabControl1.hotcolor = tabControl1.hotcolor.Gray
 tabControl1.selectedtabcolor = tabControl1.selectedtabcolor.OrangeRed
 tabControl1.sizemode = tabControl1.sizemode.fixed
 tabControl1.hottrack = true
 tabControl1.Multiline = true
 tabControl1.tabStop = true
 
 labels=#("1", "2", "3", "4", "5")
 for x in labels do (tabControl1.tabPages.add x)
 
 -->TestForm
 TestForm.ClientSize = dotNetObject "System.Drawing.Size" 300 500
 TestForm.Text = "Martroyx Test Form"
 TestForm.Controls.Add tabControl1
 dotnet.addeventhandler TestForm "closed" cleanup
 
 TestForm.ShowModeless()
 )
 

edit :

Oups, forgot to load the assembly too :


 dotNet.loadAssembly "MaxCustomControls.dll"

Martin Dufour

 PEN

So with three tabs it is wider then the 160 that I’m setting the width to. I would really like the 160 to remain the size but I need to size the width of the tabs, all trys at doing so have failed, I can’t get the width properties of the tabs to change anything. They always return a value of 152, or something like that. Any ideas.

Sorry Paul, I don’t get it :

So with three tabs it is wider then the 160 that I’m setting the width to

What do you mean ?>

Ho, I think I get it now , you want to move the scroll button themselves ?

Hi Paul,

If you set the SizeMode property to Fixed:

roll.dncMainTabs.SizeMode = roll.dncMainTabs.SizeMode.Fixed

you can then set the size of the tabs:

roll.dncMainTabs.itemSize = dotNetObject "System.Drawing.Size" 100 18

hOpe this helps,
o


 tabControl1.ItemSize = dotNetobject "System.Drawing.Size" 160 30
 

but I don’t think you can set them individually.

edit : oup ofer_z was faster

Martin Dufour

 PEN

Thanks guys, I hadn’t tried itemSize yet, I’ll see if that does it.

hi guys i got a small problem with dotNet and the coloring of tabControlls.

i’ve implemented a dotNet controll into my UI per Include


		--Create the dotNet TabControl control
		groupBox grpCustom2 "" pos:[10,239] width:244 height:75 align:#left visible:false
			dotNetControl MapTabs "system.windows.forms.tabcontrol" height:25 width:240 visible:true pos:[12,225]
			
			--Create a setup function for the DOT Net elements
			fn PresTabControll thetc = (
				
				dotnet.loadassembly "System.Data"
				color = dotNetClass "System.Drawing.Color"
				
				thetc.BackColor = (dotNetClass "System.Drawing.Color").Transparent
				
				--Create 3 Tab Pages
				global t1 = dotNetObject "System.Windows.Forms.TabPage"
				t1.text = "Diso."
				--t1.backColor = color.fromArgb (100 255 100 200) --	== grey
				--t1.backColor = (dotNetClass "System.Drawing.Color").fromArgb (100 255 100 200) --	==grey
				--t1.BackColor = (dotNetClass "System.Drawing.Color").Transparent --	== nothing

				t2 = dotNetObject "System.Windows.Forms.TabPage" "Normal"
				t3 = dotNetObject "System.Windows.Forms.TabPage" "Specular"
				t4 = dotNetObject "System.Windows.Forms.TabPage" "Ambo"
				t5 = dotNetObject "System.Windows.Forms.TabPage" "DUDV"

				--Add the Tabpages to the TabControl
				thetc.controls.add t1
				thetc.controls.add t2
				thetc.controls.add t3
				thetc.controls.add t4
				thetc.controls.add t5


			)
			
			
	
			
		--try(
		on MapTabs mousedown arg do(	
......

you can se my trials of giving it a color and the result commented behind it, i also tried
MapTabs.BackColor = (dotNetClass “System.Drawing.Color”).Transparent
MapTabs.BackColor = MapTabs.BackColor.white
but none works for me.

i either get a grey bar instead of the TC or no changes at all
. .:wip:

does anybody have a clue whats going wrong and how to solve it?

edit: right my goal…
i want to assign a special color or make them transparent. if a background bitmap wouldn’t replace the caption i’d also go for that.

the .backColor works fine, but…

  1. Your tabcontrol is not tall enough to show any tab content – it only shows the tab headers, so you won’t see any of the .backColor changes (which are for the tab content). Make the control taller and you should see the .backColor changes.
  2. I’m guessing you want to change the background color of the tab headers, not of the tab content.

The solution for 2 is setting up the tab control for custom drawing, and applying that drawing when the drawing event is called. This is a fair amount of work, but appears to be outlined clearly enough in various internet resources;
http://dotnetrix.co.uk/tabcontrol.htm

It might be easier to load a third party tab control – you’ll notice many here referencing TabControlEx, for example… from the same author – that makes the process much easier.
http://dotnetrix.co.uk/controls.htm

Page 3 / 4