|
Hi,
I want to add a background image to treeView. I tried to override the background image or to use transparent color(the treeView is on a panel, so I put the image on the panel) but for that, I needed to set the ControlStyle to ControlStyle.UserPaint.
When I do that, I can see the background inage, but I can't see all the nodes in the tree..
Can anyone help?
Thanks
|
|
|
|
|
The reason the property was hidden is because it is not supported. The TreeView class, you see, encapsulates the Tree-View common contorl. Most of the controls in Windows Forms encapsulate Windows common controls. They handle messages and send messages as you would in VC++, MFC, etc.
The Tree-View common control does not support background images. If you want such support, you should take a look at a much better tree anyway, like UltraWinTree from Infragistics[^]. It supports drag and drop, multi-select, background images, multiple tree node images, Visual Styles, and has a great UI toolkit. It's a royalty-free control that is pretty cheap. You'll spend a hell of a lot more money in man-hours trying to reproduce even just a couple features that you're given in UltraWinTree.
There's also others, like XtraTree (something like that) from Developer Express[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
I'm trying to transfer an argument to a webmethod of type System.Version. The method is declared like
public string Something(System.Version version, string strText) {...}
but when a client (C# program) calls the method, I get the following type information for the parameters:
string MyWebservice.Something(some.strange.namespace.Version version, string strText)
- where I would expect
string MyWebservice.Something(System.Version version, string strText)
So I can't transfer a System.Version as first argument. What am I doing wrong ? Can't such types be transferred to a webservice ? Have I forgot to scope something with the correct namespace ?
The SOAP packet description that displays when accessing the .asmx file says something like
<something xmlns="the.namespace.here">
<strtext>string
<version>
Where I would expect
<something xmlns="the.namespace.here">
<strtext>string
<version>System.Version
Any help would be greatly appreciated.
Best regards
Jan Hansen
Do you know why it's important to make fast decisions? Because you give yourself more time to correct your mistakes, when you find out that you made the wrong one. Chris Meech on deciding whether to go to his daughters graduation or a Neil Young concert
|
|
|
|
|
There's nothing wrong with that namespace - it your project's root namespace plus the namespace you configured for the Web Reference when you added it, plus the class name (Version ).
No, not just any type can be used in an XML Web Service, not without some extra support. Remember that XML Web Services are not .NET-specific, and other platforms won't have a System.Version, mscorlib type, though they will have the primatives that .NET has as well.
So you either have to declare it as a string and document what that parameter should contain (typically the best way), or declare a simple struct that can be reflected in WSDL. This ensures that other platforms can use your version struct (or class, if you'd like, but a struct would probably be better, also seeing as Version itself is a struct).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks a lot !
If I remember it correctly, I Can't just declare a standard struct and use an argument of that type - I need to do something special to get that struct "out" of the webservice. Do I have to mark it like a method is marked [WebMethod] ?
/Jan
Do you know why it's important to make fast decisions? Because you give yourself more time to correct your mistakes, when you find out that you made the wrong one. Chris Meech on deciding whether to go to his daughters graduation or a Neil Young concert
|
|
|
|
|
Nope, just declare the struct as public and your parameter declared as that type.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I'm working on a C# dll that passes data back to an older vb6 application. Passing the standard data types are no problem, however, passing a collection of objects (SortedList) have been troublesome.
Has anyone tried this before? And if so how did you do it? Looking for any reference material or sample code.
Thank You,
ddcs
|
|
|
|
|
Hi,
How do I get the installation path that the user selects while installing ?
If I had to copy a specific file from a folder in the local machine under the path where the application is installed , How do I do it ?(for eg : if I have a file named aaaa.dll which is tend to change frequently in the same folder as I have the setup.exe , if the installation path selected is C: and I have created 2 folders bin & data under it using File system editor in setup .How can I copy aaaa.dll to bin & data folder at runtime).
Thankx in advance
Priya
|
|
|
|
|
what kind of set up tool that you are using.
Rock Throught The Night
|
|
|
|
|
I'm using VS.NET setup & deployment project
|
|
|
|
|
Hi, Priya
You will need to add a custom action to your setup project. Pass the [TARGETDIR] variable to your custom action:
CustomActionData = /instdir=[TARGETDIR]\\
(the last "\\" is neccessary for correct passing of paths)
Get the "instdir" parameter in the custom installer class's Install method in the custom action project:
[code]
Dim instdir As String = Me.Context.Parameters("instdir")
[/code]
That's it
Regards,
Serge (Logic Software, Easy Projects .NET site)
|
|
|
|
|
You can interop with the msi.dll COM server to get access to the database and package methods, or you can P/Invoke the exported C-style functions from the same DLL.
You can query the component's installation directory at any time using MsiGetComponentPath , where you pass the ProductCode, the ComponentId, and a path buffer plus it's maximum declared size. See the Windows Installer SDK in MSDN[^] for more details.
There's a catch, though: VS.NET's Windows Installer project sucks. It will generate new ComponentIds each time you recompile and doesn't let you specify a feature/component layout. I'd recommend getting a decent Windows Installer development environment like Wise for Windows Installer[^].
Finally, whether or not that file changes often Windows Installer is designed to allow for such changes and you should not copy the file manually. Windows Installer is an installation package manager - not just a simple install runtime. Just add the changed file to your setup project and make sure that the project's property "RemovePreviousVersions" is set to True and that the "UpgradeCode" never changes. Also change the "Version" according to how much changed (it's really up to you).
If you'd like, you can generate a patch (.msp file) that is the difference between two installation packages. Again, though, because of the Windows Installer's short-comings this would be difficult and would require manual, post-build steps.
This is the correct way to distribute updates to your product.
If you're interested in Windows Installer, see Widnows Installer[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Dear sir !
+. How can I initialize tapiFax
+. Tapi3.x which is support send/recevice Fax ?
+. Please help me
|
|
|
|
|
How can check event when value changed True or False.?
Thank!
|
|
|
|
|
More than likely there is a much easier way, but you can always write your own class and inherit it from the DataGridBoolColumn class and you'll be able to handle the checkbox events in that class. As long as you don't change anything else, all other functionality will remain the same. Hope this helps.
|
|
|
|
|
The problem is that the DataGridBoolColumn does not use a CheckBox - it's actually drawn using the appropriate state using ControlPaint.DrawCheckBox .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks Heath, I've never actually used the boolcolumn, just assumed it was the same as the textbox column. I'll try not to give bad advice in the future!
|
|
|
|
|
A CheckBox is not actually used in a DataGridBoolColumn . The class uses ControlPaint.DrawCheckBox to draw a checkbox in the appropriate state.
A good way is - if you're binding DataSet s or DataTable s (which actually contain the row data in a DataSet - is to handle the DataTable.RowChanged event. The DataRowChangeEventArgs gives you information about the DataRow that was changed, though not the exact column that was changed. When this event is fired, though, just check the boolean columns in your handler and do whatever action is appropriate.
A more abstract implementation - to handle cases when you bind ADO.NET data sources or typed lists (any IList or IListSource implementation) is to get the CurrencyManager for the control and handle the ItemChanged event:
private void WatchForChanges()
{
CurrencyManager cm = (CurrencyManager)dataGrid1.BindingContext[
dataGrid1.DataSource, dataGrid1.DataMember];
cm.ItemChanged += new ItemChangedEventHandler(
this.CurrencyManager_ItemChanged);
}
private void CurrencyManager_ItemChanged(object sender,
ItemChangedEventArgs e)
{
}
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I print 6x4 inch pictures using graphics.DrawImage(),it should work well in most of papersize. But if I select some papersize such as 17x11, 8k and B4,it can't print correct size pictures. I using A4 paper to print and only modify papersize,and I think it should can print size picture. I don't know what's the matter.
thank you.
|
|
|
|
|
In MS SQL Server, it's got an attacth and dettach database, so i want to write a programme to do that, but i do not know where to start.
Thanks
Rock Throught The Night
|
|
|
|
|
Use a SqlCommand to execute them, just like you'd type them in a command parser (like the Query Analyzer or osql.exe). Use a SqlConnection that specifies the 'master' database as the 'Initial Catalog', however. The 'master' database must always exist, otherwise you can't do anything, so it's a good database to attach to when running commands like that.
A simple example (without any error checking, like seeing if the files actually exist first):
public void AttachDatabase(string name, string mdfFile, string ldfFile)
{
using (SqlConnection conn = new SqlConnection(
"Data Source=.;Initial Catalog=master;Integrated Security=SSPI"))
{
SqlCommand cmd = conn.CreateCommand();
cmd.CommandText = "exec sp_attach_db @dbname, @filename1, @filename2";
cmd.Parameters.Add("@dbname", SqlDbType.NVarChar, 128).Value = name;
cmd.Parameters.Add("@filename1", SqlDbType.NVarChar, 260).Value = mdfFile;
cmd.Parameters.Add("@filename2", SqlDbType.NVarChar, 260).Value = ldfFile;
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
}
} See the documentation for the sp_attach_db and sp_detach_db stored procs, as well as the SqlCommand.Parameters collection property for more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
thank you very much.;)
Rock Throught The Night
|
|
|
|
|
I need to implement a delete FileDialog, which looks exactly like OpenFileDialog, only the button is delete button.
What the easiest way to do that without inventing the wheel all over again.
Best Regards.
Anat.
|
|
|
|
|
There really isn't an easy way, and this will most likely be easiest in a mixed-mode Managed C++ project.
First of all, you need to P/Invoke either the GetOpenFileName or GetSaveFileName APIs, which the OpenFileDialog and SafeFileDialog components already do for you. But you must do it because you must fill-out your own OPENFILENAME struct, which must have certain fields set, as well as the hook procedure (depends on the flags you specify, one of which must be OFN_ENABLEHOOK (32)). You must P/Invoke the SetWindowText and any other APIs (like FindWindow , EnumChildWindows , etc.) to help you find the "OK" button (and for localization, don't assume it always says "OK"). This is so that you can change the caption to "Delete".
You call these from your hook proc you specified in the OPENFILENAME structure when you receive the WM_INITDIALOG (272) message. You also should handle the CDN_FILEOK (-606) message and at that point delete the file.
There's a lot to understand, so I recommend you read about the GetOpenFileName [^] and/or GetSaveFileName [^] (you're modifying the behavior, so it really doesn't matter which you use) in the Platform SDK.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thank you.
I didn't thought of using managed c++. It's a great idea.
I'll try it.
Best Regards.
Anat.
|
|
|
|
|