|
Hi, there's something that really irks me with my Form application (using mc++; hope that doesn't matter)... When I start my app, there is a small delay such that it shows my form with no widgets at a very small size (about the default size when creating a Windows Form Project in VS.NET), then quickly resizes to the size the form should be, and places the widgets... It does this very quickly, but it's still noticable and very annoying... Anyone know why it is doing this and how I might fix it...???
-- istrasci
|
|
|
|
|
Hi everybody
-) How a Windows Service intracts with a program( application ) and how a application use a service ?
|
|
|
|
|
Applications can interact with services via .NET remoting, you'll find a lot about it on MSDN.
_________________________________
Please inform me about my English mistakes, as I'm still trying to learn your language!
|
|
|
|
|
Hi ALL
I want to create hyperlink column in datagrid.And i want to create it with the option auto generate columns.Can any one tell me how can i do this with this option its very to create with auto generate column = false, but with true?????????????
Thanking u in anticipation
Take it easy...
|
|
|
|
|
hi
u will have to go into html tag then
in datagrid column build an item template then
place an asp link button by doing the following
|
|
|
|
|
Hi all,
I want to record MenuItem click event at before the event is processed by using below code
BindingFlags all = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.FlattenHierarchy;
PropertyInfo eventsProp = control.GetType().GetProperty( "Events", all);
EventHandlerList handlers = (EventHandlerList) eventsProp.GetValue( control, null );
FieldInfo field = typeof(Control).GetField("EventClick", all);
object value = field.GetValue(control);
handlers[value] = Delegate.Combine(eventHandlerToBePutAtStart, handlers[value]);
This work fine with Control type but not with MenuItem I just know that the FieldInfo return from :
FieldInfo field = typeof(Control).GetField("EventClick", all);
is null. Why is that ? Please help me!
Thank in advance!
|
|
|
|
|
MenuItem does not have Control as base class, so typeof(Control).GetField("EventClick", all) ain't gonna work.
How about FieldInfo field = typeof(MenuItem).GetField("EventClick", all); ?
Hope this helps!
|
|
|
|
|
Thank you for your reply!
I tried it as you said but got nothing.
Here is my code:
private static BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.FlattenHierarchy;
private static FieldInfo EventKey( string name, Type type )
{
FieldInfo key = type.GetField( "Event" + name, flags );
if (key != null)
{
return key;
}
key = type.GetField( "EVENT_" + name.ToUpper(), flags );
if (key != null)
{
return key;
}
if (name == "TextChanged")
{
key = type.GetField( "EventText", flags );
}
if (key != null)
{
return key;
}
if (type == typeof(object))
{
return null;
}
return EventKey( name, type.BaseType );
}
public static void Main()
{
FieldInfo field = EventKey("Click", typeof(MenuItem));
if (field != null)
{
Console.WriteLine("Got it");
}
else
{
Console.WriteLine("Nothing");
}
Console.ReadLine();
}
|
|
|
|
|
well did some diggin' in the MenuItem class with reflector, and i think here's the thing:
MenuItem has a friend class called MenuItemData. MenuItem also has a private variable of type MenuItemData, called data. MenuItemData has a private EventHandler called onClick, and i think thats the one you're after.
Here's a function i put together (it's in VB.Net though):
Private Shared Function GetMenuItemClickEvent(ByVal item As MenuItem) As EventHandler
If (item Is Nothing) Then Return Nothing
Dim allflags As BindingFlags = BindingFlags.Instance Or _
BindingFlags.Public Or BindingFlags.NonPublic Or _
BindingFlags.Static Or BindingFlags.FlattenHierarchy
'Get the MenuItemData from the MenuItem
Dim data As Object = item.GetType.GetField("data", _
allflags).GetValue(item)
'Get the onClick EventHandler from data
Dim clickevent As Object = data.GetType.GetField("onClick", _
allflags).GetValue(data)
If (clickevent Is Nothing) Then
'No method is linked to onClick, so onClick is null
Return Nothing
Else
Return DirectCast(clickevent, EventHandler)
End If
End Function
Cheers!
|
|
|
|
|
Thank you very much!
It realy work fine! I don't know about MenuItemData object before!
|
|
|
|
|
You're welcome!
I never knew of the MenuItemData thingy too, just shows how handy some peeking in the .Net Framework is!
|
|
|
|
|
Just one more note!
After getting event handler of MenuItem click event, to use Delegate.Combine for adding new user defined handler to process this event, must do like this:
object data = menu.GetType().GetField("data",flags).GetValue(menu);
FieldInfo eventField = data.GetType().GetField("on" + eventInfo.Name,flags);
MulticastDelegate handler = (MulticastDelegate) eventField.GetValue(data);
if (handler != null)
{
handler = (MulticastDelegate) Delegate.Combine(handler,recorder);
eventField.SetValue(data,handler);
}
My program now works fine!
|
|
|
|
|
I use System.Windows.Forms.DataGrid to display an ArrayList of objects. DataGrid allows nested navigation to other object's properties if they are of type ArrayList.
My problem is, that I cannot determinate, which object is being displayed after navigating to deeper objects. The DataSource of the grid is still "root" ArrayList of objects, I cannot determinate which ArrayList property of the "root" object is being displayed after clicking on navigation.
|
|
|
|
|
We have some code ( c#, asp.net codebehind ) that we use to translate small amounts of text between languages. It's pretty simple. We post the text to translate to google and then parse the return HTML stream to get the translated text. All was well until we needed to add chinese to the list of translated languages. I assumed the return from google would have the translated chinese in unicode. So we parsed out the unicode that represents the returned chinese and used the code:
// note: UniResponse contains the byte entries for the returned chinese only
UnicodeEncoding Unicode = new UnicodeEncoding();
int charCount = Unicode.GetCharCount(UniResponse, 0, UniResponse.Length);
char[] chars = new Char[charCount];
Unicode.GetChars(UniResponse, 0, UniResponse.Length, chars, 0);
string s=new string(chars);
This should get the byte stream back to a string type I could add to the dynamically created HTML for the new page. But when our page is displayed, it does show some chinese chars/words/whatever, but they do not match what google shows. We verified we do indeed parse out the correct bytes from the returned HTML. All the samples I could find on CG only translate with the english char set, they all seem to stop short of non-english char sets. When using unicode, I don't have to worry about codepages or anything do I?
If anyone knows of an example or has some words of wisdom concerning the translation process. Please let me know.
TIA
|
|
|
|
|
I have a custom combo box that is data bound to the SelectedValue property.
Everything works fine, but I have a ReadOnly property in the control, which makes the CB invisible, and a read-only text box shows up in it's place.
When it's in this mode, the SelectedValue property stops being updated from the data binding.
This has bugged me for a few days, and any help would be greatly appreciated
Brian
|
|
|
|
|
On tinkering around with it, it seems only to not work when you make the control invisible before you do your first data adaptor Fill method.
If you do the fill, then make it invisible, everything works fine from there on out. You can make it visible, invisible again, etc.
Odd.
|
|
|
|
|
Hi all,
I am facing a problem where I am not able to get the path of directory in Linux. I want to install a software using Oracle as database in Win2000. The database is on a Linux system. In this system I have created a shared folder "shared". Then I give this path during installation. The setup runs successfully but the .ora files which are created are not in the folder specified (shared) but in another folder with names C:shared|name of the file.ora. The setup.inf file on the system where the setup was run shows the path as "C:\shared". There is no such drive in Linux.
Can anyone tell me what is the actual problem and how to fix it.
Regards,
Harshad
|
|
|
|
|
I would like to get suggestions on how to implement mouse events (MouseMove, MouseEnter, MouseLeave etc.) in a user defined class not derived from System.Windows.Forms.Control or System.Windows.Forms.UserControl. The reason for not deriving from aforementioned classes is to keep it lightweight. The extensive functionality as provided by Control or UserControl classes is not required.
The classes I have are graphical elements, such as polylines, ellipses, rectangles etc. One class derived from either System.Windows.Forms.Panel or UserControl or Form, let's call it View class, is showing/drawing them onto the screen. The way I figured is to use mouse events from this View class and make a HitTest for each element it contains and then called respective method(s) of the element. But it is rather inconvenient to generate a Events in this design as one has to expose another public method(s), which triggers the event(s), that I can call from the mouse handling methods of the View class.
What I would like to achieve is to have a base class, which would generate mouse events in the same way as System.Windows.Form.Control.
Looking forward to your suggestions!
|
|
|
|
|
Hi all,
I have just created a setup. on ruuning it there is an error "mfc70.dll failed to register. HRESULT -2147024769. Contact your support personnel." The older versions of the setup work fine. All the files are same except the ones where setup version is displayed. Can someone tell what is the problem exactly & how to overcome it.
Thanking You.
Regards,
Harshad
|
|
|
|
|
mfc70.dll is not a self-registering dll.
|
|
|
|
|
Question : If i have a dll(with some corba stuff) that was developed using VC6, can this dll be used on windows os/servers with .net framework?
<font=arial>Weiye Chen
Life is hard, yet we are made of flesh...
|
|
|
|
|
Surely it can be used the same way that Windows dlls are used, through pinvoke ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote:
through pinvoke ?
Well, i am not sure how they are going to be used. I was told to convert some dll projects to .net and i assume that i can just open the project in vs.net and recompile it? But that doesn't make sense to me.
<font=arial>Weiye Chen
Life is hard, yet we are made of flesh...
|
|
|
|
|
Ah, i just know what they want. They just want the project to be able to compile in vs.net because they do no have any more license for VC6.
<font=arial>Weiye Chen
Life is hard, yet we are made of flesh...
|
|
|
|
|
LOL. Well, that could be easy, or it could be hard, depending on how good the code is to start with.
Christian Graus - Microsoft MVP - C++
|
|
|
|