|
Said textbox might not accept WM_SETTEXT message, have you varified whether is it accepting this message?
you can you spy++ or winspy like utilities to do that
|
|
|
|
|
Hmm, looks you're right.
This textbox isn't accepting WM_SETTEXT..
So another question is raised, is there other way to change its caption ?
|
|
|
|
|
hi
i found an article in codeproject as DataGridPrinter that print datagrid good. but it has written with VB.Net and i want it in csharp. when i create dll in VB.Net and i use it in c# the following error shown me :
Unable to cast object of type 'System.Windows.Forms.BindingSource' to type 'System.Data.DataTable'
and when i set Datagrid1.DataSource = ds1.Tables["Table1"]; the following error shown me :
//in Line 374
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
how to solve my problem and do you have a other class that print datagrid in C# with header and footer ?
thanks ..
|
|
|
|
|
Sorry for the long post, but please bear with me.
I have a graphics user control that can display several graphics primitives, plus bitmaps and text in 2D. Users can easily scroll/pan/zoom, select objects and scale or move them, and is used all over my organization (for a visual, one of the uses is to overlay CAD information on top of a bitmap). The graphics objects are also used outside of the context of drawing - some applications only use the objects themselves to do calculations for other purposes.
Each object implements an interface and most manipulation of the object is through that interface. Each object draws itself using a supplied System.Drawing.Graphics object like a ton of articles on code project and elsewhere suggest. The current design works great for collections of graphics objects up to about 3,000 or so, but now the control is being used in situations where there may be 30k+ objects in the drawing and performance is very poor.
I've been going over the code and looking for optimizations, and there are several things I'm going to work on, but one of the things I also want to try is using different graphics for drawing, perhaps Managed DirectX, but here lies a problem. The interface that each object implements includes 3 methods that need a System.Drawing.Graphics object as a parameter. One of the methods is Draw(), the other two are for determining the size of a shape (which is really only needed for text objects - ie. MeasureString - but had to be in the interface to keep things generic). So basically, I need a way to decouple the actual drawing method used from the object itself.
One idea I had was to create a separate GraphicsContext object that would be passed into the objects in place of System.Drawing.Graphics and would have methods similar to System.Drawing.Graphics, but could be implemented behind the scenes in whatever way I wanted. The problem with that is I'm simply coupling to something else - and the users who don't even use the objects as "graphics" have yet another thing to use for determining size (unless I can figure out a way to measure a string without some type of graphics). Maybe I'm just over-thinking this one.
Another idea I had is to completely remove the graphics requirement for all methods and remove the Draw method entirely, then only the drawing code itself would be coupled to a specific method. This has worse problems though - users can currently add their own graphics objects, but this method would not know how to draw those. Plus the performance probably wouldn't be there anyway - the collections only expose the objects as the interface, so it would require checking and casting to specific types before the drawing. The Con's pretty much make this a no-go.
Are there other ways I can do this? I know there has to be, I know of many games that work with DirectX or OpenGL and some even software render if those aren't available, so there must be some good way of doing this. I once saw an article about this when Googling for something else, but I'll be damned if I can find it now.
-----
In the land of the blind, the one eyed man is king.
|
|
|
|
|
How about something like a PrimitiveInformation member for each object which basically contains polygon, color and type information? (Something like a Vector4 struct).
This would allow for a parameterless Draw function. Instead, each renderer (DirectX, OpenGL, System.Drawing) would just pull the PrimitiveInformation and Draw it the way it does.
DX, OpenGL and System.Drawing all can easily parse basic information like polygons, colors etc.
Something like this:
interface IDrawableObject
{
ObjType type;
Vector4[] polygons;
Vector3 translation;
Vector3 rotation;
public void Draw() { ... }
}
This could be easily used with any renderer.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
You need to see Adapter design pattern. It helps you work with two different interfaces (system.drawing and directx) which is not otherwise possible because of incompatible interfaces.
For more information about adapter design pattern click here. http://www.dofactory.com/Patterns/PatternAdapter.aspx[^]
|
|
|
|
|
It took me a while to figure out how I could apply this, but I think I have it now. It's basically what I was thinking already, but one step forward so that the user doesn't need to worry about the graphics at all, it will be done fully inside the object.
Thanks a bunch.
-----
In the land of the blind, the one eyed man is king.
|
|
|
|
|
Hy, i need some help because im pretty lost
ok, the thing is that i have to make a program that takes all dlls in a folder, read them and take those classes, methods and properties. Then it writes on a XML, f.e.:
-<global>
-<string>
<method/>
<property/>
-</string>
</global>
well, at start i thoght it was easy, but as i go further i find more problems.
My msn is sgermey@hotmail.com, im connected almost all day
Thanks all for read/answer/help/whatever
|
|
|
|
|
I have a problem in that MS SQL 2000 can't access a database I use (Sybase Adaptive Anywhere). However, Visual Studio can access it (well, the tables I have permissions granted to select). I need to extract the data from tables and put them into a new database and/or datawarehouse.
1. Is there an efficient way of duplicating a database in C#?
2. What's the best way of creating / populating an OLAP cube? I would like to use SQL Stored Procedures to copy data from the db into the OLAP cube with a schema. As this is not possible, do I import data into C#, use a table adapter to make new table designs and then put it into the OLAP cube? Would it be better to duplicate the database and then use SQL stored procedures?
Thanks for your help in advance.
|
|
|
|
|
I thought that enterprise manager could access data in most data sources.
You may want to look at data transformation services - create a local package, there are a load of database connection types (inc. odbc). You write all your scripts to transfer the data in the local package (you may need to read up on the it, but essentially you drag and drop tasks (eg there's an execute sql task), hook events together and the run in sequence based upon the previous events success or failure.
You can then schedule the package to run periodically (we run it overnight to populate our olap cube) using sql server agent.
Hope that helps (although it's not a c# solution).
ChrisB
|
|
|
|
|
Hi!
I have a textbox where I write my namn and click OK. Then a another form loads up.
Then my name should appear in a label. But I cant seem to reach my variable (name) from form1 to use it in form2.
Any suggestions?
Newbie untill I die!
|
|
|
|
|
Hy,
The easiest way to do what you need is to create a public static variable that contains the TextBox's text. I'll give you an example code. Suppose you have Form1 with TextBox1 and Form2 with Label2. When you click Button1 from Form1 you show Form2 with the text on the Label2.
public static string textBoxText = "";
private void Button1_Click(object sender, EventArgs e)
{
textBoxText = TextBox1.Text;
Form2 f = new Form2();
f.ShowDialog();
}
private void Form_Load(object sender, EventArgs e)
{
Label2.Text = Form1.textBoxText;
}
Hope it helps you.
Do your best to be the best
|
|
|
|
|
public static string textBoxText = "";
that one was missing, well it was not decleared where you had put it, thanks!
Newbie untill I die!
|
|
|
|
|
Why dont you make a seperate class file of the same namespace, then declare all your global variables in that class and then access those variables from any Form of your application...
i.e.
class myGlobalVars
{
public static string textBoxContent;
..........
..........
}
Now access these variables from any Form like this,
string getTExtBoxContent = myGlobalVars.textBoxContent;
|
|
|
|
|
Yes, I have thougth about that...but I only have one variable...so I think its a little to much work for only one.
Newbie untill I die!
|
|
|
|
|
still better than spending hours to find out more efficient ways. isn't it ? When I started learning C#, I used to use File.WriteAllText(), File.ReadAllText to communicate between forms and that was the easiest solution for me that time and my application survived without any problem.
Anyway, best of luck.
|
|
|
|
|
Hello!
I have a cross tab report (designed in Crystal Reports) that i export to disk in PDF format. The report is larger than one page. The first page of the pdf file is ok but on the second page the cross tab is printed but it is not filled with the data. I use the "mode" summary option for my summary fields. If i use the "count" summary option the report is printed normally and i have all the cells filled with data, but i need to work with the "mode" option. I don't understand what happens! What should i do?
Thank you!
Mihaela
|
|
|
|
|
Hello!
I am creating a cross tab report in Crystal Reports (the one that comes with the .NET 2003). I add at runtime the names of my columns and rows in two data tables in a data set. I want the columns and the rows to appear in my report in the order I introduced them in the data tables, but, somehow, the report has the columns and rows in alphabetical order. What should I do to have them in the initial order? (One more thing: In the DataSet they appear in the original order but in the report's database they are already in alfabetical order)
Thank you!
Mihaela
|
|
|
|
|
Hello!
I'm trying to draw an existing image onto a bitmap. The problem is that I need to scale the image and it is automatically smoothed, but I don't want it smoothed.
I use the DrawImage function of Graphics . Setting the SmoothingMode property of the Graphics object seems to have no effect.
Any idea how I can draw an image non-smoothed and scaled onto a bitmap?
Best regards
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Have you tried following?
Graphics.InterpolationMode = Drawing2D.InterpolationMode.NearestNeighbor;
|
|
|
|
|
That works, thanks a lot!
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
You want InterpolationMode not SmoothingMode. NearestNeighbour will not do any smoothing.
|
|
|
|
|
That works, thanks a lot!
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
<br />
private void button1_Click(object sender, EventArgs e)<br />
{<br />
byte[] data = Encoding.ASCII.GetBytes("This is a test");<br />
sokje.SendTo(data, eindPunt);<br />
}<br />
This is the code i use for sending data to the server. This goes without an error (Though im not shure if its correct so comment is welcome).
<br />
<br />
private void button1_Click(object sender, EventArgs e)<br />
{<br />
sokje.Listen(5);<br />
sender = new IPEndPoint(Dns.Resolve(IPAddress.Any.ToString()).AddressList[0] , 11000);<br />
EndPoint senderRemote = (EndPoint)sender;<br />
<br />
int ontvangen;<br />
<br />
<br />
byte[] data = new Byte[256];<br />
ontvangen = Convert.ToInt16(sokje.Receive(data)); <br />
}<br />
This is the code i use to recieve messages. This gives me this error :
An unhandled exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
With the following comment :
Socket is not connected and sender has not given an adress
The purpose of the program :
It doesn't really have a purpose yet. Im just expirimenting with c# a bit. For the future i plan on creating some gaming stuff (poker or so) freeware offcourse.
My question :
Can someone explain to me why this is not working and the way im supposed to make it? i started networking only 1 week a go so i would preffer a (relative) easy explanation.
Kind regards Jacco
|
|
|
|
|
Hi,
My first question is that if sokje is a Socket object. If it's so then you should bind it to one ipaddress and a port number. An easy way to do that is to write something like:
Socket serverSocket = new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);
serverSocket.Listen(5);
serverSocket.Bind(new IPEndPoint(Dns.Resolve("127.0.0.1").AddressList[0],PortNumber));
In the code you posted i don't see anywhere that you accept an incoming connection from a client. You can do that with this line of code:
Socket clientSocket = serverSocket.Accept();
Accept method is a blocking method so the program won't go further this line until a client is connected to the server. Only after you accept a client you can read what it sends.
Hope this helps.
Do your best to be the best
|
|
|
|