Click here to Skip to main content
12,348,726 members (47,697 online)
   

C#

 
AnswerRe: Read PDF Pin
Abhinav S1-Apr-13 20:47
mvpAbhinav S1-Apr-13 20:47 
QuestionFavorites from HTML Pin
MAW301-Apr-13 12:15
memberMAW301-Apr-13 12:15 
AnswerRe: Favorites from HTML Pin
Eddy Vluggen1-Apr-13 13:20
mvpEddy Vluggen1-Apr-13 13:20 
QuestionOpenOffice API for DotNet Pin
ASPnoob1-Apr-13 6:45
memberASPnoob1-Apr-13 6:45 
AnswerRe: OpenOffice API for DotNet Pin
ThePhantomUpvoter1-Apr-13 7:13
memberThePhantomUpvoter1-Apr-13 7:13 
QuestionEach page of report viewer contain single report(.rdlc) Pin
M. K. BASHER1-Apr-13 2:23
memberM. K. BASHER1-Apr-13 2:23 
QuestionHow to use IWin32Window Pin
mhd almidani31-Mar-13 23:31
membermhd almidani31-Mar-13 23:31 
AnswerRe: How to use IWin32Window Pin
Eddy Vluggen1-Apr-13 0:03
mvpEddy Vluggen1-Apr-13 0:03 
GeneralRe: How to use IWin32Window Pin
mhd almidani1-Apr-13 5:09
membermhd almidani1-Apr-13 5:09 
GeneralRe: How to use IWin32Window Pin
Alan N1-Apr-13 5:24
memberAlan N1-Apr-13 5:24 
GeneralRe: How to use IWin32Window Pin
mhd almidani1-Apr-13 20:35
membermhd almidani1-Apr-13 20:35 
GeneralRe: How to use IWin32Window Pin
Eddy Vluggen1-Apr-13 11:34
mvpEddy Vluggen1-Apr-13 11:34 
AnswerRe: How to use IWin32Window Pin
Richard MacCutchan1-Apr-13 0:03
mvpRichard MacCutchan1-Apr-13 0:03 
QuestionCustom TabControl: Designer adds TabPages in wrong order! Pin
Revolty31-Mar-13 9:33
memberRevolty31-Mar-13 9:33 
Hey

I've a custom TabControl that inherites Forms.UserControl, not Forms.TabControl. This shall behave just as a normal TabControl codewice. The issue is that TabPages beeing added in the wrong order by the designer. At first it is ok, 2 pages beeing added as expected, #1 and then #2, but when I make any changes to a Page #2, the Text for example - Page #2 beeing added as #1 in designer (the order is now incorrect):

this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage1);

Pages beeing added like this in my control:

protected override void OnControlAdded(ControlEventArgs e)
{
    base.OnControlAdded(e);
 
    m_Pages.Add(e.Control as TabPage);
}

And the control designer looks like this:

public class TabControlDesigner : ParentControlDesigner
{
    private DesignerVerbCollection m_Verbs;
 
    public override void InitializeNewComponent(IDictionary defaultValues)
    {
        base.InitializeNewComponent(defaultValues);
 
        OnAddTabPage(this, EventArgs.Empty);
        OnAddTabPage(this, EventArgs.Empty); 
    }
 
    public override DesignerVerbCollection Verbs
    {
        get
        {
            return m_Verbs != null ? m_Verbs : m_Verbs = new DesignerVerbCollection(new DesignerVerb[] { new DesignerVerb("Add Tab", OnAddTabPage) });
        }
    }
 
    protected void OnAddTabPage(Object sender, EventArgs e)
    {
        IDesignerHost Host = (IDesignerHost)GetService(typeof(IDesignerHost));
 
        if (Host == null)
            return;
 
        TabControl Control = Component as TabControl;
 
        if (Control == null)
            return;
 
        TabPage newPage = Host.CreateComponent(typeof(TabPage)) as TabPage;
 
        MemberDescriptor Descriptor = TypeDescriptor.GetProperties(Control)["Controls"];
 
        RaiseComponentChanging(Descriptor);
 
        newPage.Text = newPage.Name;
        newPage.Owner = Component as TabControl;
        newPage.BackColor = Color.White;
 
        Control.Controls.Add(newPage);
                
        RaiseComponentChanged(Descriptor, null, null);
    }
 
    public override bool CanParent(Control c)
    {
        if (c is TabPage)
            return !Control.Contains(c);
        else
            return false;
    }
 
    protected override void WndProc(ref Message m)
    { 
        if (m.Msg == 0x201 /*WM_LBUTTONDOWN*/)
        {
            TabControl c = Component as TabControl;
 
            int lParam = m.LParam.ToInt32();
            Point p = new Point(lParam & 0xffff, lParam >> 0x10);
 

            for (int i = 0; i < c.Controls.Count; i++)
            {
                 if (c.GetTabRect(i).Contains(p))
                 {
                     c.SelectedIndex = i;
                     return;
                 }
            }
            
        }
 
        base.WndProc(ref m);
    }
 
    protected override void OnDragDrop(DragEventArgs e)
    {
        ((IDropTarget)((TabControl)Component).SelectedPage).OnDragDrop(e);
    }
 
    protected override void OnDragEnter(DragEventArgs e)
    {
        ((IDropTarget)((TabControl)Component).SelectedPage).OnDragEnter(e);
    }
 
    protected override void OnDragLeave(EventArgs e)
    {
        ((IDropTarget)((TabControl)Component).SelectedPage).OnDragLeave(e);
    }
 
    protected override void OnDragOver(DragEventArgs e)
    {
        ((IDropTarget)((TabControl)Component).SelectedPage).OnDragOver(e);
    }
}        


modified 31-Mar-13 16:58pm.

AnswerRe: Custom TabControl: Designer adds TabPages in wrong order! Pin
Revolty7-Apr-13 5:18
memberRevolty7-Apr-13 5:18 
Questionكيف البحث عن ملفات محرر التسجيل Pin
reemaziz31-Mar-13 6:13
memberreemaziz31-Mar-13 6:13 
AnswerRe: كيف البحث عن ملفات محرر التسجيل Pin
Kenneth Haugland31-Mar-13 6:49
memberKenneth Haugland31-Mar-13 6:49 
AnswerRe: كيف البحث عن ملفات محرر التسجيل Pin
Richard MacCutchan31-Mar-13 8:02
mvpRichard MacCutchan31-Mar-13 8:02 
Questioninsatling mssql server 2008r2 Pin
Ashbinsapkota31-Mar-13 5:39
memberAshbinsapkota31-Mar-13 5:39 
AnswerRe: insatling mssql server 2008r2 Pin
Pete O'Hanlon31-Mar-13 5:52
protectorPete O'Hanlon31-Mar-13 5:52 
AnswerRe: insatling mssql server 2008r2 Pin
Abhinav S31-Mar-13 22:40
mvpAbhinav S31-Mar-13 22:40 
QuestionSqlDependency. Can't realize. Pin
Member 995500631-Mar-13 0:05
memberMember 995500631-Mar-13 0:05 
AnswerRe: SqlDependency. Can't realize. Pin
Eddy Vluggen31-Mar-13 0:31
mvpEddy Vluggen31-Mar-13 0:31 
GeneralRe: SqlDependency. Can't realize. Pin
Jeka Developer1-Apr-13 2:43
memberJeka Developer1-Apr-13 2:43 
AnswerRe: SqlDependency. Can't realize. Pin
Eddy Vluggen1-Apr-13 2:55
mvpEddy Vluggen1-Apr-13 2:55 
GeneralRe: SqlDependency. Can't realize. Pin
Jeka Developer1-Apr-13 4:57
memberJeka Developer1-Apr-13 4:57 
GeneralRe: SqlDependency. Can't realize. Pin
Eddy Vluggen1-Apr-13 11:41
mvpEddy Vluggen1-Apr-13 11:41 
GeneralRe: SqlDependency. Can't realize. Pin
Jeka Developer2-Apr-13 10:24
memberJeka Developer2-Apr-13 10:24 
GeneralRe: SqlDependency. Can't realize. Pin
Eddy Vluggen3-Apr-13 6:52
mvpEddy Vluggen3-Apr-13 6:52 
AnswerRe: SqlDependency. Can't realize. Pin
jschell1-Apr-13 8:12
memberjschell1-Apr-13 8:12 
GeneralRe: SqlDependency. Can't realize. Pin
Jeka Developer2-Apr-13 10:26
memberJeka Developer2-Apr-13 10:26 
QuestionSNMP Pin
Sahar.H30-Mar-13 22:05
memberSahar.H30-Mar-13 22:05 
AnswerRe: SNMP Pin
Pete O'Hanlon30-Mar-13 23:09
protectorPete O'Hanlon30-Mar-13 23:09 
QuestionRegarding class instance and memory allocation c# Pin
Tridip Bhattacharjee30-Mar-13 20:33
memberTridip Bhattacharjee30-Mar-13 20:33 
AnswerRe: Regarding class instance and memory allocation c# Pin
Eddy Vluggen31-Mar-13 1:12
mvpEddy Vluggen31-Mar-13 1:12 
GeneralRe: Regarding class instance and memory allocation c# Pin
Tridip Bhattacharjee1-Apr-13 4:29
memberTridip Bhattacharjee1-Apr-13 4:29 
GeneralRe: Regarding class instance and memory allocation c# Pin
Eddy Vluggen1-Apr-13 11:49
mvpEddy Vluggen1-Apr-13 11:49 
AnswerRe: Regarding class instance and memory allocation c# Pin
PIEBALDconsult31-Mar-13 4:48
memberPIEBALDconsult31-Mar-13 4:48 
QuestionWCF file upload functionality and message contract usage Pin
Tridip Bhattacharjee30-Mar-13 19:52
memberTridip Bhattacharjee30-Mar-13 19:52 
QuestionControl when to display something in a projector Pin
drazen1230-Mar-13 17:26
memberdrazen1230-Mar-13 17:26 
AnswerRe: Control when to display something in a projector Pin
OriginalGriff30-Mar-13 21:56
mvpOriginalGriff30-Mar-13 21:56 
QuestionNumber slider puzzle solver code c# Pin
jebreil 64429-Mar-13 19:00
memberjebreil 64429-Mar-13 19:00 
AnswerRe: Number slider puzzle solver code c# Pin
Kenneth Haugland29-Mar-13 21:40
memberKenneth Haugland29-Mar-13 21:40 
GeneralRe: Number slider puzzle solver code c# Pin
harold aptroot29-Mar-13 23:17
memberharold aptroot29-Mar-13 23:17 
QuestionBack and Forward Button for windows explorer Pin
baharan2029-Mar-13 10:42
memberbaharan2029-Mar-13 10:42 
AnswerRe: Back and Forward Button for windows explorer Pin
Tyler Candee29-Mar-13 10:50
memberTyler Candee29-Mar-13 10:50 
GeneralRe: Back and Forward Button for windows explorer Pin
baharan2029-Mar-13 11:14
memberbaharan2029-Mar-13 11:14 
AnswerRe: Back and Forward Button for windows explorer Pin
Eddy Vluggen31-Mar-13 1:15
mvpEddy Vluggen31-Mar-13 1:15 
QuestionOSPF in the WSN Pin
traidat199229-Mar-13 7:11
membertraidat199229-Mar-13 7:11 
AnswerRe: OSPF in the WSN Pin
Pete O'Hanlon29-Mar-13 8:25
protectorPete O'Hanlon29-Mar-13 8:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web02 | 2.8.160621.1 | Last Updated 24 Jun 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid