|
Hi,
I am making windows app using C#.
In this app if i drag a form to any location and click a button on that form that displays a message box,message box always appears center screen and not on center of form that has been dragged.It looks very odd.
How can I make message box to always appear on center of form irrespective of position of form.
Regards,
Amit
Amit
|
|
|
|
|
The first parameter passed to MessageBox.Show can be any implementor of IWin32Window , which includes a Form , a Control etc. If you pass a reference to your form to this, the MessageBox will show up on top of that form/control
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
I tried but its not working do you have code for same
|
|
|
|
|
I tried MessageBox.Show(this, "Hello"); but still the message is centre of screen, not centre of form as wanted.
Regards
bigJim
|
|
|
|
|
Its looks like you cannot change this behavior of MessageBox. One solution is to derive your own MessageForm class from Form to display your message. Then call its ShowDialog method to show it after you set its Size, Location and StartPosition properties. (If you don't set the StartPosition , then the Location is ignored.) One of the values for StartPosition is CenterParent which would center your new MessageForm.
|
|
|
|
|
How do I set the colour of a cell depending on the value of an adjacent cell? How can I access the data of an adjacent cell? I can set the different colours successfully using overwriting the Paint method of my own Datagrid column.
Regards
bigJim
|
|
|
|
|
Hi,
If u want each column value of selected row then loop it with ColumnNumber
TextBox2.Text = DataGrid1.Item(DataGrid1.CurrentCell.RowNumber,
DataGrid1.CurrentCell.ColumnNumber)
|
|
|
|
|
You can access the previous column cell value pretty easily,
string previousCellValue = DataGrid1[DataGrid1.CurrentCell.RowNumber, DataGrid1.CurrentCell.ColumnNumber -1].toString();
Now based on the previousCellValue, repaint the row by calling your overrided grid paint method. Hope this work for you
Regards,
Kais
|
|
|
|
|
hi
i am trying to create a deployment project for .net + crystal report windows application and using bundled version of Crystal Report in Visual Studio .NET 2003.
when i try to build the deployment project i receive a build error which says keycode is non-nullable.
I am adding 4 merge modules crystal-database-access2003.msm,crystal_database-access2003_enu.msm, crystal_regwiz2003.msm,crystal_managed2003.msm.
i add the licence key to the crystal_regwiz2003.msm file even then i get the error property 'keycode' is non-nullable.
what could be the possible reason for this error.
please help.
This is my sign
-- modified at 5:38 Thursday 29th June, 2006
|
|
|
|
|
ersinsivaz wrote: help please !
Everyone on this forums is looking for help - Try using a more descriptive subject such as "Problem deploying app with Crystal"
|
|
|
|
|
More than likely.
You have eval assemblies on your pc. delete all assemblies then re-install crystal reports and it should be fine. Make sure to delete of all of them. thier in 3 different places I believe.
Nick
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
I have a Button (btnGet) on a UserControl which I am setting Image property of to a GIF.
The problem :
It does show in design time but doesnt on runtime.
(The UserControl has few other buttons which has their image property set to other images and working fine. However if I change their images to other, it doesnt work.)
Investigation :
I checked the .resx file and it contains the image data in the "btnGet.Image" element.
Put breakpoint in the InitializeComponents() where it assigns the image to button.
this.btnGet.Image = ((System.Drawing.Image)(resources.GetObject("btnGet.Image")));
resources.GetObject("btnGet.Image") returns null.
I tried this after deleting all the intermediate files like .pdb, .obj
When I set the image to a Button in other form in the same project (as well as in other). Works perfect!
Solution :
What could it be?
Every bit counts
|
|
|
|
|
Have you tried GetManifestResourceNames() to see if the image is present? that is asuming resources is an Assembly .
|
|
|
|
|
This should works...
this.btnGet.Image =global::yournamesapce.Properties.Resources.btn_image;
Note: you must add this image(btn_image) into Resource b4 running this code.
-
|
|
|
|
|
Hi
I've created a control which I want to look identical to a textbox. The only problem is I cant work out how to calculate the border colour for a normal textbox so I can set it onto my control.
I know I could probably do this by hardcoding RGB values but I dont think this is the best way incase it ever changes.
Any help would be very much appreciated.
Stu Richardson
|
|
|
|
|
hi
try out this class System.Windows.Forms.ControlPaint
|
|
|
|
|
Thankyou but unfortunately I did have a bash at that and could not resolve it. That class seems to work well with everything bar text boxes!
Thankyou for the idea though.
Stu Richardson
-- modified at 5:41 Thursday 29th June, 2006
|
|
|
|
|
Hello
I've got a problem ... as you can imagine ...
I have a WinForm with MaximumSize defined, and MaximizeBox enabled ...
My problem is that when user click on Maximize box, the winform got upper-left corner of the screen, and take the maximize size as defined, it's very weird ...
Is it possible to force the form centered when MaximizeBox is clicked ?
How to override this event ( MaximizeBox clicked ) ?
Thanks in advance for your help.
Sebastien.
|
|
|
|
|
Hello
There is no Maximized event to override. Instead try overriding SizeChanged event.
Something like this:
SizeChangedHandler(params...)
{
if(WindowState == Maximized)
{
if(Height > Screen.PrimaryScreen.WorkingArea.Height)
{
Top = 0
}
else
{
Top = Screen.PrimaryScreen.WorkingArea.Height / 2 - Height / 2; //To center the Form vertically
}
if(Width > Screen.PrimaryScreen.WorkingArea.Width)
{
Left = 0;
}
else
{
Left = Screen.PrimaryScreen.WorkingArea.Width / 2 - Width / 2; //To center the Form horizontally
}
}
}
|
|
|
|
|
As you said ur winform in MaximumSize then so u want ur winform in always maximized state right.. use Form's MaximizeBox property to disable Maximize button.
this.MaximizeBox = false;
Hope this helps u..
|
|
|
|
|
Hi!
I'm building a big xml string with a for loop and it takes veeeeeeeeeeeeeery much to complete this process. Later on I load it in an XmlDocument and save it in a file. This last thing takes no time.
The loop is something like:
<br />
string xml = "<Top>";<br />
for (int i=0; i < <ArrayList>.Count; i++){<br />
<br />
xml += "<Something>";<br />
xml += bla bla;<br />
xml += "</Something>";<br />
xml += <Object>.ToXml();
...<br />
...<br />
<br />
}<br />
xml += "</Top>";<br />
I know than the process may not be linear in time, but is there any known way to speed up this proccess? When the thing gets big (2MB xml file) it's really annoying to wait tons of minutes for this to save.
Thanx for any help!
|
|
|
|
|
For this you should use the StringBuilder Class.
Here I made a Method wich gives back a string.
public string CreateText(string[] textarray)
{
if(textarray != null)
{
StringBuilder lsb_Format = new StringBuilder();
for(int x=0; x < textarray.Length; x++)
{
lsb_Format.Append(textarray[x]);
}
return lsb_Format.ToString();
}
return "";
}
All the best,
Martin
|
|
|
|
|
|
hi,
Y dont u directly write it into file?
By adding string it consumes much more memory, try using StringBuilder.
Its available in System.Text namespace.
Thanks
Sushant Duggal.
|
|
|
|
|
Hai all,
I have a problem datagrid in Winforms about getting the selected row containing cells value,I know this is very simple in web application but i am new for win application can you please give the idea.
ranandbe
|
|
|
|