|
If you want to use your UserControl1 as a UserControl, then you must inherits it from Class UserControl. You cannot create a new usercontrol inherits from a Form.
|
|
|
|
|
The reasoN why i want to create a usercontrol that is derived from a form because i want to create customable panel, that can be minimize or maximize. i've made a usercontrol which is derived from Panel but the problem is when the backcolor of the control is transparent and that control is placed inside my usercontrolpanel, the transparency goes through all the way to the form, that is why i thought i should derived my usercontrol from a form. Please refer to the image linke below for sample output of my usercontrol:
http://www.geocities.com/fritzjeran/SAMPLEOUTPUT.JPG
Any suggestion is appreciated.
Thanks.
|
|
|
|
|
fjlv2005 wrote: customable panel, that can be minimize or maximize
That's easy, you just set the dock style of the control to all, to maximise on the form. Set it to none and the size to 0,0 to minimise.
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 )
|
|
|
|
|
how to select a particular erroritem in the errolist and also it description
|
|
|
|
|
kalyanit wrote: how to select a particular erroritem in the errolist and also it description
Sorry, there is some context missing. What are you talking about? Where is this error list?
|
|
|
|
|
Hi All,
I have 2 exe's.What I have to do is to call one exe from the second one with some arguments.How to do it??
NEHA GUPTA
|
|
|
|
|
|
Take a look at the Process.Start method.
"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
|
|
|
|
|
Hello,
In the namespace System.Diagnostics you will find Process and ProcessStartInfo.
ProcessStartInfo psi= new ProcessStartInfo();
psi.UseShellExecute = false;
psi.FileName = ???;
psi.WorkingDirectory = ???;
psi.Arguments = @"xxx";
using(Process YourProcess= Process.Start(psi))
{
YourProcess.???;
}
All the best,
Martin
|
|
|
|
|
I need to load large string into RichTextBox.This string is RTF formatted text.If I try passing that string to RichTextBox like:
RichTextBox.Rtf=that string
RichTextBox freeze for several secounds.
I search over internet for solution,and i found article that describe how to load file that is a few megs in size using EM_STREAMIN message.
Unfortunatelly,that article is for VB6 and use file for loading while I have to use RTF formatted string.
Does anybody knows how to implement loading string into RTB using EM_STREAMIN message in C#?
|
|
|
|
|
use threads to solve ut problem
|
|
|
|
|
use threads to solve your problem
|
|
|
|
|
Sorry to say but did you think about this reply before posting?
The original poster claims that the RichTextBox itself is freezing.
If you can tell us how to use threads to keep this from happening (don't forget the UIThread has to render the RichTextBox!), you're my hero...
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Sure, create a new RichTextBox, load it in the background thread, then substitute it
for your existing RTB.
|
|
|
|
|
Yes,that could help,but in that case user must wait until whole string is loaded into new RichTextBox before it is substituted with existing RichTextBox.
Is it possible to load RTF file or string in segments into RichTextBox.
Something similar to MS Word or WordPad
where text is appended in RichTextBox in segments while app remain responsible to user.
I asking that because RichTextBox doesn't have "append" method.
|
|
|
|
|
Hi!
Unfortunately, I don't see an easy solution for you. But if you somehow can split the RTF into smaller parts, you could load them one after the other by using the SelectedRtf property and at least throw in a few Application.DoEvents() so that the RTB updates after each loaded part.
The idea behind this is something like this:
rtb.Clear();
for (int i=0; i<parts.Length; i++)
{
rtb.SelectedRtf = parts[i];
rtb.Select(rtb.Text.Length, 0);
Application.DoEvents();
}
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
the boy is right .. no offence .. but check your premise
|
|
|
|
|
Ok, then please show us a working example. If you don't use a workaround like the one suggested by Luc (which isn't what the poster was asking for and, honestly, I'd rather call cheating :P), I really can't see how this should work.
Sure, "use threads" is the default answer when someone ask for making something more responsive, but in this case it's a Control that can become unresponsive for a longer period of time due to calling one of its methods (or setting one of its properties).
With very few exceptions (and calling LoadFile() or setting Rtf don't belong to them) you cannot safely access a control from another thread than the one it was created on.
So if you create the RTB in another thread (apart from the UIThread), then you'll have to marshal each and every call to this other thread.
But even so: You're calling LoadFile() from the other thread and the RTB is blocking the other thread while the large file is being loaded. During this period of time the RTB doesn't update and thus appears unresponsive.
Out of curiosity I actually tried the "create the RTB in another thread" approach and, apart from proving my point, I also found that even the UIThread seems to be blocked while the RTB is loading a large file in a background thread...
If you're interested, I can post the code here.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
give me your Email ID i'll mail you solution
|
|
|
|
|
Please use the Email link from one of my postings to send me a PM with your mail adress. I couldn't send you one because CP claims that your mail adress isn't verified.
Thanks in advance, I'd be very interested in a working solution for loading a large RTF string/file into a RTB without blocking it in the process...
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Boy O Boy... this is not valid excuses.....
i saw your profile might be you are summa cum laude but this time you are not using your wit.
here is no facility provided by CP to send any attachment and writing an artical is a real pain in ass. you can take my ID
think2sameer@yahoo.com
wright70@mailcity.com
i am available on both
|
|
|
|
|
Nobody asked you to send an attachment via CP.
I asked you to send me a personal message with your mail adress so I don't have to write my mail adress here and attact even more spam than I already receive and allow you to do the same.
I'm really sorry if you didn't understand...
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Hi
I have created a datagridview class that handles keypresses according to our company standerd by inheriting from datagridview.
I now want to open a dialog when the user presses enter. The opendialog function defined in the control is called a desighned. What I am unable to do is overide it from the from that is using the inherited control.
Please can someone give pointers to this regard.
|
|
|
|
|
Think I have solved it.
I have added a member to the control. The variable is of the dialog base class (in this case basedialog that is derived from form.) All my dialogs are derived from this basedialog class.
I create the dialog that is required, set the property and when the enter key is pressed, display the dialog from within the control code. Is this the correct way to do this.
Is there a better way?
|
|
|
|
|
I think, the better way is add event "ShowDialog_XY", which will be raised on [enter] key press and process event in method handled to this event.
The event arguments should contain result of dialog.
For example:
public class MyGrid : DataGridView{
protected virtual void ProcessEnterKeyPress() {
MyGridProcessEventArgs me = new MyGridProcessEventArgs();
this.OnProcessEnterKeyPress( me );
if ( me.Handled == false ) {
}
object result = me.Result;
if ( result == null ) {
}
this.ProcessResultOfEnterKeyPress( result );
}
protected virtual void ProcessResultOfEnterKeyPress( object result ) {
}
protected virtual void OnProcessEnterKeyPress( MyGridProcessEventArgs e ) {
EventHandler handler = this.ProcessEnterKeyPress;
if ( handler != null ) { handler( this, e ); }
}
public event EventHandler<MyGridProcessEventArgs> ProcessEnterKeyPress;
}
public class MyGridProcessEventArgs : EventArgs {
private bool handled;
private object result;
public bool Handled {
get { return this.handled; }
set { this.handled = value; }
}
public bool Result { get { ... } set { ... } }
}
public class Form1 : Form {
...
public Form1() {
this.InitializeComponents();
this.myGrid1.ProcessEnterKeyPress += this.myGrid1_ProcessEnterKeyPress;
}
private void myGrid1_ProcessEnterKeyPress( MyGridProcessEventArgs e ) {
}
}
Geniality is in simplicity.
|
|
|
|