|
hi am working on the datagrid and am getting a whole lot pf probles.
First I have inherited the grid and overidden its preprocessmessage function to ignore the tab key.
Second I am created two columnstyles one form combo box and the other textbox . now the problem is when i am on the first row and I add any text in the textbox or combobox them two new rows are shown (but Dataview shows only one). Also if i navigate through the grid using tabkey then its add new row but if its is on the last row then the row is show as a old row (and not a new row) as the grid fails to update.
|
|
|
|
|
I have mdi form.
Now i open one child form say (form1).
on that 3 text box and 1 button.
in first text box _ key press, i have written code to send TAB key on enter.
so on enter it set focus to next text box.
IT's working fin till.
Now i open another simple form (say from2) on button click.
and set it's mdiparent property like this to make it mdi child.
Code for button click
{
Form2 f=new Form2();
f.MdiParent = this.MdiParent;
f.Show()
}
This also work fine and open Form2 as child of mdi.
Now the problem is i close form2 and now form1 activated.
Now when i press enter key on TextBox1 it doesn't work.
(it should leave focus on enter).
any solution for this?
Now if i minimize form1 and again restore it then enter key on
TextBox1 works fine!
Thanks.
-- modified at 5:20 Saturday 17th September, 2005
|
|
|
|
|
Hi Every body,
I am trying to draw a pie with a bevel effect. I am not a very experienced programmer in GDI+. But with my minimum knowledge and with some help of google, I tried the same using pathgradient brush, lineargradiant bush etc. But i could get to look exactly how i want it.
Please go to this link to see exactly how i want it to look like.
http://www.chartfx.com/sfxgallery/chartdetail.aspx?charttype=4¤tchart=3
as I told you before I am not an expert in this thing. A code sample on how to achive this would really help.
Thanks a lot,
Apratim
|
|
|
|
|
Hi!
Although I don't know exactly which pie chart you're referring to (your link doesn't work), I think you mean the one where there's a darker rim around the border of the disc, correct?
YOu could achieve this effect by filling the whole circle with a PathGradientBrush after drawing the slices.
The center color of the gradient is transparent, the border color is something like 128,0,0,0 (ARGB).
You'll also have to tweak the Blend property to make the color distribution not uniform.
This piece of code should get you going. Put it into an OnPaint override to see it in action:
e.Graphics.FillRectangle(SystemBrushes.Control, this.ClientRectangle);
e.Graphics.FillEllipse(Brushes.Blue, this.ClientRectangle);
GraphicsPath path = new GraphicsPath();
path.AddEllipse(this.ClientRectangle);
PathGradientBrush pgb = new PathGradientBrush(path);
pgb.CenterColor = Color.FromArgb(0, 0, 0, 0);
pgb.SurroundColors = new Color[] { Color.FromArgb(128,0,0,0) };
Blend b = new Blend(3);
b.Factors[0] = 0;
b.Factors[1] = 0.5f;
b.Factors[2] = 1;
b.Positions[0] = 0;
b.Positions[1] = 0.2f;
b.Positions[2] = 1;
pgb.Blend = b;
e.Graphics.FillEllipse(pgb, this.ClientRectangle);
pgb.Dispose(); Regards,
mav
|
|
|
|
|
Hi Mav,
Thanks for your reply. I really appreciate this. You perfectly understood what I was trying to create. I tried your code and it works fine as well. But here is the problem.
You have tried to create an ellipse. But when you try to create a pie what happens is it gives the applies the surround color to all the edges. which basically is taking away all the effect.
I am sure if you just you can re-produce what is the problem if you can simply replace all your
FillElliipse calls to this.
FillPie(xxx, this.ClientRectangle, 0, 90);
Thanks Again,
Apratim
|
|
|
|
|
So basically you want a 3D pie with rounded edges, right?
That's something that is beyond the scope of (rather) simple PathGradientBrushes.
You'd have to paint your pie chart as composition of true 3D objects, which is _a_lot_ more complicated than just filling a few ellipses and applying some clever gradients...
I strongly doubt that a believable effect can be achieved by applying gradients on the pie slices, sorry...
Nevertheless, you could take a look at this article here:
3D Pie Chart[^] for some inspiration.
Regards,
mav
|
|
|
|
|
Thanks mav for all your. The link sounds really interesting.
Apratim
|
|
|
|
|
Hi,
I have found some solid details on Windows Mobile 5:
http://www.bentuser.com/article.aspx?ID=310[^]
I was wondering if anybody has tried the .NET Compact Framework 2. Dare I install it on my Pocket PC?
Thanks,
Andrew
|
|
|
|
|
Interesting article. The only change that will effect me is that they changed everything from gray to blue. The rest sounded more like *fixes* than new features.
I'd try CF2 on my PPC only after a full backup with Activesync.
|
|
|
|
|
Hello,
I have a datagrid, and it's been populated with numbers.
I want to display the number 4509223 like that - 4,509,223 in the grid.
I tried to use:
row[i] = Math.Round(Convert.ToDecimal(Convert.ToDouble(val["NumUnits"])*mult), 0).ToString("n0");
But it does not convert the number to the above notation. Any ideas?
Thank you,
|
|
|
|
|
Create a CultureInfo object for the culture you want, and use that in the ToString() call. Alternatively, create a custom NumberFormat object with the settings you like.
Why in the world do you convert the value to the data type Decimal?
Just take the double value, skip the conversions and rounding, and just specify how it should be displayed.
---
b { font-weight: normal; }
|
|
|
|
|
string currencyValue = "4509223";
NumberFormatInfo numberFormatInfo = null;
double currency = 0.0;
currency = Convert.ToDouble(currencyValue);
numberFormatInfo = new NumberFormatInfo();
numberFormatInfo.CurrencyDecimalDigits = 2;
numberFormatInfo.CurrencyDecimalSeparator = ".";
numberFormatInfo.CurrencyGroupSeparator = ",";
int[] groups = new int[1];
groups[0] = 3;
numberFormatInfo.CurrencyGroupSizes = groups;
numberFormatInfo.CurrencySymbol = "";
string formattedCurrencyValue = currency.ToString("c",numberFormatInfo);
|
|
|
|
|
Still, when you assign value to a dataview which is the datasource for a grid, the value comes up as a number without separating commas.
Any ideas?
Thank you
|
|
|
|
|
|
That would be great, by the way here is the code that I use:
row[totalIndex] = Convert.ToDecimal(row[i]).ToString("c", numberFormatInfo);<br />
Debug.WriteLine("VAL: "+Convert.ToDecimal(row[i]).ToString("c", numberFormatInfo));
So, Debug.Writeline statement gives me the proper value, but the value in datagrid (row[totalIndex]) is displayed without comma separators.
|
|
|
|
|
Hey
Try this
if ( column.IsMoney )
{
NumberFormatInfo numberFormatInfo = null;
numberFormatInfo = new NumberFormatInfo();
numberFormatInfo.CurrencySymbol = "";
this.dataGridColumn.Format = "c";
this.dataGridColumn.FormatInfo = numberFormatInfo;
}
else
{
this.dataGridColumn.Format = "";
this.dataGridColumn.FormatInfo = null;
}
|
|
|
|
|
Great. Worked like a charm.
Thank you very much. Is there an option on NumberFormatInfo object, so I don't have .00 following the numbers? I don't want the decimal potion displayed, since all of my dollar values are rounded off already.
Thank you again.
-- modified at 11:16 Monday 19th September, 2005
I figured it out. Thank you for your help.
|
|
|
|
|
Sorry, a very quick question.
If I have a currency symbol in fron of the values for each of the columns, can I do something, so that the symbol does not show up in fron of the values for the first 5 rows, and then shows up for the rest. I guess to do that I have to override the paint method. ANy ideas?
Thank you.
|
|
|
|
|
This is very difficult to achieve. You cantry to override
GetColumnValueAtRow and SetColumnValueAtRow.
|
|
|
|
|
I want to display a "table" of data on the screen. This "table" may contain 2000+ entries. I want to sort the columns, highlight an entire row, programmatically select entries, and be able to determine which row (or at least the key column) that was clicked.
I can do all of this using a ListView, but it is slow to display when I loop through all record from the database and add to the ListView. When I use a DataGrid, it is much faster loading, but I can't determine how to change the column headers or more importantly, how to determine when a record is clicked and/or which record is selected.
Can someone provide a pointer or two, or tell me I'm approaching this from the wrong angle?
Thanks,
Glenn
|
|
|
|
|
Read this: Top Questions about the DataGrid Web Server Control in MSDN Help
|
|
|
|
|
Turtle Hand wrote:
Read this: Top Questions about the DataGrid Web Server Control in MSDN Help
I found this article at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchTopQuestionsAboutASPNETDataGridServerControl.asp[^]. Quoting from the article:
The Web Forms DataGrid control is not the same as the Windows Forms equivalent. It is a common (and not unreasonable) assumption that they are the same control, or at least have identical functionality. However, the entire programming paradigm for Web Forms is quite different from that for Windows Forms.
I didn't mention it explicitly, but this is a Windows Forms application.
--G
-- modified at 16:26 Friday 16th September, 2005
|
|
|
|
|
|
I am trying to write an automation routine to upload a file to a secure webmail system. i have figgured out how to get the information into the fields available, but i am unable to figgure out how to click a javascript button. I am using the axWebBrowser control. any thoughts how to click login?
|
|
|
|
|
Once you get the document object you can get the button element using the all collection or walking the DOM until you get the button object. Then you just use the IHTMLElement click method to simulate the click. Make sure you use the IE interop objects which come with the framework rather then generating your own. They have an easier to use object model.
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
|
|
|
|