|
Oops sorry wasn't very clear there. It is in the tabpages collection but not visible.
The code for construction and add tab does the same:
public TabPictureBox()
{
AddTab();
}
public void AddTab()
{
PictureTab a_picTab = new PictureTab("Test Title");
this.TabPages.Add(a_picTab);
this.m_pictureTabList.Add(a_picTab);
this.Dock = DockStyle.Fill;
}
So when creating the object I add one tab, then when I wish to add another tab the collection is updated
but the tab is not visible. I have consulted the msdn documentation and added a tab according to that.
Thanks
Dan
At university studying Software Engineering - if i say this line to girls i find they won't talk to me
Dan
|
|
|
|
|
Well I just did this and it works so that makes me think the problem might be in your PictureTab
private void addTab()
{
string stext = string.Format("Tab {0}", tabControl1.TabPages.Count + 1);
TabPage newPage = new TabPage(stext);
tabControl1.TabPages.Add(newPage);
}
led mike
|
|
|
|
|
Hey, thanks for your help.
I think the problem may be higher up as that code snippet does the same for me as adding my custom tab. If you could have a look at the following code I would be grateful. I haven't worked much with creating user controls so am pretty sure it is a simple error some where.
Thanks
Dan
public partial class TabbedPanelPictureBox : UserControl
{
TabPictureBox m_tabPbx;
public TabbedPanelPictureBox()
{
m_tabPbx = new TabPictureBox(); //this will call TabPictureBox::AddTab()
this.BackColor = System.Drawing.SystemColors.AppWorkspace;
this.Controls.Add(m_tabPbx);
this.Dock = DockStyle.Fill;
}
private void TabbedPanelPictureBox_Load(object sender, EventArgs e)
{
}
public void AddTab()
{
m_tabPbx.AddTab(); //this will also call TabPictureBox::AddTab()
}
}
public class TabPictureBox : System.Windows.Forms.TabControl
{
private List<picturetab> m_pictureTabList = new List<picturetab>();
public TabPictureBox()
{
AddTab(); //Calls AddTab() and works
}
public void AddTab() //Doesnt appear to work outside of constructor
//even when just creating a normal TabPage
{
//PictureTab a_picTab = new PictureTab("Test Title");
TabPage a_picTab = new TabPage("Test Title");
this.TabPages.Add(a_picTab);
//this.m_pictureTabList.Add(a_picTab);
this.Dock = DockStyle.Fill;
}
}
At university studying Software Engineering - if i say this line to girls i find they won't talk to me
Dan
|
|
|
|
|
What version of .NET and Visual Studio are you using? I am on 2005 .NET 2.0 and the first line of code in a UserControl constructor is
InitializeComponent();
So I added your PictureTab class to my test app and the tabs add just fine in response to a toolstrip button click that I have on my form. I did comment out this.Dock = DockStyle.Fill; From the AddTab method as well as the constructor. It should not be in AddTab to begin with and I am not using the control in .Fill mode anyway.
led mike
|
|
|
|
|
Hey.
I am using VS2008 and .NET 3.5
Yeah I had missed InitializeComponent() so have added that but am still having no luck.
The control is in a dll and is referenced in my gui project then instantiated like this:
<code>private void C_GmaGui_Load(object sender, EventArgs e)
{
//Set the main panel to be from where it starts to the edges of the screen
/*SetControlSize(mainPanel, System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Right - mainPanel.Left,
System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Bottom - mainPanel.Top);*/
SetControlSize(panelMain, System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Right - panelMain.Left,
System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Bottom - panelMain.Top);
this.tabbedPanelPictureBox1 = new TabbedPanelPictureBox.TabbedPanelPictureBox();
SetControlSize(this.tabbedPanelPictureBox1,
System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Right - this.tabbedPanelPictureBox1.Left,
System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Bottom - this.tabbedPanelPictureBox1.Top);
//ClearOffScreenBitmap();
//DrawOffScreenBitmapToScreen();
}</code>
This creates the component fine and adds the first tab. However when this bit of code is called:
private void addTabToolStripMenuItem_Click(object sender, EventArgs e)
{
this.tabbedPanelPictureBox1.AddTab();
}
no tab is added. Just to be clear the code in the tabbedpanelpicturebox control is now:
public partial class TabbedPanelPictureBox : UserControl
{
TabPictureBox m_tabPbx;
public TabbedPanelPictureBox()
{
InitializeComponent();
m_tabPbx = new TabPictureBox();
this.BackColor = System.Drawing.SystemColors.AppWorkspace;
this.Controls.Add(m_tabPbx);
this.Dock = DockStyle.Fill;
}
private void TabbedPanelPictureBox_Load(object sender, EventArgs e)
{
}
public void AddTab()
{
m_tabPbx.AddTab();
}
}
and
public class TabPictureBox : System.Windows.Forms.TabControl
{
private List<PictureTab> m_pictureTabList = new List<PictureTab>();
public TabPictureBox()
{
AddTab();
}
public void AddTab()
{
//PictureTab a_picTab = new PictureTab("Test Title");
TabPage a_picTab = new TabPage("Test Title");
this.TabPages.Add(a_picTab);
//this.m_pictureTabList.Add(a_picTab);
//this.Dock = DockStyle.Fill;
}
}
I will try building it under VS2005 and .NET 2.0
Thanks
Dan
At university studying Software Engineering - if i say this line to girls i find they won't talk to me
Dan
|
|
|
|
|
Hi Guru's and Genii
I'm totally stuck here and now I'm clutching at straws.
What I want to do is use a WPF application in C# to place hooks on global low level system events and override some of them.
That's so NOT going to work... Why can't MS see that we need access to these things to expand the UI / UX of Windows?
Anyway, my last ditch attempt at a workaround, before throwing out my 3rd Yr Degree project was to 'cheat'.
I had the idea of a full screen and topmost transparent window. That would obviously allow mouse clicks, events, scrolling typing etc.. to happen to what ever windows / os is running.
However, I need to be able to have my 'invisible' application detect some of these events and perform different things to what the UI of Vista would normally do. I.e. have MY invisible app grab the event and not allow it to 'drop through'
Does anyone please have any ideas.. otherwise I think I'm going to fail my degree... arrgghhh!!!
Grrr.... WHY CAN'T MS GIVE US MANAGED CODE ACCESS TO LOW LEVEL GLOBAL SYSTEM EVENTS??? i.e. HOW windows flick WORKS???
Meh.
|
|
|
|
|
I know nothing about your question but i have heard that you will get to view/change ms code with next .net version
dont know how true it is....but wish it is true.
|
|
|
|
|
Member 4294062 wrote: WHY CAN'T MS GIVE US MANAGED CODE ACCESS TO LOW LEVEL GLOBAL SYSTEM EVENTS?
You can. Google around.
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
This[^] was posted earlier today - it's VERY cool!
|
|
|
|
|
Hi
my company mostly usesd 2.0 framework and i need to do certification for better career .
I know 3.0 would be the in thing in a while in my firm.
But I am in dilemma that should I go for 2.0 or wait for 3.0.
Please advise.
|
|
|
|
|
I been looking for a Socket Tool Kit thats free for C# Sharp on studio 2008
Some thing that will have doc's and help with. Creating Servers in a Windows Application.
|
|
|
|
|
|
Hi guys,
im using foreach to load some data from sqlserver and make appointmens from them in MS Outlook.
Something like this:
<br />
foreach (DataRow dr in dt.Rows)<br />
Bud the problem is that wen there are for example 2 rows in my DataTable, it most create 2 appointments, bud i see that the Seconde appointment always re-writes or removes the First one and then i see only 1 appointment in outlook.
Can somebody help me with this???
thanx
|
|
|
|
|
Can you provide a bit more code to what you are trying to do?
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
Hi Paul Conrad,
Thanx for your response. Here some code of how it is looking like :
Outlook.Application outlookApp = new Outlook.Application();<br />
Outlook.AppointmentItem oAppointment = (Outlook.AppointmentItem)outlookApp.CreateItem(Outlook.OlItemType.olAppointmentItem);<br />
<br />
<br />
SqlCommand start = new SqlCommand("SELECT Act_actualstart,Act_actualstarttime FROM Activities WHERE Act_imp_nr='" + nr + "'and Act_Hoofdactiviteit_index='" + hfdnr + "'and Act_nr='001'", myconn);<br />
SqlDataAdapter da_start = new SqlDataAdapter(start);<br />
DataTable dt_start = new DataTable();<br />
da_start.Fill(dt_start);<br />
<br />
foreach (DataRow drstart in dt_start.Rows)<br />
{<br />
subject = "Communicatie naar; " +nr +"; " + omschrijving ;<br />
outStart = new DateTime();<br />
outStart = Convert.ToDateTime(drstart[0].ToString());<br />
oAppointment.Start = outStart;<br />
<br />
outEnd = new DateTime();<br />
outEnd = Convert.ToDateTime(drstart[1].ToString());<br />
<br />
oAppointment.End = outEnd;<br />
oAppointment.Subject = subject;<br />
oAppointment.Body = body.ToString();<br />
oAppointment.Location = " ";<br />
<br />
oAppointment.ReminderSet = true;<br />
oAppointment.ReminderMinutesBeforeStart = 5;<br />
oAppointment.Importance = Outlook.OlImportance.olImportanceHigh;<br />
oAppointment.BusyStatus = Outlook.OlBusyStatus.olBusy;<br />
oAppointment.Save();<br />
}
|
|
|
|
|
Djavid j wrote: SqlCommand start = new SqlCommand("SELECT Act_actualstart,Act_actualstarttime FROM Activities WHERE Act_imp_nr='" + nr + "'and Act_Hoofdactiviteit_index='" + hfdnr + "'and Act_nr='001'", myconn);
Off topic, string concatenation for queries is very dangerous. Look up Colin Mackay' article on this site about SQL Injection Attacks and why parameterized queries are a good idea.
How many records is the dataset filling?
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
Hi,
There is one dataset. Bud i think that in this case the sqlcommand is not the problem, because i did a check:
everytimne that a appointment is made, i get a message: appointment made succfully.
And in this case i have to datarows, so i get two times the message, and e checked that ofter the first time i got the 'appointment made succesfully' i saw the first appointment in Outlook. bud wen i click on ok on the messagebox i get the second message:'appointment made succesfully', then i see in Outlook that the first appointment is gone, there is only the second one.
(sorry for my english )
|
|
|
|
|
Djavid j wrote: i have to datarows, so i get two times the message
It looks as if maybe your oAppointment.Save(); should be outside the foreach loop.
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
this way it diffenatly wil make just one appointment
|
|
|
|
|
Shouldn't
Outlook.AppointmentItem oAppointment = (Outlook.AppointmentItem)outlookApp.CreateItem(Outlook.OlItemType.olAppointmentItem);
be inside the foreach loop? That way the loop creates a new appointment and saves it instead of overwriting the same object and saving it each time.
|
|
|
|
|
Yes that's the solution, thank you all, great help
|
|
|
|
|
I am having a data source containing millions of records. Is there any data controls (like datagrid/listview) which will bind the data acoording to the region visible to end user i.e. when the grid is scrolled, the data will be loaded & displayed
If you can suggest me any idea on developing a new component also will be helpful. I am thinking about overriding the WndProc method for the message WM_VSCOLL in a grid.
Thanks
*jaans
|
|
|
|
|
As Led Mike explained in the topic just below this, a virtual ListView will do exactly that. Here's a link: [^]
|
|
|
|
|
Thanks Alan.
I have posted my query without reading the latest thread
*jaans
|
|
|
|
|
Hi,
I'm trying to create a ListBox that will only get the items that are currently visible. There could be up to millions of items, so storing them all simultaneously is slow and inefficient.
I tried setting the ListBox's DataSource to a custom object that implements IList, but when I do this, it immediately requests ALL the items.
I tried changing the DrawMode to OwnerDrawFixed, but it exhibits the same behavior.
Can anyone suggest a way of making the ListBox only request the items it's drawing, short of reimplementing it myself? Thanks!
|
|
|
|