|
Have a problem with moving a picturebox while left clicking and moving the mouse cursor:
private void pictureBox1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)<br />
{<br />
if (e.Button == MouseButtons.Left)<br />
{<br />
pictureBox1.Location = new Point(e.X,e.Y);<br />
}<br />
}
Looks not very nice during runtime, because there are some drawing problems. Any suggestions?
|
|
|
|
|
Seraphin,
To improve the looks during the draw you probably need to impliment double buffering.
Take a look at this example:
http://www.codeproject.com/cs/media/flickerFreeDrawing.asp
It should get you going.
|
|
|
|
|
Hi I am struggling to insert a record into an existing database with 2 Text fields. I
am using ODBC/DSN to connect to the database. The MS-Access database is
in my secure DB folder. I am able to read the database content and display.
However, I can't insert any records. I am sure the datatypes are compatible
with the database and the # of fields are correct.
Error:
-------
ERROR [07002] [Microsoft][ODBC Microsoft Access Driver] Too few
parameters. Expected 2.
Do you think this has something to do with permissions and I have to ask my
hosting company if they can give me write permissions?
Appreciate if anyone can help.
Complete code:
------------------------
OdbcConnection dbConnection = new OdbcConnection(strODBC);
String sqlStmt = "INSERT INTO outbox(db_email1, db_email2) VALUES
(@email1, @email2)";
OdbcCommand dbCommand = new OdbcCommand(sqlStmt,
dbConnection);
OdbcParameter e1Param = new OdbcParameter("@email1",
OdbcType.VarChar, 255, "db_email1");
e1Param.Value = email1;
dbCommand.Parameters.Add(e1Param);
OdbcParameter e2Param = new OdbcParameter("@email2",
OdbcType.VarChar, 255, "db_email2");
e2Param.Value = email2;
dbCommand.Parameters.Add(e2Param);
dbConnection.Open();
try
{
dbCommand.ExecuteNonQuery();
}
catch (OdbcException xx)
{
// Exception
errorMsg.Text = "Insert Data Failed - " + xx.Message;
}
dbConnection.Close();
|
|
|
|
|
The account that your ASP site is running under MUST have write permissions to the FOLDER that your .MDB file sits in. Without those permissions, you're out of luck.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I need to include a spreadsheet control on a form in my C# WinForms application. Once the spreadsheet is loaded, I want to be able to load excel add-ins (.xla/.xll) - for instance, the "analysis toolpak" - files to allow access to their functionality with the spreadsheet. How can I do this?
|
|
|
|
|
Hi!
I want to read an XML file, which is not completely standard conformant. To be more precise some of its nodes contain text with special characters (see the example below).
<br />
<RootElement><br />
<ConformantNode>Hello</ConformantNode><br />
<NonConformantNode>You & me</NonConformantNode><br />
</RootElement><br />
As you can see "NonConformantNode" contains an & char in its text, which always makes System.Xml.XmlReader throw an exception.
How can I read the content of this document, in other words, how can I read an XML document without automatic character decoding?
Thanks for your help in advance!
P.S.: I already tried setting XmlReaderSettings.CheckCharacters to false, but this doesn't do the trick.
-- modified at 8:01 Saturday 17th September, 2005
|
|
|
|
|
One way could be to read the file into a string, replace the illegal characters with their legal code, and then read the string into an xml document.
---
b { font-weight: normal; }
|
|
|
|
|
This could of course be an approach, but as some of the files are quite big, performance would suffer a lot. Isn't there a way that I can configure XmlReader to forget about any kind of character encoding?
|
|
|
|
|
Has anybody got an idea? It's quite urgent.
|
|
|
|
|
how to access client side (javascript value) from c# (server side)
or how pass the client value to server side value
m mohamad rafi
|
|
|
|
|
You can't access the value directly. You have to send the value back in the request to the server.
Put the value in a hidden field if you post a form, or put the value in the querystring.
---
b { font-weight: normal; }
|
|
|
|
|
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
|
|
|
|
|