|
I'm doing final testing on a library project and have an issue with OnSystemColorsChanged, which I have overridden as follows:
<br />
protected override void OnSystemColorsChanged( EventArgs e )<br />
{<br />
base.OnSystemColorsChanged( e );<br />
<br />
if ( MyCondition )<br />
{<br />
DoWhatIHaveToDoHere( );<br />
}<br />
}
My visual control will sometimes paint itself in derivatives of SystemColors.Control, and so I need this override to respond to changes by re-processing whatever color is assigned to it.
To test, I've gone into system settings and changed the base color for 3D objects. Colors in many simultaneously opened applications change, but not my control.
My problem is that my override is never entered. Is there some further way that we are supposed to register our component with the form or something to get OnSystemColorsChanged to fire? Or is what I am doing to test entry not sufficient to fire the method?
(I assume that Trace will enter the method, and that the fact Trace does not enter the method indicates it is not being fired -- besides of course the fact no processing occurs. )
TIA,
m
|
|
|
|
|
I don't know about the rest of you, but I encounter so many dysfunctionalities in visiting Microsoft sites that there hardly seems any point in trying. I have to log in to post (but I already logged in). I try to log in again, I'm told I have to enable cookies (but cookies are enabled). I try to post or send feedback, and I'm told I need to log in. I try to log in, but I'm told I'm already logged in.
This stuff is absolutely ridiculous.
In any case, I called and got a special link that was supposed to allow me to post a report without logging in... but it required me to log in as well, and we went around in circles for naught again...
BUT...
Though all previous searches turned up nothing, I tried my OnSystemColorsChanged search from that page... and I turn up an issue:
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=95463
So, although this is not the whole issue, it reports that at one time, though system colors may be reconfigured, the new colors were not assigned to the values representing system colors. MS claims to have been able to reproduce the problem, and to have fixed it.
I believe their test situation was not broad enough to verify *also* that OnSystemColorsChanged is entered, because my testing shows no entry into this event handler whatsoever. Same problem with OnEnabledChanged, which I was able to work around by writing a new Enabled property.
OnSystemColorsChanged however provides no such opportunity, because of course we are not assigning to a property to fire the event -- it is a system event, the whole responsibility for which is Microsoft's.
Unless I misunderstand that my testing (manually resetting system colors) is somehow (?) insufficient to fire the event (it changes system colors in many other applications), I believe this establishes a compiler issue/bug.
If anyone knows any better, I surely would like to hear about it, because this is a very costly issue for us.
TIA,
m
|
|
|
|
|
My web site works fine inside the Visual Studio 2005 but when I publish it ( in my own computer ) it gives me this error message:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Server Error in '/SI' Application.
________________________________________
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0433: The type 'ProductDetails' exists in both 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\si\9ce027e5\3d5cd3c7\assembly\dl3\9f893f96\30af096e_7654c701\App_Code.DLL' and 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\si\9ce027e5\3d5cd3c7\assembly\dl3\a3f57edc\d0156479_7654c701\App_Web_ypd3vqxs.DLL'
Source Error:
Line 122:
Line 123: [System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()]
Line 124: public class productdetails_aspx : global::ProductDetails, System.Web.SessionState.IRequiresSessionState, System.Web.IHttpHandler {
Line 125:
Line 126: private static bool @__initialized;
Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\si\9ce027e5\3d5cd3c7\App_Web_productdetails.aspx.cdcab7d2.unizty2q.0.cs Line: 124
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I don’t understand why 'ProductDetails' type exists in two different DLLs in my published site and why, as consequence, affects this application.
|
|
|
|
|
I don't think it's possible to tell from here, but it looks like you probably have references to two different versions of source which have different identifiers. Perhaps at one stage of your project you linked to a given version, then later to another. I would suggest removing the references, then carefully rebuilding them with only the finished files of the project.
|
|
|
|
|
I know I can create a multi dimension array using:
string[,] PageArray = { { "TextBox2", "Wilson" } };
But how do I add to the array ? For example, say I want to add "textBox3" & "Bob" as an element.
Thanks
|
|
|
|
|
string[,] PageArray = { { "TextBox2", "Wilson" },
{ "TextBox3", "Bob" } };
|
|
|
|
|
Once the array exists, you can't add to it. You need to use a List or something, instead. You can make a list of lists, to get a 2D effect. Or, you can create a struct to contain the two values you want in each element.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: Once the array exists, you can't add to it. You need to use a List or something, instead. You can make a list of lists, to get a 2D effect. Or, you can create a struct to contain the two values you want in each element.
This is a good point. I wasn't sure if he meant add in the sense of adding to an array after it has been created or add in the sense that he wasn't sure how to initialize it with the additional values.
Another possibility other than the ones you suggest is to use a Dictionary if his collection can be characterized as key/value pairs.
|
|
|
|
|
Good point, the Dictionary is a container that's hard to beat
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Are you sure he was not asking how to initialize the size of the array and then fill it in with information? Because that would just require setting the size for each dimention [5,5] for a 5x5. Then to add to the filled out dimensions you would just use array[0,0]= or array[0,1]=. If you use a multidimensional array I have found it really helps to map it out on paper first. Of course you could always just use a dictionary.
_____________________________________________________________________
Our developers never release
code. Rather, it tends to escape, pillaging the countryside all around.
The Enlightenment Project (paraphrased comment)
Visit Me at GISDevCafe
|
|
|
|
|
Hello!
I work in am TFS in my job ... and I receive a computer from another coworker and I need to login to TFS with my account...but VC# are login with his account.
Have anyone a suggestion about how can I change this.
thnx
|
|
|
|
|
My experience is, that TFS tries to log in using the username and password the computer was logged in with, if this fails, it pops up a login screen.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I am new to the whole c# world but I noticed something kind of strange to me. If I have an interface that has a property and I use both get and set in my implementing class, it doesn't break as long as I declare either get or set or both. If I use both, shouldn't the interface require me to declare both?
interface IReadThings
{
int Status { get; set;}
}
public class TheDoc : IReadThings
{
public int Status
{
get { return theStatus; }
set { theStatus = value; }
}
}
|
|
|
|
|
santhony7 wrote: If I use both, shouldn't the interface require me to declare both?
Nope. Say you have a readonly (get) property declared in an interface. In your implementing class, you have to implement the property with a getter. However, the setter is optional. If you implement a setter as well, it's not covered by the interface but is rather specific to the implementing class. For example:
using System;
using System.Collections.Generic;
using System.Text;
namespace InterfaceTest
{
class Program
{
static void Main(string[] args)
{
IReadThings things = new TheDoc();
int s = things.Status;
things.Status = 42;
}
}
interface IReadThings
{
int Status
{
get;
}
}
public class TheDoc : IReadThings
{
int theStatus = 0;
public int Status
{
get { return theStatus; }
set { theStatus = value; }
}
}
}
The above doesn't compile because "things" is a reference to the IReadThings interface. Thus it represents only the functionality declared by the IReadThings interface. Since IReadThings doesn't have a setter for the Status property, we get a compile error. Had we made "things" of type TheDoc , it would compile just fine.
The interface represents a blueprint that an implementing class must implement. However, the implementing class is free to provide additional functionality that goes beyond the interface's contract. This includes properties providing a getter or setter if one isn't specified by the interface.
|
|
|
|
|
Thanks man, that really helps. I understood about 69% of what you said but I am learning quick...
|
|
|
|
|
The only thing I might add to make this answer a bit more plain to understand is that Interfaces are often referred to as "contracts." That is, they represent an obligation of the implementing class to support whatever is declared in the interface. However, by no means are interfaces to restrict the implementing class to only what is promised in the interface.
|
|
|
|
|
How can I control the order that my properties appear in the DataBindings BindingSource selection dialog? Sorted alphabetic would be nice.
I have a business object that inherits from a bindingsource. Its properties appear to be in an apparent random order in the binding source selection dialog. For example when I'm selecting a property to bind to a text box text property.
|
|
|
|
|
I'm thinking you might be able to do something like that by inheriting from ExpandableObjectConverter. I'm not sure, but it'll give you something to try out.
public class MyClass : ExpandableObjectConverter
{
public override bool GetPropertiesSupported(ITypeDescriptorContext context)
{
return true;
}
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
{
PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(value, attributes);
return properties.Sort(new string[] {"Name", "Value"});
}
}
|
|
|
|
|
That was just the lead that I needed. I'm inheriting from a bindingsource and it implements ITypedList which has the GetItemProperties function. I overrode that function and simply added .Sort to base.GetItemProperties(listAccessors)
Thanks
|
|
|
|
|
Excellent. That's much more elegant. I believe my suggestion was a carry-over from 1.0 days. I know I did something like that (probably for a property grid) a long time ago.
|
|
|
|
|
I want to write codes of an adjusted affine transformation which works interactly. And my question is,
The user, browses and opens a picture file. I would like to get the pixel coordinates (x,y) of a point which is clicked by mouse. So, an event should be done. i am planning to write this in C# but if u have any ideas in other programming languages, please, don't hesitate to write. : )
Thank you.
|
|
|
|
|
I'm guessing you're putting the picture in the picture box, so you can add a PictureBox1.MouseClick event and in the event you can get the coordinated like this: e.X (for the X coordinate) and e.Y , or alternately: e.Location.X ,e.Location.Y
|
|
|
|
|
You can use javascript.
on_click event, use following code
tempX = event.clientX + document.body.scrollLeft;
tempY = event.clientY + document.body.scrollTop;
Nana
|
|
|
|
|
Thank you for your responds. pictureBox tool has an event like this but i couldn't see.
|
|
|
|
|
I have a textbox and two radio buttons. If the value in the textbox is negative, radiobtn2 should be selected otherwise if it is positive radiobtn1 should be selected.
First, the code:
this.textbox1.Leave += new System.EventHandler(this.textbox1_Leave);
private void textbox1_Leave(object sender, System.EventArgs e)
{
string firstchar = textbox1.Text.Trim().Substring(0, 1);
//MessageBox.Show("function called");
if(firstchar == "-")
radiobtn2.Select();
else
radiobtn1.Select();
}
The strange behavior is:
1) that his works if I Tab out of the textbox but not if I click out of the textbox.
2) I put a simple messagebox.show in the textbox1_Leave function to see if it was being called, and the messagebox appears when I click out of the textbox and the code then works with a radiobtn being selected! This tells me the function is being called, but when I remove messagebox.show the function again no longer works!
I also tried changing the EventHandler from Leave to LostFocus and the same behavior exists.
Any ideas why this is or what I can do to work around it without having the user's progress be interrupted?
Thanks,
RABB17
"Nothing fancy needed, please just solve all our problems as quickly as possible."
|
|
|
|