|
He asked this question some time back, too. Several of us suggested taking a screen shot (easy enough with code) but he didn't want that. Isn't that pretty much what you're doing in yours (since Draw wouldn't/shouldn't paint hidden regions)? You probably weren't aware that he asked before and that screen shots wasn't what he wanted, but I'm just trying to clarify what I gathered from your article.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
IIRC you can tell Draw how much to draw (ie in what bounds). However, it's still just a screenshot with a few bells-n-whistles, as you point out. Since HTML is inherantly non-paginated, I'm not sure how much better you could do than that. I wonder if the 'Preview' functionality of explorer could be harnessed somehow for this?
--
Russell Morris
"So, broccoli, mother says you're good for me... but I'm afraid I'm no good for you!" - Stewy
|
|
|
|
|
To print a document to an image is what I was getting at in my reply above. Windows Explorer also uses an IExtractImage implementation that it gets from the shell object (like an HTML document) that it displays in the preview screen at the left in XP. So, yes, it does have this functionality. Getting it to work in .NET is tricky since you have to re-declare a bunch of interfaces and their dependent structs and enums.
There's also a way to create a "printer" that provides an HDC attached to the right information and have it print to an image (Office 2003 comes with one). This tool he mentions may do something similar (I'm not about to download it). There's other ways that you can have IE paint to an HDC you provide, but I can only find this for IHTMLPainter implementations that are implemented by binary behaviors (so they are in-place elements).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
i'm trying to connect using HttpWebRequest class, but i'm getting a 401. i read in the documentation that i need to check the WWW-Authenticate header to see how to perform authentication. the info in the header is "Negotiate,NTLM". do i pass this string into the second param of CrendentialCache.Add()?
|
|
|
|
|
See the documentation for the Credentials Property[^] in the .NET Framework SDK for more information and an example. You don't need to handle the authentication headers yourself, merely pass an ICredentials implementation like the NetworkCredential class. This can already handle basic, digest, HTLM, and kerberos authentication.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
My problem is that the key message must be caught in the DataGridTextBoxe`s TextBox which is read only and can not be assigned to which means the Key Events can not be caught due to protection level.
I tried doing it by adding an inner TextBox control to the TextBox but I am having problems with this solution and there must be a more elegant one.
|
|
|
|
|
Instead of trying to change the Enter key to the Tab key, just make then do the same thing. Handle the Enter key and perhaps use the Select Method[^] on the DataGrid or something similar.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi , Still Not Working
The Enter Key does not raise the KeyPress,KeyDown or
KeyUp events so it is not working.
Thanks for the attention.
|
|
|
|
|
Then try something different, like overriding ProcessDialogKey . Worst case scenario is that you'll have to extend DataGridTextBoxColumn and override the WndProc for the actual TextBox that's used (assuming its protected and the property is virtual, otherwise you'll have to make your own) and handle the key strokes accordingly.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks Heath I will try that.
|
|
|
|
|
I have four mdi child forms on a mdi parent. I cannot find a way to disable the moving of these child forms. I can move them clicking the left mouse button and dragging the form to a different location. It seems like I am dragging and dropping the child forms but I do not get any drag or drop events. Can anyone tell me how to disable the movement of child forms, and how I can catch the movement if I allow it?
Thanks in advance
|
|
|
|
|
Moving a window is not a drag and drop action, as in dragging files and other objects. It's simply a windowing action that updates the coordinates, invalidates the necessary regions, and re-paints the form and the old background region. No DND events would be fired.
If you don't want your MDI child windows to be moved, then you probably shouldn't be using MDI. The whole purpose of MDI is to have child windows within a parent window that act like any other windows. The only way to disable movement is to handle the mouse events and while the mouse is down, retain the coordinates in the MouseMove event, which isn't easy. You can also override WndProc and handle the windows notification messages, canceling them if possible (and it isn't always possible). For this, you need to read about the Windows Management APIs in the Platform SDK at http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/windowing.asp[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I've written a fairly complex MDI app and I cannot think of any instance where movement of the children bothered the app. However I definitely did not want my menu selector, etc. being played with. To handle those forms within the MDI parent I used docking controls......but then they do not become MDI children and an exception would be thrown if they were set to be children.
If you were using an MDI parent for specific placement of forms for multiple displays....for example the upper left window shows all processes running on a selected server while the upper right window shows processor availability and below these two are all possible servers to select from....then an MDI parent was not a good design choice.
In the prior example you can get a better UI by dumping the MDI parent, placing panels on the parent form where you want specific windows, build out each 'window' as user controls, and then at startup populating the panels with the controls.
Now you have the advantage of MDI children (each control manages itself) and you cannot move the 'windows' around anymore.
Not sure if this helps -- if not provide more details on what you are doing and I'll see if I can help.
_____________________________________________
Of all the senses I could possibly lose, It is most often the one called 'common' that gets lost.
|
|
|
|
|
does anyone know of a dll that would convert mp3 to cda, or something else that would help me with that.....Thank You
Da Intern
|
|
|
|
|
Not entirely sure, but you may want to try directX - there is plenty of functionality to use filters to compress/decompress different multimedia types.
Peter
|
|
|
|
|
When i make a reference to excel it works fine, but when i try to make one to outlook or office i get the following error:
"A reference to "'officePath'.Outlook.exe" could not be added. This is not a valid assembly or Com Component. Only components with extensions 'dll' and Com Components can be added. Please make sure the file is accesisble and that it is a valid assembly or com component"
I am using Office 2003 professional.
Does anyone know how to fix this??
|
|
|
|
|
When you want to connect to Outlook, using the add reference in Visual Studio, and point to Microsoft Outlook 11 (which isnt the outlook.exe).
If I was at home, I could give you the full details, but I am pretty sure you cannot directly connect to the Outlook executable.
|
|
|
|
|
You should install the Visual Studio Tools for the Microsoft Office System, which comes with O2K3 Pro I believe. You can download the Office XP PIAs (primary interop assemblies) which you should use as opposed to making your own. These are verified assemblies that are associated with the COM components and typelibs typically produced by the company that wrote the application that you're interop'ing.
The Office XP PIAs can be downloaded from http://www.microsoft.com/downloads/details.aspx?FamilyId=C41BD61E-3060-4F71-A6B4-01FEBA508E52&displaylang=en[^] and should work in a pinch (since properly-written COM is mostly backward compatible). The Office 2K3 PIAs cannot be downloaded (except through MSDN Subscriptions), but should be on the O2K3 Pro CD.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
refer to the link below
http://support.microsoft.com/default.aspx?kbid=327823#1
using System;
using System.Windows.Forms;
public class MyTextBox :System.Windows.Forms.TextBox
{
// Override IsInputKey method to identify the Special keys
protected override bool IsInputKey( System.Windows.Forms.Keys keyData )
{
switch ( keyData)
{
// Add the list of special keys that you want to handle
case Keys.Tab:
return true;
default:
return base.IsInputKey(keyData);
}
}
}
Based on the sample above, I've managed to modify and fire KeyDown Event for textbox, combobox, checkbox, datetimepicker, etc...
except NUMERICUPDOWN.
how to make it work??
|
|
|
|
|
You should override OnTextBoxKeyPress on the NumericUpDown control as well. The existing code handles numbers and letters A-F if Hexidecimal is set to true . Override it and execute your code first, then call base.OnTextBoxKeyPress .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I still can't make it work. Maybe I did some way wrong.
Actually, what I want is to create a customize NumericUpDown(nud) as a class component.
Then, when I create a winform, I can drag and drop the customized nud from toolbox into the winform.
In the winform, and where the nud is, a KeyDown event is binded to it. In the KeyDown Event, I would like to have the code below:
if(e.Keys == Keys.Tab || e.Keys == Keys.Enter)
{
// ...
// Do Something.... some checking here
// ...
//After the checking
//Then only I "manually" call SelectNextControl method
this.SelectNextControl(Control(sender), true, true, true, true);
}
I've put in the "Override IsInputKeys" code and the OnTextBoxKeyPress as well in the component class. When I run debugger, I noticed that Tab Key didn't go into OnTextBoxKeyPress.
Maybe you have to describe more in detail. Thanks.
|
|
|
|
|
I'm trying to create a plugin for an app I am building. I am trying to utalize CreateInstanceAndUnwrap. Been trying for days now, still with no luck. Heres my code:
Sorry its a little messy
AppDomain remote = AppDomain.CreateDomain("Remote DLL");
IPlugin plugin = (IPlugin) remote.CreateInstanceAndUnwrap(
PluginManager.strPath + @"\" + pluginList.SelectedItem,
"IPlugin");
plugin.loadAssembly(PluginManager.strPath + @"\" + pluginList.SelectedItem);
I read some demos of apps sorta like this that use Loader : MarshalByRefObject. But that only gives me a referance to the object not an instance. As you can see I'm trying to place the instence in its own AppDomain so I can unload it later.
Anyone have any suggestions, I'm litteraly pulling my hair out (and its quite painfull )
If you have an example that would be great, what my goal is -- to create the object from the DLL in the other app domain so I can call its functions.
The plugin dll is seralizable.
This is what IPlugin looks like:
public interface IPlugin
{
string Description {get;}
string Author {get;}
void Initalize();
void Render();
void SendData();
void Dispose();
}
The plugin I created looks like this:
public class Plugin : IPlugin
{
public string Author { get { return "Matthew Hazlett"; } }
public string Description { get { return "Testing the plugin"; } }
public void Initalize() {}
public void Render() {}
public void SendData() {}
public void Dispose() {}
public Plugin() { }
}
Matthew Hazlett
Windows 2000/2003 MCSE
Never got an MCSD, go figure...
|
|
|
|
|
Why not try:
ObjectHandle o;
IPlugin plugin;
Type t = Type.GetType("SomeAssembly.dll");
o = Activator.CreateInstance(t);
plugin = (IPlugin)o.Unwrap();
plugin.Render();
- Nick Parker My Blog
|
|
|
|
|
Thank you for your help, but it still will not work correctly. But at least its giving me a different error now:
An unhandled exception of type 'System.NullReferenceException' occurred in PluginHost.exe. It dies on this line o = Activator.CreateInstance(dll, t.ToString());
ObjectHandle o;
IPlugin plugin;
string dll = PluginManager.strPath + @"\" + pluginList.SelectedItem;
Type t = Type.GetType(dll);
o = Activator.CreateInstance(dll, t.ToString());
plugin = (IPlugin)o.Unwrap();
MessageBox.Show(plugin.Author);
I will keep at this and try to get it to work, thanks for pointing me in another direction. Also, if you have any further ideas please let me know.
Matthew Hazlett
Windows 2000/2003 MCSE
Never got an MCSD, go figure...
|
|
|
|
|
I'm still having issues, here is my fussionlog:
*** Assembly Binder Log Entry (3/8/2004 @ 9:12:15 PM) ***
The operation was successful.
Bind result: hr = 0x0. The operation completed successfully.
Assembly manager loaded from: C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\fusion.dll
Running under executable C:\Documents and Settings\hazlema.FRAGNET\My Documents\Visual Studio Projects\PluginHost\bin\Debug\PluginHost.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = IPortal, Version=1.0.1528.2599, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = C:\Documents and Settings\hazlema.FRAGNET\My Documents\Visual Studio Projects\PluginHost\bin\Debug\
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : PluginHost, Version=1.0.1528.37815, Culture=neutral, PublicKeyToken=null.
===
LOG: Processing DEVPATH.
LOG: DEVPATH is not set. Falling through to regular bind.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Post-policy reference: IPortal, Version=1.0.1528.2599, Culture=neutral, PublicKeyToken=null
LOG: Attempting download of new URL file:///C:/Documents and Settings/hazlema.FRAGNET/My Documents/Visual Studio Projects/PluginHost/bin/Debug/IPortal.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\Documents and Settings\hazlema.FRAGNET\My Documents\Visual Studio Projects\PluginHost\bin\Debug\IPortal.DLL
LOG: Entering run-from-source setup phase.
Do you have any other ideas?
Matthew Hazlett
Windows 2000/2003 MCSE
Never got an MCSD, go figure...
|
|
|
|