|
Hello,
motojojo wrote: I'm just stupid I guess..
Give yourselfe a little more time.
motojojo wrote: I didn't initialize that object in the constructor
Ok, good so far!
motojojo wrote: Now that I did, indeed it takes 'this' as a reference, however all of my other methods are souped up since now toolbox doesn't exist enymore as a class parameter.
The "trick" is that you declare the variable outside the constructor and initialze inside.
private SomeClass mySomeClass;
public MainClass()
{
InitializeComponets();
mySomeClass = new SomeClass(this);
}
Hope it helps!
All the best,
Martin
|
|
|
|
|
Martin# wrote: private SomeClass mySomeClass;public MainClass(){ InitializeComponets(); mySomeClass = new SomeClass(this);}
I've added another constructor to my Toolbox which takes no parameter so now I have
Toolbox(Mainform mainform){ ... }
and
Toolbox(){}
however, this results in an infinite loop...
|
|
|
|
|
I've said too much. Appearantly it does work (I made an error)
thank you guys
|
|
|
|
|
Hello,
Glad it works now!
But why do you need this second constructor?
All the best,
Martin
|
|
|
|
|
I think, you need to show us some more code, cause otherwise otherwise there is too much guessing in helping you. What are you doing inside the constructors? Where exactly are creating the mainform and toolbox instances?
Finally, nevertheless a guess. Probably you're creating a new instance of the main form inside the tool box constructor. That is not necessary. Simply assign the instance passed in to the declared field.
class ToolBox
{
private MainForm mainForm;
public ToolBox(MainForm mainForm)
{
this.mainForm = mainForm;
..
}
}
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Perhaps you need to do better at asking questions. If you're inside your mainform, and not inside a static function, this will work. There Application object also has a collection of open forms, which you can also iterate through and look for your mainform. But, when someone tells you how to do something,
motojojo wrote: This does NOT work
is useless. Tell us WHY it won't work, what the error is, and then we can perhaps tell you what's going on, without having to guess. Odds are high it's in a static function, and if you bothered to read the error message, you'd understand why it's not working.
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 )
|
|
|
|
|
hi,
I am creating a editor in RichtextBox.
can anyone say me how to add color to a Background of cursor.
as soon as scroll the cursor the selected line color should change.
like E,g:Ultra Edit-32
pls help me
Thanku
prasad
-- modified at 4:58 Thursday 22nd February, 2007
|
|
|
|
|
You are asking about the cursor, but your concern is about scrolling behavior.
To add a background color to a cursor, you build the cursor. To use the cursor, it has to be installed on the target system and you have to set the cursor in some event and reset to the default cursor in some other event. Needless to say, because of the installation issue, your intended usage of the cursor is impractical.
As for the scrolling behavior, that's a design issue you handle through your control. Usually, you would select or focus the line so that it will be re-drawn in a focused state.
|
|
|
|
|
hi,
Thank you for u r reply.
If I scroll the cursor through using keyboard Up/Down key as the cursor moves Up/Down the current line of the cursor background should channge.
Thank You
Prasad
|
|
|
|
|
Then you are not meaning the (usual) screen cursor, you are meaning the cursor which indicates focus of the current line. See the documentation for the control to find how to select/focus the current line.
|
|
|
|
|
hi,
May i know how to focus it.
Help me
Thank U
With Regards
Prasad ;);P
|
|
|
|
|
I don't even know what control you are using, so I can't help you more than I have. But you need to help yourself at this point, because this is a usual chore of programming. Look up your control in documentation, find its "members," and browse them. You should find a property or a method which will focus your line. If not, what you want to do is not supported.
(Surely it is.)
|
|
|
|
|
Hi guys ! I'm writing a win app that has two languages and i want to switch between languages. normally i press Alt + Shift to change the language, is there any way that i can do this automatically for example in an OnEnter event of a Text box !!! i tried somethin like sendkeys but didn't work for me !
Thanx
Mr.K
|
|
|
|
|
If you have a method that already does what you want (as you write), then simply call the method from your OnEnter handler.
|
|
|
|
|
Does anybody have a pattern handy for mapping design time help requests to name anchors in *real* online XHTML help? In other words, I assume I'd want to use an existing or custom attribute on properties, and somehow detect when help was requested for each property, then invoking a url to online help such as ourdomain/help/helpfile.html#PropertyName.
|
|
|
|
|
pls help to add exe in system try using C# ( It will also support for Vista)
s
|
|
|
|
|
|
hi,
i have created a editor in richtextBox
can any one help me in creating a copy,and paste method.
Thank You
Prasad
|
|
|
|
|
I thought the control gave you those for free ?
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 )
|
|
|
|
|
hi all,
in my project i need to convert raw image to bmp or jpeg and i have some images with the extention .gry i dont know this is raw or any other special format but i am thinking this is a raw format so my problem is convert .gry image to bmp or jpeg in c#
so plz any one knows the way how to do it is plz tell me
thanks in advance
Regards,
santhosh
|
|
|
|
|
If you've got raw pixel data, you have a bmp, it just needs a header, assuming that it's word aligned, or that it has the right padding in it.
Where is the data coming from ?
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 )
|
|
|
|
|
hi Christian Graus,
we have live scanner that will be creating these images into one folder so now my responsibility is reading that .gry images and displaying in the form in c# .
Regards,
santhosh
|
|
|
|
|
You can create a bitmap object from a stream, you could try and see if the class can make sense of the data. If not, you could read my image processing articles, build a bitmap of the right size, and pass the data across one scanline at a time.
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 )
|
|
|
|
|
Isn't a raw image different then a bmp?
If not why would Xp have a powertoy Raw Image Support[^]
V.
I found a living worth working for, but haven't found work worth living for.
|
|
|
|
|
Yes, it is, but a bitmap IS 'raw' pixel data, with a bitmap header.
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 )
|
|
|
|