|
Is there an expander control for C# windows app?
|
|
|
|
|
|
I have two windows forms, FormPurchaseHistory and FormCustomer. FormPurchaseHistory opens up FormCustomer which displays a list of Customers in a DataGridView control. User clicks on a cell to select a customer and FormCustomer passes the CustomerID to FormPurchaseHistory and FormCustomer closes. There is a method in FormPurchaseHistoy I need to call after FormCustomer passes CustomerID to FormPurchaseHistory to retrieve purchase history by the customer. How do I fire that method?
I am using a static variable in a Module to pass value from FormCustomer to FormPurchaseHistory.
|
|
|
|
|
|
I have seen lots of good articles on owner-drawn ComboBox controls that can display multi-column data. What I need to do is to override the Paint of the TextBox portion of the ComboBox so that I can display one or more of the columns of the selected item.
I've made multiple attempts at this and always failed. Somehow the MS ComboBox control gets flaky when you try to override the paint event for the TextBox portion of the control. I suspect its going to require some fancy API coding to get it to work.
Anybody know where to start?
Thanks,
Sean
|
|
|
|
|
secovel wrote: Anybody know where to start?
From scratch.
Seriously: Its good to extend given controls but only to a certain extend. I had more than once made the experience that it is sometimes more work to bend the .Net framework controls to my needs instead of just writing my own.
Think about your case: You are painting the combobox items yourself. Now you also want to paint the textbox yourself. What is left of the original control? Probably not more than the dropdown button...
|
|
|
|
|
Hi All
How can I rotate the world in Managed DirectX using mouse drag and zooming using Scroll, like DirectX Viewer did
Thx All
|
|
|
|
|
Text Graphics has the facility to rotate the text by using RotateTransform.
Change its corrdinate in mouse move and Zoom in .
If you can think then I Can.
|
|
|
|
|
I want to buid my custom DVD graph and then get all the DVD interface.
I know how to build the graph but I don't know how to get the DVD interface.
I am using the DirectShowLib library.
Of course, I cannot use the code below which is for graph created using the
DvdGraphBuilder
Guid riid = typeof( IDvdInfo2 ).GUID;
hr = dvdGraph.GetDvdInterface( riid, out comobj );
Marshal.ThrowExceptionForHR( hr );
My code for creating the graph is:
m_graphBuilder = (IFilterGraph2) new FilterGraph();
idvdnav = new DVDNavigator() as IBaseFilter;
hr = m_graphBuilder.AddFilter(idvdnav,"DVD Navigator");
Marshal.ThrowExceptionForHR(hr);
IPin nav_video = GetPinByName(idvdnav,"Video");
hr = m_graphBuilder.Render(nav_video);
Marshal.ThrowExceptionForHR(hr);
IPin nav_AC3 = GetPinByName(idvdnav,"AC3");
hr = m_graphBuilder.Render(nav_AC3);
Marshal.ThrowExceptionForHR(hr);
IPin nav_SP = GetPinByName(idvdnav,"SubPicture");
hr = m_graphBuilder.Render(nav_SP);
Marshal.ThrowExceptionForHR(hr);
I think I must get IDvdInfo2 and IDvdControl2 interfaces of the DVD Navigator somewhere but I
am lost.
I tried to add the code below but I don't think it is working:
comType = Type.GetTypeFromCLSID(typeof( DVDNavigator ).GUID, true);
if (comType == null)
throw new NotImplementedException(@"DVD Navigator not installed/registered?");
comobj = Activator.CreateInstance(comType);
dvdInfo = (IDvdInfo2) comobj;
dvdCtrl = (IDvdControl2) comobj;
comobj = null;
Any idea?
Thanks in advance for you help.
PS: I wanted to post this question of SF forum but it seems it's impossible to start new threads there.
Manusse
-- modified at 16:05 Sunday 30th April, 2006
|
|
|
|
|
Hi,
I have also posted this question in SF forum after it started working again.
I got an answer and posted my comments.
I copy it also here for those interested:
The answer I got:
I believe you get those off the DvdNavigator, don't you?
IDvdInfo2 dvdInfo = idvdnav as IDvdInfo2;
My answer:
Thanks for your reply.
In the meantime I had found it also.
In my case as dvdInfo is already defined, a simple cast will do the job. It is easier than what I thought:
dvdInfo = (IDvdInfo2) idvdnav;
I am a beginner in C# but I am impressed by its apparent ease of use.
The answer was there:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vcwlkCOMInteropPart1CClientTutorial.asp
See: Using Casts Instead of QueryInterface
I think this also means that the DVDPlay sample could be a bit simplified.
For example instead of:
hr = dvdGraph.GetDvdInterface( typeof( IVideoWindow ).GUID, out comobj );
DsError.ThrowExceptionForHR( hr );
videoWin = (IVideoWindow) comobj;
comobj = null;
Simply writing:
videoWin = (IVideoWindow) graphBuilder;
Does the same job
Manusse
-- modified at 16:06 Sunday 30th April, 2006
|
|
|
|
|
Hi all,
I have a Datalist with dynamicly created CheckbosLists in it, a little like this:
protected void lstDashboardOptions_ItemDataBound(object sender, System.Web.UI.WebControls.DataListItemEventArgs e)
{
CheckBoxList cbxDashboardGroup = new CheckBoxList();
DataListItem item = e.Item;
if ((item.ItemType == ListItemType.Item) ||
(item.ItemType == ListItemType.AlternatingItem))
{
cbxDashboardGroup = (CheckBoxList)item.FindControl("cbxDashboardGroup");
DataRowView drv = (DataRowView)item.DataItem;
int intReportId = Convert.ToInt32(drv.Row["rep_id"]);
cbxDashboardGroup.DataSource = ccoDalReport.ReportGetTabs(intReportId);
cbxDashboardGroup.DataTextField = "rta_Name";
cbxDashboardGroup.DataValueField = "rta_Id";
cbxDashboardGroup.DataBind();
}
}
The code works fine. The problem comes when I want to check wich items has been selected. I do this in a foreach loop a little like this:
protected void btnDashboardSave_Click(object sender, EventArgs e)
{
foreach (DataListItem item in lstDashboardOptions.Items)
{
foreach (Control ctrl in item.Controls)
{
if (ctrl is CheckBoxList)
{
foreach (ListItem lstItem in (ctrl as CheckBoxList).Items)
{
Response.Write(lstItem.Text +"["+ lstItem.Selected) + "]<br>";
}
}
}
}
}
The item text comes out right, but the item selected always return false i.e. not checked.
The whole thing is sitting in a usercontrol, but that shouldn't be the reason for it not to work. Any one knows what I'm doing wrong here.
Mike
|
|
|
|
|
Here is how I detemine if a CheckedListBox item is checked:
for (int i = 0; i < checkedListBox1.Items.Count; i++)
{
if (checkedListBox1.GetItemChecked(i)==true)
{
}
else
{
}
}
|
|
|
|
|
But I'm using a CheckBoxList which does not contain the 'GetItemsChecked' property.
I have tried to use your approach though with the 'for' loop instead of the 'foreach' loop.
Doesn't solve the problem though ):
Maybe I should mension that I'm working in a usercontrol in a webform.
Thanks for the effort
ZeedijkWhore
|
|
|
|
|
If you are doing this in ASP.NET then be sure that state of dynamicly added control is ok... It is possible that you are losing Control state between postbacks...
|
|
|
|
|
Thanks - You hit it exatly on the spot.
The checked state was lost during the postback.
Works now...
M¡ke
|
|
|
|
|
(My english is understandable i guess, enjoy! )
Yes, I read here on a thread that this cannot be done, unless the user isnt an adminstrator BUT, isnt it possible to run my process as a thread in another? for example, Explorer.exe. The thing is, my little project works as a computer-timeuse-control, logs out a user from the application after a specific time of use... my app goes to a maximized state and is topmost :p (if you know another way to lock the desktop, let me know ) I use my own account-system (lol, sounds like a huge project, just a simple database in access) For the time being I use a function on formclosing, if the account isnt an administrator (admin in my account-system) the app cant be closed. So I really want to protect it from being killed from the Task Manager, if its possible even from Unlocker
If this already been asked and answered, please let me know I did search on the subject here and on google without luck.
//Andreas
|
|
|
|
|
|
fast answer, damn
The program will run under an administrator-account so I cant really use that trick
|
|
|
|
|
Administrators can kill any process. Of course, certain system processes will be restarted automatically (explorer comes to mind). You could have 2 processes both that watch each other; if one is terminated, the other process would restart it. Just a thought.
|
|
|
|
|
Yes thats what i thought about too, two processes that watches eachother (like some trojans do). But ZoneAlarm uses something to prevent their process from being killed. I though about one more way to do it, like rootkit does, hiding it from being seen in any process manager.
|
|
|
|
|
The thing I want to do is simple: bind Control to String... so I must be missing something obvious... here's code:
[code]
string stringDataSource = "Hello";
private void Form1_Load(object sender, EventArgs e)
{
textBox1.DataBindings.Add("Text", stringDataSource, null);
}
private void btnWork_Click(object sender, EventArgs e)
{
MessageBox.Show(stringDataSource);
}
[/code]
Tnx
|
|
|
|
|
Since strings are immutable in .NET, this shouldn't work. A string is never changed. When a string reference points to a new value, it is literally pointing to a new string in the string pool (i.e. it points to a different memory address). Plus, databinding requires that you bind to a property, not to a value directly. Expose your string as a property on another object and then bind to that object & property.
Josh
|
|
|
|
|
First of all, tnx a lot Josh... I surely better understand whole thing now.
On another matter -> is it possible to bind to a member of Collection? If I'm having this situation:
<br />
public class ModificatorData<br />
{<br />
private List<String> address;<br />
public List<String> Address<br />
{<br />
get { return address; }<br />
set { address = value; }<br />
}<br />
}<br />
Is it possible that I say -> textBox1 bind to first member of Address collection... textBox2 to second member... and so on?
I guess answer is no because it's what DataGrids and DataSets do and you can't easily expose every member as Property, but I'm still courious...
Again -> tnx for your help
|
|
|
|
|
Technically, you could have each textbox bind to a different element in a collection, but that isn't the intended use of simple databinding. Simple databinding (binding a control property to a data source property) is meant to allow multiple controls on a Form to display the various values found in one object (i.e. one Address object in a collection).
The "current" object being bound to in a collection is scoped to a BindingContext. Each control using the same binding context (which is the default set up) will display a value from the current item. If you really want each textbox to display a value from a different address, you'd need to establish the binding for each control in a separate binding context. Then move the currency manager's current object in each binding context to set the "current" object for that control. Sound like fun?
Josh
|
|
|
|
|
DataSet + DataGrid is much easier
Tnx a lot for your help.
|
|
|
|