Two subects - tabpage&icons
Hi, people!!
How can I change the selected tabpage programatically?
I have another question that completely doesn't concern with the first one: buttons' icons aren't shown neither in design time neither in runtime.Although, it just work out in another machine. So, what have I done wrong?
Thank you, folks!
you can refer to the help in forms builder for the built-in "set_tab_page_property". Anyway, you can call it programatically in your form as shown below. I hope that this answer your question. As for your second question, you can also look up the help in forms builder under "Associating an icon with a window".
SET_TAB_PAGE_PROPERTY
(tab_page_id TAB_PAGE,
property NUMBER,
value NUMBER);
SET_TAB_PAGE_PROPERTY
(tab_page_name VARCHAR2,
property NUMBER,
value NUMBER);
Similar Messages
-
I have two Apple IDs for two distinct countries. Can I have two distinct AppStore icons on my iPad?.
I have two id's and I dont want one!! I bought a used Mac pro I thought i had changd all their information, but when I try to do updates on my Iphone, I enter my id and password, then it will ask for the id of the other passoword!!!!( the person who I bought the Macpro from) grrrrr anyone know how I can get this sorted out? Thank you in advance.
-
I have two Photo Stream icons on my iPhone. How do I delete one of them?
I have two Photo Stream icons under Photos on my iPhone 4. One is active (receiving photos taken within minutes) and the other one has not been updated for atleast 2 weeks. I would like to remove the one that isn't receiving any new photos. Help.
Best,
DAs stedman said, if you mean the original, built-in Camera app from Apple, that cannot be deleted. You'll need to simply 'hide' the app in another folder, or perhaps turn on Restrictions and disable access to the Camera App, which may or may not interfere with the 'new' Camera App you have.
-
Two hard drive icons on my desktop, would like to have only one...
Hello everyone, I recently got a PowerMac G5 (I think it's a 2.3 GHz). It came with a hard drive inserted 'Untitled', which came from my old 1.6 GHz G5. On the desktop though, I get two hard drive icons, my main start up drive called 'Untitled', and another one called 'Spare'. I was told that my G5 has only one drive inserted 'Untitled', so I'm trying to either get rid of 'Spare', or merge it somehow into 'Untitled'. Under the Volumes folder, I was not really able to get rid of it, is this something to do with Disk Utility?
BDAqua - under Get Info, when I was on Leopard, I tried changing a User Permissions category called 'Everybody' from Read Only to Read and Write. Upon restart two days later, Leopard would not start up (loads of writing on the screen, with the Mac power button, asking me to restart). To cut a long story, I am now back on Tiger lol (Leopard issues for another discussion lol), so now I dare not play with anything which says Read Only, especially when it's probably not even necessary. I am writing this from the library, so don't know what exactly it says in Get Info - User Permissions for either drive at the moment. If this is relevant, I can have a look later and post back, I'll also verify permissions in Disk Utility for both drives, but I think they are fine. Actually, when I was on Leopard, my 'Untitled' drive took ages to verify permissions, and always loads of writing appeared! Now that I'm on Tiger, the other day when I verified Disk Permissions, it was quick and fine!
Thank you
In the screen shots, 'Untitled' is model ST31, 'Spare' is model WDCHi BDAqua, sorry I should have just opened it in the first place! I don't know why that man told me there was only one hard drive inside, perhaps a misunderstanding.
It seems that there are actually two hard drives inside, one in A, and one in B (see photo)! So, if this is the case, I don't have a problem with the two hard drive icons.
I guess if a G5 shows two hard drives on the desktop, then there's two hard drives in the machine!
Thanks for helping anyway. -
Have Audigy2 in Vista, why are there two volume control icons in system tr
Hi,
I'm running an Audigy2 on a Windows Vista system. There are two volume control icons in the system tray. One is the Soundblaster control, the other is the Windows control.
Are these two programs supposed to be running at the same time? Do they conflict with one another?
Thanks for your time,
Big Al MintakaHi pgaastra. I don't know why there are two items in the task bar, but you have identified the
recommended fix. The why never bothered me enough to investigate, so maybe we will both
find out now.
Matt
Message Edited by Matthew Williams on 04-16-2008 08:49 PM -
I have two of each icon in the Finder window sidebars. I tried dragging the second one of each off, and that works for a while, but at some point they reappear. (Perhaps after a restart?)
Any suggestions about how to fix that?Try trashing ~/Library/Preferences/com.apple.Finder.plist, and relaunching Finder from the force quit window. That will reset finder preferences back to default, and, hopefully, fix the problem.
Good luck! -
I have TWO FILE MANGER ICONS appearing in the Google Icon on my home page. It is a LG g3 how do I delete or get rid of one of them?
Tap and hold an icon. It will bring a menu drop down and bring the icon to remove.
-
Two different file icons in different folders for my php files??
Hi,
I try to move a copy of my running website to my localhost. (MAMP+MacBook Pro)
I have problems getting to my local domain. Therefore I tried to install a clean Prestashop installation to see if that worked, which seems to work neatly.
Comparing the two website files, I noticed something strange (for me, anyway):
In the working prestashop root folder, my PHP files have a nice, black icon associated with them
In the non accessible prestashop root folder, my PHP files have a boring white filesheet like icon.
I re-associated ALL the PHP files with a text editor, but still the difference remains...
What's the cause of this?? Does this have to do with permissions or so, causing my problems with entering this local shop ??
Thanks,
PascalYou can use Exportant's "Fast Cache" feature to save time when exporting the same file with different settings (a free plugin I wrote).
It's an export filter which saves a rendered copy of the file being exported in a cache, if not there already (or develop settings / metadata have changed), and pulls it from the cache when present (so Lr won't have to re-render), so it takes 1/2 the amount of time to export 2 copies, 1/3 the amount of time to export 3 copies etc.
Unfortunately, it's not compatible with all export/publish services, e.g. Export Manager & Turning Gate Publisher.
It *is* however compatible with a lot of them, like:
Adobe's Hard Drive export or publish service.
My TreeSyncPublisher (export or publish).
Jeffrey Friedl's Folder or Collection publishing service (publish only).
If you're interested in saving your time but not your computer's, then just use Export Manager (without export filters), or a publish service (well, one publish service for each format..) - Lr will re-render, but it's one click to go..
robcole.com - Exportant
Another option for speedy exporting of jpegs is PreviewExporter, which exports from the Lr lib preview cache - not appropriate for obtaining printable tiffs.
Rob -
Two Boot camp icons in task bar--fix?
Ever since I updated to Boot Camp 2.02 and then to 2.1, I have 2 separate Boot Camp icons in my task bar (that thingie on the bottom right of your screen) under Vista-64. One of them launches the control panel for BootCamp 2.0, and the other for 2.1 (both work). Does anyone know how to get rid of one of them. Speak slowly for the Windows-illiterate. Thanks.
I had the same problem. This is because you have part of the 32 BIT Boot Camp installation running.
To resolve launch Vista then go to Start> Control panel, switch to the Classic View and double click on Programs and Features. From the list you should see two items named Boot Camp Services. Select the one that is about 6.9 MB in size (the other will be 253MB, do not remove this one!) then press uninstall, confirm the action when prompted then restart when prompted. Once restarted there will only be one Boot Camp icon in Vista.
Job done!
G -
Changing between the two different bookmark icons
Hello... I am wondering if there's an easy (or not so easy) way to change a bookmark from one kind to the other kind. Specifically, when I combine PDFs, each source file ends up with one bookmark in the resultant PDF. These icons depict a "doubled bookmark"—two little bookmarks right next to each other, comprising a single icon. When I create new bookmarks in this PDF, however, the icon depicts just one little bookmark graphic.
I want to change the "doubled bookmark" icons into "single bookmark" icons (without manually recreating them all)... is that possible? And if so, can I do this via Javascript?
Thank you to the community.I've developed a free tool that does it. You can find it here: http://try67.blogspot.com/2011/09/batch-change-bookmarks-type.html
-
Hello
When i start my device a big message or icon saying "POWER OFF" appears and i have to press the back or home button in order to go to the "enter pin code screen":
After this, when the home screen appears i always have a two blue screens notification icon on the top left of the screen:
If i tap on this icon this is what appears:
This icon never disappear and the only way that i have to quit this icon is forcing stop through this screen
Is this normal?, If this isn´t normal, how could i fix this?Your using the flash tool to flash your phone i believe, for PC Companion and a end user phone. That should not appear.
I can accept failure.... I can't accept not trying - Michael Jordan -
erm is it possible
Ok, just discovered on another forum that instead of having a 'new tab' icon on your tab bar, simply double click the empty space after the last tab and a new tab opens. I never knew that. Solves that problem for me, however I'm told it doesn't work in "tabs on top" mode, something I don't use.
-
Two Application Explorers icons at Sys Tray
Hi There
I am running Zen3.2 SP1 and WinXP SP1. I have two applications explorers
at Sys Tray. They hang the machine. Normally one keeps spinning and the
other one stops (magnify class still there). This problem becomes
obviously in the HP Tablet. It happens to other P4 base machines as well
but only once a while.
Naldesk.exe is at the startup of current users and all users profile of
the PC while Novell Login Script runs Nalexpld.exe as well. I have tried
to take away the login script part. But problem still there.
Any clue why there are two application explorers and hang each other?
MatthiasI think this has been fixed in SP2 Iirc.
At least it was a known issue a while ago. So i would give SP3 which is
the current one a try.
Regards, Kai Reichert
Novell Support Forum Sysop
Usually the faulty interface lies between the chair and the keyboard. -
Re: Why do I see TWO identical hd icons in Finder?
Recently had to recreate another admin account due to Finder issue. Once it was set up and all my data transfered, I deleted it. I can't think of any other recent event that might have caused this.
Is there a way to delete one of them?Thanks, Joseph. I didn't even think to drag it out of window! Only thought the dock had that feature.
-
Adding Icon and increasing width of tabpages to show the close button in a tabcontrol
I have this code right now,
Public Class FSMTabControl
Inherits TabControl
#Region "Declarations"
Private _TextColour As Color = Color.FromArgb(255, 255, 255)
Private _BackTabColour As Color = Color.FromArgb(54, 54, 54)
Private _BaseColour As Color = Color.FromArgb(35, 35, 35)
Private _ActiveColour As Color = Color.FromArgb(47, 47, 47)
Private _BorderColour As Color = Color.FromArgb(30, 30, 30)
Private _UpLineColour As Color = Color.FromArgb(0, 160, 199)
Private _HorizLineColour As Color = Color.FromArgb(23, 119, 151)
Private CenterSF As New StringFormat With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center}
#End Region
#Region "Properties"
<Category("Colours")> _
Public Property BorderColour As Color
Get
Return _BorderColour
End Get
Set(value As Color)
_BorderColour = value
End Set
End Property
<Category("Colours")> _
Public Property UpLineColour As Color
Get
Return _UpLineColour
End Get
Set(value As Color)
_UpLineColour = value
End Set
End Property
<Category("Colours")> _
Public Property HorizontalLineColour As Color
Get
Return _HorizLineColour
End Get
Set(value As Color)
_HorizLineColour = value
End Set
End Property
<Category("Colours")> _
Public Property TextColour As Color
Get
Return _TextColour
End Get
Set(value As Color)
_TextColour = value
End Set
End Property
<Category("Colours")> _
Public Property BackTabColour As Color
Get
Return _BackTabColour
End Get
Set(value As Color)
_BackTabColour = value
End Set
End Property
<Category("Colours")> _
Public Property BaseColour As Color
Get
Return _BaseColour
End Get
Set(value As Color)
_BaseColour = value
End Set
End Property
<Category("Colours")> _
Public Property ActiveColour As Color
Get
Return _ActiveColour
End Get
Set(value As Color)
_ActiveColour = value
End Set
End Property
Protected Overrides Sub CreateHandle()
MyBase.CreateHandle()
Alignment = TabAlignment.Bottom
End Sub
#End Region
#Region "Draw Control"
Sub New()
SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer, True)
DoubleBuffered = True
Font = New Font("Segoe UI", 10)
SizeMode = TabSizeMode.FillToRight
ItemSize = New Size(240, 32)
End Sub
Protected Overrides Sub OnPaint(e As PaintEventArgs)
Dim g = e.Graphics
With G
.SmoothingMode = SmoothingMode.HighQuality
.PixelOffsetMode = PixelOffsetMode.HighQuality
.TextRenderingHint = TextRenderingHint.ClearTypeGridFit
.Clear(_BaseColour)
Try : SelectedTab.BackColor = _BackTabColour : Catch : End Try
Try : SelectedTab.BorderStyle = BorderStyle.FixedSingle : Catch : End Try
.DrawRectangle(New Pen(_BorderColour, 2), New Rectangle(0, 0, Width, Height))
For i = 0 To TabCount - 1
Dim Base As New Rectangle(New Point(GetTabRect(i).Location.X, GetTabRect(i).Location.Y), New Size(GetTabRect(i).Width, GetTabRect(i).Height))
Dim BaseSize As New Rectangle(Base.Location, New Size(Base.Width, Base.Height))
If i = SelectedIndex Then
.FillRectangle(New SolidBrush(_BaseColour), BaseSize)
.FillRectangle(New SolidBrush(_ActiveColour), New Rectangle(Base.X + 1, Base.Y - 3, Base.Width, Base.Height + 5))
.DrawString(TabPages(i).Text, Font, New SolidBrush(_TextColour), New Rectangle(Base.X + 7, Base.Y, Base.Width - 3, Base.Height), CenterSF)
.DrawLine(New Pen(_HorizLineColour, 2), New Point(Base.X + 3, CInt(Base.Height / 2 + 2)), New Point(Base.X + 9, CInt(Base.Height / 2 + 2)))
.DrawLine(New Pen(_UpLineColour, 2), New Point(Base.X + 3, Base.Y - 3), New Point(Base.X + 3, Base.Height + 5))
Else
.DrawString(TabPages(i).Text, Font, New SolidBrush(_TextColour), BaseSize, CenterSF)
End If
Next
.InterpolationMode = InterpolationMode.HighQualityBicubic
End With
End Sub
Private Declare Auto Function SetParent Lib "user32" (ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As IntPtr
Protected CloseButtonCollection As New Dictionary(Of Button, TabPage)
Private _ShowCloseButtonOnTabs As Boolean = True
<Browsable(True), DefaultValue(True), Category("Behavior"), Description("Indicates whether a close button should be shown on each TabPage")> _
Public Property ShowCloseButtonOnTabs() As Boolean
Get
Return _ShowCloseButtonOnTabs
End Get
Set(ByVal value As Boolean)
_ShowCloseButtonOnTabs = value
For Each btn In CloseButtonCollection.Keys
btn.Visible = _ShowCloseButtonOnTabs
Next
RePositionCloseButtons()
End Set
End Property
Protected Overrides Sub OnCreateControl()
MyBase.OnCreateControl()
RePositionCloseButtons()
End Sub
Protected Overrides Sub OnControlAdded(ByVal e As System.Windows.Forms.ControlEventArgs)
MyBase.OnControlAdded(e)
Dim tp As TabPage = DirectCast(e.Control, TabPage)
Dim rect As Rectangle = Me.GetTabRect(Me.TabPages.IndexOf(tp))
Dim btn As Button = AddCloseButton(tp)
btn.Size = New Size(CInt(rect.Height / 2), CInt(rect.Height / 2))
btn.Location = New Point(rect.X + rect.Width - rect.Height + 11, CInt(rect.Y + 7))
SetParent(btn.Handle, Me.Handle)
AddHandler btn.Click, AddressOf OnCloseButtonClick
CloseButtonCollection.Add(btn, tp)
End Sub
Protected Overrides Sub OnControlRemoved(ByVal e As System.Windows.Forms.ControlEventArgs)
Dim btn As Button = CloseButtonOfTabPage(DirectCast(e.Control, TabPage))
RemoveHandler btn.Click, AddressOf OnCloseButtonClick
CloseButtonCollection.Remove(btn)
SetParent(btn.Handle, Nothing)
btn.Dispose()
MyBase.OnControlRemoved(e)
End Sub
Protected Overrides Sub OnLayout(ByVal levent As System.Windows.Forms.LayoutEventArgs)
MyBase.OnLayout(levent)
RePositionCloseButtons()
End Sub
Public Event CloseButtonClick As CancelEventHandler
Protected Overridable Sub OnCloseButtonClick(ByVal sender As Object, ByVal e As EventArgs)
If Not DesignMode Then
Dim btn As Button = DirectCast(sender, Button)
Dim tp As TabPage = CloseButtonCollection(btn)
Dim ee As New CancelEventArgs
RaiseEvent CloseButtonClick(sender, ee)
If Not ee.Cancel Then
Me.TabPages.Remove(tp)
RePositionCloseButtons()
End If
End If
End Sub
Protected Overridable Function AddCloseButton(ByVal tp As TabPage) As Button
Dim closeButton As New Button
With closeButton
'' TODO: Give a good visual appearance to the Close button, maybe by assigning images etc.
'' Here I have not used images to keep things simple.
.Text = "X"
.FlatStyle = FlatStyle.Flat
.BackColor = _BaseColour
.ForeColor = Color.White
.Font = New Font("Microsoft Sans Serif", 6, FontStyle.Bold)
End With
Return closeButton
End Function
Public Sub RePositionCloseButtons()
For Each item In CloseButtonCollection
RePositionCloseButtons(item.Value)
Next
End Sub
Public Sub RePositionCloseButtons(ByVal tp As TabPage)
Dim btn As Button = CloseButtonOfTabPage(tp)
If btn IsNot Nothing Then
Dim tpIndex As Integer = Me.TabPages.IndexOf(tp)
If tpIndex >= 0 Then
Dim rect As Rectangle = Me.GetTabRect(tpIndex)
If Me.SelectedTab Is tp Then
btn.BackColor = Color.Red
btn.Size = New Size(CInt(rect.Height / 2), CInt(rect.Height / 2))
btn.Location = New Point(rect.X + rect.Width - rect.Height + 11, CInt(rect.Y + 7))
Else
btn.BackColor = _BaseColour
btn.Size = New Size(CInt(rect.Height / 2), CInt(rect.Height / 2))
btn.Location = New Point(rect.X + rect.Width - rect.Height + 11, CInt(rect.Y + 7))
End If
btn.Visible = ShowCloseButtonOnTabs
btn.BringToFront()
End If
End If
End Sub
Protected Function CloseButtonOfTabPage(ByVal tp As TabPage) As Button
Return (From item In CloseButtonCollection Where item.Value Is tp Select item.Key).FirstOrDefault
End Function
#End Region
End Class
This code shows a perfect tabcontrol as in the picture below,
I managed to get this code working by combining three other VB themes I found. Right now, I just want to increase the width of the tab so the close button doesn't hides the text. And I want to add a icon to the left of the tab and be able to change it on
runtime.
The icons name will be on, off, 1, 2, plus .ico
Is it possible ? and is it possible to make the tabs curved at the corner like in chrome.Hi,
I have went through your TabControl class and changed it around a little bit to get something similar to what i think you want. I made it so that the Tabs are resized with the TabControl itself so that they always fill the width of the TabControl.
I also, made the Text of the tabs have its own rectangle which will automatically adjust it`s width according to weather or not the close buttons are shown so the text will never be under the buttons.
As for the Icons, you could create another small class that inherits from the TabPage base class and add a public property to it for the Icon image. You would have to use that class to add TabPages and set the Icon property. Then in the
TabControl class`s OnPaint overrides sub you would check if the Icon property of the TabPage is set and draw the image if it is.
I didn`t go that far but, i used the TabPage`s Tag property for the Icon image. Actually it is just an Image, not an Icon. So, in the TabControl`s OnPaint overrides sub i check if the TabPage`s Tag property is set to an Image and if it
is i adjust the Text rectangle to avoid the Image and draw the image.
I moved the StringFormat to the OnPaint sub and set it to keep the text left aligned so it stayed next to the Image. You can change it back to the Center if you want. I also set the StringFormat trimming to EllipsisCharacter so it will
cut the text off if it is to long to fit between the Image and the Close button.
You can test it in a new form project first and to check out how it works and what i changed.
Imports System.ComponentModel
Imports System.Drawing.Drawing2D
Imports System.Drawing.Text
Public Class FSMTabControl
Inherits TabControl
#Region "Declarations"
Private _TextColour As Color = Color.FromArgb(255, 255, 255)
Private _BackTabColour As Color = Color.FromArgb(54, 54, 54)
Private _BaseColour As Color = Color.FromArgb(35, 35, 35)
Private _ActiveColour As Color = Color.FromArgb(47, 47, 47)
Private _BorderColour As Color = Color.FromArgb(30, 30, 30)
Private _UpLineColour As Color = Color.FromArgb(0, 160, 199)
Private _HorizLineColour As Color = Color.FromArgb(23, 119, 151)
#End Region
#Region "Properties"
<Category("Colours")> _
Public Property BorderColour() As Color
Get
Return _BorderColour
End Get
Set(ByVal value As Color)
_BorderColour = value
End Set
End Property
<Category("Colours")> _
Public Property UpLineColour() As Color
Get
Return _UpLineColour
End Get
Set(ByVal value As Color)
_UpLineColour = value
End Set
End Property
<Category("Colours")> _
Public Property HorizontalLineColour() As Color
Get
Return _HorizLineColour
End Get
Set(ByVal value As Color)
_HorizLineColour = value
End Set
End Property
<Category("Colours")> _
Public Property TextColour() As Color
Get
Return _TextColour
End Get
Set(ByVal value As Color)
_TextColour = value
End Set
End Property
<Category("Colours")> _
Public Property BackTabColour() As Color
Get
Return _BackTabColour
End Get
Set(ByVal value As Color)
_BackTabColour = value
End Set
End Property
<Category("Colours")> _
Public Property BaseColour() As Color
Get
Return _BaseColour
End Get
Set(ByVal value As Color)
_BaseColour = value
End Set
End Property
<Category("Colours")> _
Public Property ActiveColour() As Color
Get
Return _ActiveColour
End Get
Set(ByVal value As Color)
_ActiveColour = value
End Set
End Property
Protected Overrides Sub CreateHandle()
MyBase.CreateHandle()
Alignment = TabAlignment.Bottom
End Sub
#End Region
#Region "Draw Control"
Sub New()
SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer, True)
DoubleBuffered = True
Font = New Font("Segoe UI", 10)
SizeMode = TabSizeMode.Fixed
End Sub
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
With e.Graphics
.SmoothingMode = SmoothingMode.HighQuality
.PixelOffsetMode = PixelOffsetMode.HighQuality
.TextRenderingHint = TextRenderingHint.ClearTypeGridFit
.Clear(_BaseColour)
Try : SelectedTab.BackColor = _BackTabColour : Catch : End Try
Try : SelectedTab.BorderStyle = BorderStyle.FixedSingle : Catch : End Try
.DrawRectangle(New Pen(_BorderColour, 2), New Rectangle(0, 0, Width, Height))
If Me.Created AndAlso Me.TabCount > 0 Then
Dim tw As Integer = CInt(Me.ClientSize.Width / Me.TabCount)
Dim offset As Integer = Me.TabCount
If Me.ItemSize.Width <> tw - offset Then Me.ItemSize = New Size(tw - offset, 32)
End If
Using CenterSF As New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center, .Trimming = StringTrimming.EllipsisCharacter, .FormatFlags = StringFormatFlags.NoWrap}
For i As Integer = 0 To TabCount - 1
Dim Base As Rectangle = Me.GetTabRect(i)
Dim txtrect As New Rectangle(Base.Left, Base.Top, Base.Width, Base.Height)
Dim img As Image = Nothing
If Me.TabPages(i).Tag IsNot Nothing Then
txtrect.X += Base.Height
txtrect.Width -= Base.Height
img = DirectCast(Me.TabPages(i).Tag, Image)
End If
If ShowCloseButtonOnTabs Then
txtrect.Width -= Base.Height
End If
If i = SelectedIndex Then
.FillRectangle(New SolidBrush(_BaseColour), Base)
.FillRectangle(New SolidBrush(_ActiveColour), New Rectangle(Base.X + 1, Base.Y - 3, Base.Width, Base.Height + 4))
.DrawString(TabPages(i).Text, Font, New SolidBrush(_TextColour), txtrect, CenterSF)
.DrawLine(New Pen(_HorizLineColour, 2), New Point(Base.X + 3, CInt(Base.Height / 2 + 2)), New Point(Base.X + 9, CInt(Base.Height / 2 + 2)))
.DrawLine(New Pen(_UpLineColour, 2), New Point(Base.X + 3, Base.Y - 3), New Point(Base.X + 3, Base.Height + 5))
Else
.DrawString(TabPages(i).Text, Font, New SolidBrush(_TextColour), txtrect, CenterSF)
End If
If img IsNot Nothing Then
.DrawImage(img, Base.Left + 2, Base.Top + 2, Base.Height - 4, Base.Height - 4)
End If
Next
End Using
.InterpolationMode = InterpolationMode.HighQualityBicubic
End With
End Sub
Private Declare Auto Function SetParent Lib "user32" (ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As IntPtr
Protected CloseButtonCollection As New Dictionary(Of Button, TabPage)
Private _ShowCloseButtonOnTabs As Boolean = True
<Browsable(True), DefaultValue(True), Category("Behavior"), Description("Indicates whether a close button should be shown on each TabPage")> _
Public Property ShowCloseButtonOnTabs() As Boolean
Get
Return _ShowCloseButtonOnTabs
End Get
Set(ByVal value As Boolean)
_ShowCloseButtonOnTabs = value
For Each btn As Button In CloseButtonCollection.Keys
btn.Visible = _ShowCloseButtonOnTabs
Next
RePositionCloseButtons()
Me.Refresh()
End Set
End Property
Protected Overrides Sub OnCreateControl()
MyBase.OnCreateControl()
RePositionCloseButtons()
End Sub
Protected Overrides Sub OnControlAdded(ByVal e As System.Windows.Forms.ControlEventArgs)
MyBase.OnControlAdded(e)
Dim tp As TabPage = DirectCast(e.Control, TabPage)
Dim rect As Rectangle = Me.GetTabRect(Me.TabPages.IndexOf(tp))
Dim btn As Button = AddCloseButton(tp)
btn.Size = New Size(CInt(rect.Height / 2), CInt(rect.Height / 2))
btn.Location = New Point(rect.X + rect.Width - rect.Height + 11, CInt(rect.Y + 7))
SetParent(btn.Handle, Me.Handle)
AddHandler btn.Click, AddressOf OnCloseButtonClick
'ResizeTabs()
CloseButtonCollection.Add(btn, tp)
End Sub
Protected Overrides Sub OnControlRemoved(ByVal e As System.Windows.Forms.ControlEventArgs)
Dim btn As Button = CloseButtonOfTabPage(DirectCast(e.Control, TabPage))
RemoveHandler btn.Click, AddressOf OnCloseButtonClick
CloseButtonCollection.Remove(btn)
SetParent(btn.Handle, Nothing)
btn.Dispose()
MyBase.OnControlRemoved(e)
'ResizeTabs()
End Sub
Protected Overrides Sub OnLayout(ByVal levent As System.Windows.Forms.LayoutEventArgs)
MyBase.OnLayout(levent)
RePositionCloseButtons()
End Sub
Public Event CloseButtonClick As CancelEventHandler
Protected Overridable Sub OnCloseButtonClick(ByVal sender As Object, ByVal e As EventArgs)
If Not DesignMode Then
Dim btn As Button = DirectCast(sender, Button)
Dim tp As TabPage = CloseButtonCollection(btn)
Dim ee As New CancelEventArgs
RaiseEvent CloseButtonClick(sender, ee)
If Not ee.Cancel Then
Me.TabPages.Remove(tp)
RePositionCloseButtons()
End If
End If
End Sub
Protected Overridable Function AddCloseButton(ByVal tp As TabPage) As Button
Dim closeButton As New Button
With closeButton
'' TODO: Give a good visual appearance to the Close button, maybe by assigning images etc.
'' Here I have not used images to keep things simple.
.Text = "X"
.FlatStyle = FlatStyle.Flat
.BackColor = _BaseColour
.ForeColor = Color.White
.Font = New Font("Microsoft Sans Serif", 6, FontStyle.Bold)
End With
Return closeButton
End Function
Public Sub RePositionCloseButtons()
For Each item As KeyValuePair(Of Button, TabPage) In CloseButtonCollection
RePositionCloseButtons(item.Value)
Next
End Sub
Public Sub RePositionCloseButtons(ByVal tp As TabPage)
Dim btn As Button = CloseButtonOfTabPage(tp)
If btn IsNot Nothing Then
Dim tpIndex As Integer = Me.TabPages.IndexOf(tp)
If tpIndex >= 0 Then
Dim rect As Rectangle = Me.GetTabRect(tpIndex)
If Me.SelectedTab Is tp Then
btn.BackColor = Color.Red
btn.Size = New Size(CInt(rect.Height / 2), CInt(rect.Height / 2))
btn.Location = New Point(rect.Right - rect.Height + 11, CInt(rect.Y + 7))
Else
btn.BackColor = _BaseColour
btn.Size = New Size(CInt(rect.Height / 2), CInt(rect.Height / 2))
btn.Location = New Point(rect.Right - rect.Height + 11, CInt(rect.Y + 7))
End If
btn.Visible = ShowCloseButtonOnTabs
btn.BringToFront()
End If
End If
End Sub
Protected Function CloseButtonOfTabPage(ByVal tp As TabPage) As Button
Return (From item In CloseButtonCollection Where item.Value Is tp Select item.Key).FirstOrDefault
End Function
#End Region
End Class
In the Form`s code you can set the images for the TabPage icons like this.
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.TabPage1.Tag = Image.FromFile("C:\testfolder\img1.png")
Me.TabPage2.Tag = Image.FromFile("C:\testfolder\img2.png")
End Sub
End Class
Here is an example of what it looks like.
If you say it can`t be done then i`ll try it
Thanks :)) I tried you code and it works perfectly.
Though i don't want the tabs have their width's by the size of form, so i fixed a width,
If Me.Created AndAlso Me.TabCount > 0 Then
'Dim tw As Integer = CInt(Me.ClientSize.Width / Me.TabCount)
'Dim offset As Integer = Me.TabCount
'If Me.ItemSize.Width <> tw - offset Then Me.ItemSize = New Size(tw - offset, 32)
Me.ItemSize = New Size(200, 32)
End If
Here is the screenshot,
I just don't know why the arrows (left and right) aren't full. here is a gif,
Why is that :O Should I paint the arrows as well ?
Maybe you are looking for
-
How do I access icloud from my computer at work?
how do I access icloud from my computer at work?
-
I have a Windows 2012 Server set up offering print services to our network, there are about 20 printers set up all deployed via group policy. Recently, on one of our Windows 7 machines I am finding that I an unable to connect to one of the printers s
-
Create Purchase Order using B1ws SAP 8.81
Hi Experts I am creating a Purchase Order using the Web Services SAP 8.81 PL7 SQL 2008, the problem is when i create the PO in business one it comes without the deatails on the lines like Price and Line total what am i doing wrong this is the code fo
-
Mapping from source in same DB as target
We are running a warehouse where part of the data is pumped into a holding schema in the same database as the target schema resides. Using OWB3 we set the "schema property" of all objects in the mappings referring to the holding schema and generated
-
hi all i have recently bought a i-trigue 3000i system for my i-pod classic 20gb. after much searching i bought the zen m vision video cable via creative online to enable me to play videos music and pictures through my tv. i ensured the tv out setting