tabcontrol

How to select a TabItem based off of it's Header

荒凉一梦 提交于 2019-12-02 06:53:05
问题 In my program I have a tabItem that gets selected when a TreeViewItem with an equivalent header is selected. This is what I currently have (It works): (parent_TreeViewItem.Items.Contains(SelectedItem)) { tabControl1.SelectedItem = tabControl1.Items //Changes tab according to TreeView .OfType<TabItem>().SingleOrDefault(n => n.Header.ToString() == SelectedItem.Header.ToString()); } The difference with what I'm doing this time is that the tabItem 's header that I'm selecting is composed of a

How to kept a graphic drawing in a picturebox on a tab control after switching to tab 2 and return to tab 1?

て烟熏妆下的殇ゞ 提交于 2019-12-02 03:23:39
I have a Tab Control with two (2) Tabs. The Tab 1 does a drawing in a picture box (the picture box is optional, I can draw directly to the tab) using Graphics Addline. The second tab opens a web browser. Everything is working fine. I can make the drawing in the first tab but when I switch to the second tab and return to the first tab, the drawing disappear and if I return to tab 2 I can see what I was watching in the web browser. I need to kept the drawing in the tab 1 so when I return to it I can see it. Here is the code I'm using to draw in the tab 1: private void DataLoaded(ref string

Silverlight tabchanged event - tabcontrol

感情迁移 提交于 2019-12-02 03:13:38
I'm using tab control and I want to handle tabchanged event. I was trying to use SelectionChanged event with no luck. It's being fired too many times (after loading tabcontrol, or adding new tab). I would like to handle this event only when user navigates between tabs. I have found solution for WPF ( Is there Selected Tab Changed Event in the standard WPF Tab Control ) but it's no good for Silverlight. TIA. Firing "too many times" should not be a problem if you check for an actual change to the SelectedIndex property in the event. private int LastSelectedTab = -1; void tab_SelectionChanged

Controlling the TabControl active tab with a ComboBox

跟風遠走 提交于 2019-12-01 22:43:15
问题 What i am really trying to achieve is to full control the active TabItem by using the combobox as the navigation control. Here is what ive got so far: <TabControl Canvas.Left="26" Canvas.Top="27" Height="100" Name="TabControl1" Width="220"> <TabItem Header="TabItem1" x:Name="TabItem1"> <Grid /> </TabItem> <TabItem Header="TabItem2" x:Name="TabItem2"> <Grid /> </TabItem> </TabControl> <ComboBox Canvas.Left="126" Canvas.Top="134" Height="23" Name="CmbTabs" Width="120" ItemsSource="{Binding

How to change size and image in TabControl

自作多情 提交于 2019-12-01 22:14:27
I want to change size of TabPage in my TabControl , each tab should be in one line without scroll. the second question is about how to change Text into Image like here (Please, ignore the green line): edit. I used Winforms. Ad 1. There is no way to adjust width of tab pages to fit width you want automatically, so you just have to do some maths to achieve this. Ad 2. First you have to create an ImageList object, which you will then pass to your TabControl : ImageList il = new ImageList(); il.Images.Add("your_graphics_name", Image.FromFile(@"C:\Graphics\example.png")); (...) yourTabControl

Programatically hide/remove tabpages in VB.NET

我的梦境 提交于 2019-12-01 22:06:01
I have 10 tabpages on my form. Based on an input in a textbox, I want to programmatically remove number of tab pages, i.e. if textbox input is 3 then only first 3 tabpages should be visible and tabpages 4 to 10 must be removed or should not be visible. I tried following without any success, For i = 0 To 9 Form1.TabControl1.TabPages.Remove(Form4.TabControl1.TabPages((val(textbox1.text)) + i)) Next (No exceptions or errors are generated for above statements) What is wrong with these statements? Thanks. check this. For i As Integer = TextBox1.Text + 1 To 9 Form1.TabControl1.TabPages.Remove(Form4

Remove/Edit TabControl Padding for TabPages

守給你的承諾、 提交于 2019-12-01 21:51:27
问题 I was using System.Windows.Forms.TabControl to list custom pages, but there seems be a Hardcoded Padding of 3 pixels on all sides of Tabcontrol. How I can remove that. One point here is I dont want to remove Tabs on Top http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/a8c5bc93-8f76-42e7-b501-b12f8b5bd1eb/ I found above MSDN link whick does removes margins from all sides including TabItems on top which I dont want. Thanks in advance! 回答1: This is the only way I can modify that

How to change size and image in TabControl

别等时光非礼了梦想. 提交于 2019-12-01 21:49:36
问题 I want to change size of TabPage in my TabControl , each tab should be in one line without scroll. the second question is about how to change Text into Image like here (Please, ignore the green line): edit. I used Winforms. 回答1: Ad 1. There is no way to adjust width of tab pages to fit width you want automatically, so you just have to do some maths to achieve this. Ad 2. First you have to create an ImageList object, which you will then pass to your TabControl : ImageList il = new ImageList();

Remove/Edit TabControl Padding for TabPages

会有一股神秘感。 提交于 2019-12-01 21:12:46
I was using System.Windows.Forms.TabControl to list custom pages, but there seems be a Hardcoded Padding of 3 pixels on all sides of Tabcontrol. How I can remove that. One point here is I dont want to remove Tabs on Top http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/a8c5bc93-8f76-42e7-b501-b12f8b5bd1eb/ I found above MSDN link whick does removes margins from all sides including TabItems on top which I dont want. Thanks in advance! This is the only way I can modify that padding. Imports System.Runtime.InteropServices Public Class NativeTabControl Inherits NativeWindow Private

Remove TabPage: Dispose or Clear or both?

扶醉桌前 提交于 2019-12-01 19:47:30
I am working on a windows form that has a TabControl named tabDocuments. I came across this piece of code that removes all pages from the TabControl. for (int i = tabDocuments.TabPages.Count - 1; i > -1; i--) { tabDocuments.TabPages[i].Dispose(); } tabDocuments.TabPages.Clear(); The person who wrote this code has already left a while ago. I am trying to understand why the code is calling Clear() after disposing each of the tabPages (looks un-necessary to me). Can anyone please explain to me why? Or is calling Clear() extra? This snippet is from Control.Dispose: if (this.parent != null) { this