|
I can't seem to be able to use that class in the Compact Framework, would Convert.ToBase64CharArray() work do you think?
Jonathan 'nonny' Newman
blog.nonny.com [^]
|
|
|
|
|
Jonny Newman wrote:
would Convert.ToBase64CharArray() work do you think?
I think no problem with that. You have to tranform to base64. No matter with which function.
Mazy
"Improvisation is the touchstone of wit." - Molière
|
|
|
|
|
Is System.Net.WebClient.UploadFile method available in CF?
|
|
|
|
|
Hi ,
I am currently building a simple serial terminal program. I have used text boxes to view send and received data. But everytime the text boxes get updated, they scroll upto the top most position. This is very annoying because I need to scroll down every time something new is received.
Could someone please tell me how to make the text boxes scroll automatically? Or am I better off making my own text box control? If so where can I find more info on how to do that?
Cheers
-Chad
ZT
|
|
|
|
|
Hiya I have a data entry form with a grid control. I want to add a new row to the data grid with the customer details after every entry.
The only way I can do it at the moment is to set up a class of properities and call datagrid.DataSource = aCustomerDetails each time. I think this might be expensive on system resources calling this for every entry.(remember, there could be 100 or 1000's of entries!!)
Is there an easy way to add a new row to the datagrid each time??
Thanks.
|
|
|
|
|
You have to add a row to your dataset which is datasource of your datagrid, then it automaticlly added to your datagrid too.
Mazy
"Improvisation is the touchstone of wit." - Molière
|
|
|
|
|
I'm using C# and drying to develop a custom TextBox control. Currently I am simply trying to draw with blue instead of black. I've overriddent the OnPaint method and as long as the TextBox does not have the focus it draws the text in blue as i want it to; however, once you click inside of the edit box, my custom drawing routine no longer gets used. If you then force a repaint (i.e. minimize and then maximize) my code is once again used for the redraw. How do I get the control to use my drawing routine while it has the focus and the user is typing in it? Here is the code I have right now:
#region Custom Drawing Code <br />
protected override void OnPaint( PaintEventArgs pe ) <br />
{ <br />
Brush b = new SolidBrush( Color.Aqua ); <br />
Font f = new Font( "Arial", 12); <br />
<br />
pe.Graphics.DrawString( Text, Font, b, 0, 0 ); <br />
} <br />
#endregion
|
|
|
|
|
To do a custom textbox is alot of work, perhaps the RichTextBox can serve u better. Also inheriting from a TextBox wont work, TextBox relies on too much PInvoked code, hence much stuff cant be overriden in the usual fashion.
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
I'm not really afraid of putting a lot of work into it. And i'm mostly a Win32 API programmer, so PInvoke doesn't really bother me. I'm just new to C#. What I want to be able to do is to draw ontop of the text (i.e. circle a word with the mouse) and I was hoping to develop a custom control to allow this to happen. Do you have any suggestions as to how I could do this? Additionally, have you any idea how the VS .Net IDE does the coloring of keywords. Should I just develop my own control entirely from scratch? Any Ideas are welcome.
|
|
|
|
|
Most controls in the .NET Frameworks base class library wrap their equivalent Windows common controls. If you've handled common control messages before, you should have no problem handling this. Just extend the control in question, override WndProc and be sure to call the base implementation (base.WndProc ) to let the derived class handle the rest of the work.
There are plenty of examples that do syntax highlighting and there are many ways to do it. A good implementation with open source is SharpDevelop[^], a free C#/VB.NET/HTML IDE with designer support. Take a look at the source for syntax highlighting if you're interested.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
That is what I had done. I was attempting to extend the TextBox; however, the textbox does some drawing outside of the paint message, and I don't know what that message is. I understand the grand concept, I just can't figure out what message is doing the redrawing (I mean aside from WM_PAINT).
Regardless, the source code to SharpDevelop is definatly going to help me out a lot. I've looked at the source code for the TextEditor control for it and that should be enough to get me pretty far along. Thanks alot for that link.
|
|
|
|
|
Hi,
We have a smartclient application in C#. We don't know the clients resolution or dpi.
I know it is possible to detect this.
But then we want to adapt or forms and fonts to that type of screen.
Do we have to create a piece of code for each combination (resolution/dpi) to adapt font and controls (hight/width)?
Or is there something automatically that can do this for us.
Ex. we wrote all forms and they are very nice on a screen with a dpi=96 and pixels 1024/768. But when we run the app. on a screen with other setting it is like hell.
So, I would before showing a form that we detect the settings and then adapt our whole app. forms for this screen settings.
Maybe build one form that consits of a panel. Call it mainpanel.cs.
And then all forms hire of that mainpanel. ....
I don't know where to start with this problem.
Tks,
|
|
|
|
|
SystemInformation.VirtualScreen ?
Mazy
"Improvisation is the touchstone of wit." - Molière
|
|
|
|
|
Subclassing is not the way to solve this. You'll end up with more problems than solutions because of an overly-complex architecture.
You could simply get - as part of a static call (it really only needs to be obtained once) - the dpi of the screen (or any graphical output device for that matter) and either initially size your controls accordingly (hence not relying on the designers to do the dirty work and re-arrange your code for optimal execution) or call Scale or ScaleCore (inherited from Control , and the last is virtual so you can override its behavior).
To get the dpi (logical pixels), you'll need to P/Invoke GetDeviceCaps since .NET doesn't expose these properties in the base class library:
[DllImport("gdi32.dll")]
private static extern int GetDeviceCaps(IntPtr hdc, int index);
private const int LOGPIXELSX = 88;
private const int LOGPIXELSY = 90; Once you have the dpi (should normally be the same for the X and Y axis) you can do the appropriate calculations and scale your controls accordingly.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi there
i have an mdi app that has a notifyicon.
i want my app to minimize to the tray when it is minimized
but when i minimize the app it minimizes to the bottom of my desktop!
i have set the property
ShowInTaskbar = false
of the main form
Can anyone help me??
VisionTec
|
|
|
|
|
Use Hide(); and Show(); methods of Form.
The smaller the mind the greater the conceit.
Aesop
|
|
|
|
|
The Show() Hide() methods work fine if i use buttons or menus.
But i want to use the minimize box that the form has.
Can anyone plz help?
VisionTec
|
|
|
|
|
protected override void OnDeactivate(EventArgs e) {
Hide();
}
try this, hope it helps.
The smaller the mind the greater the conceit.
Aesop
|
|
|
|
|
Hi,
I'm expecting to get an extra column named 'state' displayed in the datagrid but it doesnt add one.
Can you please help me find out the problem with the source code.
SqlConnection myConnection = new SqlConnection(
"server=(local);database=demo;Integrated Security=SSPI");
SqlDataAdapter myCommand = new SqlDataAdapter ("select * from demo", myConnection);
/* myCommand.SelectCommand.Parameters.Add(new SqlParameter("@State", SqlDbType.NVarChar, 2));
myCommand.SelectCommand.Parameters["@State"].Value = MySelect.Value
*/
try
{
myCommand.SelectCommand.Parameters.Add(new SqlParameter("@State",SqlDbType.NVarChar,2));
myCommand.SelectCommand.Parameters["@State"].Value = "aa";
}
catch(Exception ex)
{
Response.Write(ex.Message);
}
DataSet ds = new DataSet();
myCommand.Fill(ds, "mytable");
DataGrid1.BorderColor=Color.Black;
DataGrid1.BorderWidth=1;
DataGrid1.GridLines=GridLines.Both;
DataGrid1.CellPadding=3;
DataGrid1.CellSpacing=0;
DataGrid1.HeaderStyle.BackColor=Color.FromArgb(0xaaaadd);
DataGrid1.DataSource=ds.Tables["mytable"].DefaultView;
DataGrid1.DataBind();
Yours sincerely
Andla
|
|
|
|
|
Does your demo table have a field entry for state? If not you will need to modify the SQL statement to include this as well.
- Nick Parker My Blog
|
|
|
|
|
I'm doing some statistical analysis work. I have a binary file that contains around 10 million integers. This is my test method:
<br />
Hashtable myNumber = new Hashtable();<br />
Random r = new Random(13214);<br />
for(int j = 0; j < 10000; j++)<br />
{<br />
int c = r.Next(9999999);<br />
if(!myNumber.ContainsKey(c))<br />
myNumber.Add(c, null);<br />
}<br />
<br />
int p = 0;<br />
FileStream fs = new FileStream(Directory.GetCurrentDirectory() + "\\test.txt", FileMode.Open, FileAccess.Read);<br />
BinaryReader bw = new BinaryReader(fs);<br />
Hashtable h = new Hashtable();<br />
DateTime s = DateTime.Now;<br />
int foundnumbers = 0;<br />
for(int i = 0; i < 10000000; i++)<br />
{<br />
int current = bw.ReadInt32();<br />
if (myNumber.ContainsKey(current))<br />
foundnumbers++;<br />
}<br />
bw.Close();<br />
Is there anyway to improve the performance? What I need is to see if a set of numbers is contained in the file.
|
|
|
|
|
Consider I have a lot of Points, each of which are drawn on a PictureBox surface within its Paint event handler if needed.
Now, to you, what is the best approach to add zooming functionality to a paint like application? I mean, do you handle all the stuff yourself, or there are some useful methods within the GDI+ classes which can help us...
Don't forget, that's Persian Gulf not Arabian gulf!
|
|
|
|
|
See the Graphics class, there's plenty of ways to do this, including Graphics.DrawImage and Graphics.ScaleTransform .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I am getting the classic "Object reference not set to an instance of an object." error inside a System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) call.
Before you tell me the canned response about null references, here is the trace:
System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at eCandidus.Master.Main() in C:\Enterprise Candidus\eCandidus\eCandidus\Master.cs:line 104
The error happens randomly while scrolling a dropdown list combo box, and happens in different combo boxes in different forms. Note that is being caught in a last resort try/catch at the very outmost call posible.
Anyone run into this one before?
|
|
|
|
|
Hi,
my question is.. im using winforms..where one form needs a connection to a SQL Server 7.0 database..can anyone tell me what are the classes involved is it :
System.Data; and System.Data.SqlClient; ??
and also how do i code the connection part...some example would shed some light...i've searched online and got many examples but they're very confusing.
forgive me if im asking for too much...im still new to C#..
plus where can i get the .Net SDK documentation.
Arvinder Gill
ArvinderGill
|
|
|
|