|
Thanks for replying.
That's exactly what I am doing. I have a control which inherits from Control so it doesn't appear in the toolbox so I instantiate it myself - however the IDE just gets rid of it sometimes - I thought we weren't supposed to change any code in IntializeComponent.
I have project references in the main project but as soon as I switch to Release build all the controls from the controls project disappear from the main project.
I have been at this for a while now and can't get it to work at all.
|
|
|
|
|
You might have covered this already, but did you check the AssemblyVersionAttribute tag, in assembly.cs if you have one, to make sure it doesn't have any * in it? Replace the * with a number so the version number stays constant from build to build while your developing your control.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
That appears to have worked. Thanks for your help.
Rugby League: The Greatest Game Of All.
|
|
|
|
|
While it's a good idea to control your versions, this isn't necessary when you use a project reference as opposed to an assembly reference.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Something just didn't sound right about what he was doing. At least with this method, we know for a fact he wasn't using project references. Thanks for spelling it out for him!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
If you dragged a component from the toolbox than you've got an assembly reference. Project references are recompiled (if necessary) before your project is recompiled, and the assembly is copied locally to your project's target directory. If your controls are disappearing it's most likely because your project is referencing a specific version of the assembly you added originally (and versions greatly matter for assemblies, unlike native DLLs) that is no longer available.
If Dave's suggestion worked, great, but you will still face a problem when you do have to change your assembly version. Be sure to remove all assembly references to projects in your solution and use project references.
You can modify InitializeComponent , but if you don't do it in a designer-friendly manner the designer will not work. Just use the same pattern of code that the designer expects and you'll be fine. I used to do it all the time in the same exact scenario you describe now.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thanks for replying. How do I tell if a reference is an assembly reference or a project reference?
|
|
|
|
|
You as the developer don't know what comprises your own project?
If you need to check, right-click on your solution and select Configuration Manager. Look at the dependencies for your project by selecting your project from the drop-down. If there's a disabled checked checkbox, then you're got a project reference. If not, you're referencing an assembly.
You can also open the .sln file (your solution file) in notepad or some other plain-text editor and look at the solution text to see what is listed. It should be quite obvious.
For a 60+ project solution I used to manage while a senior software architect for another company I never once had a problem - nor did any of my developers - because we all used project references.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I have some controls inherited from UserControl in the sub project and they appear in the toolbox on the My Controls tab but I also have some controls which inherit from Control - how do I get those to appear in the toolbox? At the moment I am editing the code generated by the IDE in the "Windows Form Designer Code" in order to use them which, of course, means they can be gotten rid of at any time. I just want to be able to drag them from the toolbox. How do I do that?
|
|
|
|
|
my project uses an access data base (mdb file) and i want to encrypt that file to prevent abusing the database but if i change the file my project cannot use it because adoconnection can not connect to this encrypted file and if i decode the enrypted file in my project,during running of my project the database file can be abused in out of my application area. what should i do with this problem...
thanks
m.rastgar
m.rastgar
|
|
|
|
|
If it is an option, you should consider encrypting values in database table instead of encrypting the mdb file. So your application will have total control on data of the mdb file, plus you will never need to encrypt the file.
|
|
|
|
|
I have a custom object class that I'm consuming in the SoapHeader of my webservice. This class is in a seperate file, but within the same namespace as the service. The class was derived from an xml schema.
The object gets passed through the header and is processed by the "import()" webmethod.
I can invoke this method manually with no problem -- however, when consuming the webservice in an application, I get a "SoapException" when "import()" is invoked. I have also tried passing the object as a parameter, rather than the header, but the same error occurs.
Any ideas? Thanks,
-Chris B.
-----------------------------
An unhandled exception of type 'System.Web.Services.Protocols.SoapException' occurred in system.web.services.dll
Additional information: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.IO.FileNotFoundException: File or assembly name l4pillnj.dll, or one of its dependencies, was not found.
File name: "l4pillnj.dll"
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Boolean isStringized, Evidence assemblySecurity, Boolean throwOnFileNotFound, Assembly locationHint, StackCrawlMark& stackMark)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Boolean stringized, Evidence assemblySecurity, StackCrawlMark& stackMark)
at System.Reflection.Assembly.Load(AssemblyName assemblyRef, Evidence assemblySecurity)
at System.CodeDom.Compiler.CompilerResults.get_CompiledAssembly()
at System.CodeDom.Compiler.CompilerResults.get_CompiledAssembly()
at System.Xml.Serialization.Compiler.Compile()
at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings)
at System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[] mappings)
at System.Web.Services.Protocols.SoapServerType..ctor(Type type, ProtocolsEnum versionsSupported)
at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
at System.Web.Services.Protocols.ServerProtocol.SetContext(Type type, HttpContext context, HttpRequest request, HttpResponse response)
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)
=== Pre-bind state information ===
LOG: Where-ref bind. Location = C:\DOCUME~1\DD5493~1\ASPNET\LOCALS~1\Temp\l4pillnj.dll
LOG: Appbase = file:///C:/Inetpub/wwwroot/Importer
LOG: Initial PrivatePath = bin
Calling assembly : (Unknown).
===
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/DOCUME~1/DD5493~1/ASPNET/LOCALS~1/Temp/l4pillnj.dll.
--- End of inner exception stack trace ---
|
|
|
|
|
Hi,
I'm having a problem printing my rotated text with Acrobat 6.0. For some reason, the pdf print out scales the rotated text to a much larger value. To draw and rotate the text, I'm using the following:
GraphicsContainer container;
container = g.BeginContainer();
Matrix myMatrix = new Matrix();
myMatrix = g.Transform;
myMatrix.RotateAt(m_Rotation, m_RotationPoint);
g.Transform = myMatrix;
g.DrawString(m_Text, m_Font, myBrush, myRect);
g.EndContainer(container);
Rotated shapes are printed out properly, its just the text with the problem. I'm not sure if this
is an issue with gdi or what?
|
|
|
|
|
hi
befor i get links to threats how i create a string (i think it calls like that in english - german: Zeichenfolge) - no i don't want that!!!
I want to create a reg_expand_sz key in the registry that is another format in the registry.
Thanks for every solution.
i hope you understand what i'm meaning
|
|
|
|
|
If you read the documentation for the RegistryKey.SetValue method, you would find the following:Note When setting a value, the way in which the value being passed is stored in the registry is interpreted. There is no way to control whether the information being passed is stored as an sz, or an expanded_sz string, and therefore, all string values are interpreted as standard sz values.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Like Heath said, it can't be done using the Registry classes in the .NET BCL. You'll have to P/Invoke the calls to the Win32 Registry functions yourself. You can look them up on MSDN here[^] and on pinvoke.net.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I need to put pdf document as BackgroundImage in Form. As I see you can put only image files (jpg,bmp,png...) as Form's BackGroundimage. Is there some way to achieve this with pdf?
Boris
|
|
|
|
|
It's possible, but not probable. Unless you expect a dynamic background (what are you trying to do anyway?), just rasterize the PDF as an image (Adobe Acrobat - the full version - can do this) and use that.
To actually display the PDF as a background would require that you be able to read and render PDFs yourself, and that you override OnPaint (when ControlStyles.AllPaintingInWmPaint is set), or OnPaintBackground ) for a form or control and draw it. This would be very intensive, however, so be sure to only draw the PaintEventArgs.ClipRectangle for said form or control. If you redraw the entire PDF each time you'll drag down the system.
How to read and render PDFs? There's many third-party libraries on the market which you can google[^] for, and - because we've talked about this numerous times in this form - you can click "Search comments" for "PDF" to see what others have had to say about certain libraries.
Again, your best bet is to just rasterize the PDF as an image that is supported by GDI+ (which .NET uses) and set that as the background. It's far more efficient and doesn't require that you override any painting, such that Windows itself handles the painting efficiently.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
How would I be able to launch a windows application from a windows service that would display the windows apps interface. I tried starting a process within the windows service to start i.e. notepad.exe but then it is still hidden and the only way you can tell that it is in there is to go to the task manager.
Thanks for the help.
|
|
|
|
|
You either need to run the service as a particular user with interactive login privileges (and then the Windows application will only run in their Windows station), or you need to mark your service as being interactive. This is a manual process, since there is no support currently in the ServiceInstaller or ServiceProcessInstaller , which you use in conjunction with your own Installer class.
A good way to do this is in your override to Installer.Install , use the Registry and RegistryKey classes to open the key for your service, which is HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\<YourServiceName>, and bitware OR the Type value with 256 (for interactive login). This is only if you run the service as SYSTEM, i.e. setting ServiceProcessInstaller.Username to "" , or String.Empty (which decreases binary size and load times insignificantly).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
thanks a lot. It works ![Smile | :)](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
Hi,
I have a client comopnent (written in C++), which is calling to methods on C# component (using COM Interop).
My problem is, that in some way I need to be able to call from my C# to method implemented in the C++ (kind of a callback...).
Actually it is a kind of "Observer" pattern, where the subscriber is a C++ module and the publisher is a C# component.
for example:
C# Server code:
///
/// The ISink interface is to be implemented by a C++ client
///
interface ISink
{
void OnChange(string msg);
}
interface IServer
{
.
.
int RegistrForChange(ISink sink);
void Broadcast(string msg);
}
class CServer: IServer
{
int IServer.RegisrtForChange(ISing sink)
{
// keep isink in hashtable...
}
int IServer.Broadcast(string msg)
{
foreach (ISink sink in m_hash)
{
sink.OnChange(msg); // OnChange is implemented by the listener (C++)...
}
}
}
C++ Client code
class Client : public ISink //how can this be done...??
{
// Creating IServer object using COM...
void Init()
{
.
.
iServer.RegisterForChange(this);
.
.
}
void OnChange(BSTR msg)
{
printf("Got %s", msg);
}
}
Is there a way of doing this kind of thing???
Thanks!
|
|
|
|
|
What you propose above is a good way of handling such a situation. You simply advise a sink passed to your managed components.
There's several problems, however. When writing CCWs (COM-Callable Wrappers) you need to follow COM best practices. That means attributing your interfaces and coclasses with the GuidAttribute with unique, constant values. Never change an interface definition once published, nor its IID (GuidAttribute value); derive a new interface from it with a different IID and added methods (no overloads, which COM does not support).
So, whether you declare your ISink interface in unmanaged or managed code, make sure you use the same IID.
You might also consider using an interface that is already published for native code: IAdviseSink . This may be more advanced than what you need, however, since it has more to do with clipboard objects (including drag and drop) than anything else.
Also note that while maintaining the same name is a good idea for the interface in both unmanaged and managed code, it's not necessary. So long as the IID and interface definition (including any DispIdAttribute s for IDispatch -derived interfaces) are the same, it's the same interface.
You could also declare events for an interface, which creates a dispinterface for the class if you're declaring the sink in managed code to give to unmanaged code. See the ComSourceInterfaceAttribute for more details.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi Stewart, and thank you for replying.
In my real code, I used the GUID, of course...
I wondered if there is a kind of a code snippet (for both the C# and C++) of how to accomplish this task (or a reference where I can find some hints).
Thanks for your reply, again.
|
|
|
|
|
When asking questions in technical forums don't hold anything relevant back if you expect a decent answer. Holding back what you think to be insignificant facts from your doctor could mean life or death. It's similar for forums such as this.
Sample code for what you propose is all over in the Platform SDK for component development (COM docs). It's not different in managed code (except for language symantics). Implement your ISink on your native (unmanaged) class, and pass an instance to a managed method that takes an ISink . Whenever the managed method needs to callback to the sink, it calls the method of the ISink implementation instance. This is quite a simplified form of events in the managed world, which takes a delegate (a managed callback, or handler) and - often times - stores them in a list. When an event occurs the list is enumerated (when applicable) and each delegate is invoked.
As far as specific examples I know of none, but you should easily be able to figure out how to make it work. You just pass your ISink instance to managed code and when an event occurs your managed code calls methods on the sink.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|