|
Hi,
I have a small C# application which prints a few lines on a printer.
I have used System.Drawing.Printing.PrintDocument class and have a PrintPage event wherein I use Graphics.DrawString() to print the text on printer.
The text has two different fonts (Arial and Tahoma).
When I print on HP laser jet printer, the text is printed as expected.
But when I print the same on Minolta Copier/Printer, the text with Arial font becomes Junk. The text in Tahoma has no problem.
Just to isolate the problem, I printed a few lines with Arial font from Microsoft Word on Minolta printer and that is printed properly.
Any idea what is happening wrong hrer ??
Any hint/clue would be of great help.
Thanks
Bhavin
bhavin
|
|
|
|
|
Is this even possible in a C# windows forum.
If i create a transparent image (Like png or gif) or use a transparent icon in a picturebox, there is always a background color.
If i use the same images in a label, the image is transparent as i can see the text beneath it.
regards,
Martijn
|
|
|
|
|
Hello to everyone!
I'm building a schedule-like interface that suppose to show events (represented by rectangles) for users (represented by a row on which the rectangles mentioned earlier would appear). At the top border of this object, there's a timeline that starts from few minutes before the current time and up till the last event. The shown events should respond to zoom-in and zoom-out functions that will affect the timeline resolution (the higher the resolution, the longer a rectangle). These events can be dragged around a certain row (user), expanded or shrunk (duration of the event), and added or removed without limit. The events will be taken from a SQL server later on. For overall reference, think of MS Project's timeline diagram, but without the arrows between the tasks.
So far, I've implemented the rectangle itself using a Label. It can be gragged around, expanded and shrunk on demand using the mouse, and a double-click creates a TextBox on top of the Label, in order to edit the name of the event. When the TextBox looses focus, the text is saved in the Label.
Also, I've implemented the drawing of the background for each line, and the drawing of the timeline. The whole object is implemented on a Panel so that scrolling can be made possible.
My problems are as such:
1) When I scroll horizontally, the timeline nudges, if drawen at all, are smeared on the panel. It seams that the panel is not refreshed correctly. When I call Refresh() on the panel, it doesn't allways do the job.
2) I cannot set the actual size of the view (client) area of the panel with the srcoll bars, unless there's an object in it. For example: I want to set the size of the Panel to 100, but allow the scroll bars to reach 500, but without placing an object in the Panel at that point.
3) Can anyone think of a better way to implement this?! Perhaps, using Visio client in a program?!
HELP HELP HELP!!!
I'm getting really thrustrated implementing all these things with code.
With respect,
SolidRock
|
|
|
|
|
Concerning the scroll thing, i've done similar things in my project.
Instead of using the AutoScroll ability, here's what i did :
* create a Control Inheriting from a Panel.
* add a scroll bar in it and some code to manage the SizeChanged event ( or just dock it on the right )
* add another panel ( which will be your client zone ) inside this first one.
* make it so that when any control except from your scrollbar and inner panel is added to your main control children, they in fact are attached to your inner panel.
then scrolling is just a matter of positionning the inner panel.Top
Inner panel needs to be resized every time a control is added/removed from it.
Every time the inner panel is resized, the ScrollBar maximum value is set.
You need a bit of coding to get it fully functionnal, but it's worth it imo... Autoscroll is barely useful since you can't scroll with code.
This worked great for me. I didn't want to use external API calls to manage my scrolling.
Hope this will help, though i'm not completely sure i understood your problem.
Etienne.
|
|
|
|
|
Hi Gangren!
I did exactly what you told me and it works great!
But I did encounter a problem when the control is resized (i.e. from normal to maximized), the control's Left property holds a negative value!
Why?!
|
|
|
|
|
Hi,
I'm not sure i understand the problem, maybe you could be a little more specific on the steps to reproduce your problem.
Don't forget that the form ClientSize will be brought down to zero when minimizing, so all the docked controls will be resized to have a zero height too. So if you have code in Resize event (or in OnResize method) of your scrolling panel, and you probably do have code there, don't forget to check if a zero height is ok for all the processing you do there.
I've never experienced any issue with the "scrollable panel" control i've made, even when docking it to fill, left, or anything. I just tried checking the "left" property after resizing to Maximized, Normal and Minimized, and it always stays at zero.
If you really want me to help the best would be to post a smaple project reproducing your problem
Etienne.
|
|
|
|
|
Hi everybody!!
Can anybody tell me how to write an image-object from C# into MS Access?
A code example would be useful!
Thanks a lot
SeDoHo
|
|
|
|
|
I use the following example to insert BLOBs into SQL tables, I would think if you change the SqlCommand to OleDbCommand it might work.
public void InsertBLOB(string Table,byte [] BLOB)
{
string Command="INSERT INTO "+Table+" (FileName,BLOB) VALUES ('MyFile',@MyBlob);
SqlCommand addEmp = new SqlCommand(Command, dbConn);
SqlParameter Param = addEmp.Parameters.Add("@MyBlob",SqlDbType.Image,(int)BLOB.Length);
Param.Value=BLOB;
addEmp.ExecuteNonQuery();
}
|
|
|
|
|
Hi All,
Does any body know how to create context help for GroupBox control in C#? The System.Windows.Forms.HelpProvider class is working fine for any other controls except for Groupbox.
Here is how you can reproduce it:
Create a form, in its properties, set the MinimizeBox and MaximizeBox to false, and set HelpButton to true, then you will see a little question mark in the title bar.
Drag any controls from the toolbox to the form, remember to include a groupbox.
Drag “HelpProvider” from the toolbox into the form
Now in the properties of every control, you will see “HelpKeyword on helpProvider1”, “HelpNavigator on helpProvider1”, “HelpString on helpProvider1”, “ShowHelp on helpProvider1” in the misc panel.
For every control, set “ShowHelp on helpProvider1” to true and input whatever you like in the ”HelpString on helpProvider” row.
Ok, it’s done. You will see the context help is working for any control, except for the groupbox. Do we need to take special care of GroupBox control?
Thanks,
Renee
|
|
|
|
|
Hi guys,
does anybody know, how I can get information (name, id..) about every control(button, label...) that is
located on a Form?
thanks in advance
Jörg
|
|
|
|
|
Hi,
try this :
static void GetControlsInformation ( Control parent_ctrl )
{
foreach (Control ctrl_temp in parent_ctrl.Controls)
{
DoSomethingWith ( ctrl_temp.Name );
DoSomethingWith ( ctrl_temp.Size );
etc..
GetControlsInformation ( ctrl_temp );
}
}
then to get information for all the controls on the form, use :
GetControlsInformation (my_form);
Etienne.
|
|
|
|
|
I want to do an application in which the pda should store the data when the user is at field work and should be updated in to my pc sql data base when the pda is connected to my pc
thanks in help
Any code please mail to chatcops007@yahoo.com
|
|
|
|
|
Hi Prasadepparla,
there are several ways to build such an application, which synchronizes data from the pda to a sql data base:
1) If you are using MS SQL Server as the pc sql data base, then you should take a look at SQL CE, which is designed for acting with data on a pda. SQL CE allows you to change the data at the pda and then to synchronize the changes with the pc sql data base.
Advantages:
- SQL CE is free and fully supported by SQL Server
- SQL CE is also supported by the CF
2) Second option is to build the application with UltraLite.NET and the Sybase MobiLink-Synchronization-Server. Basically it is the same like working with the SQL CE, but the problem is, that these Components are not free, you also have to pay for UltraLite.NET (same like SQL CE).
Advantages:
- Supported by CF
- Designed especially for snychronisation
3) Another possibility I dont know.
Hope this answers your question. If not, post again and I will try to answer your question.
Sebastian Martens
|
|
|
|
|
THANKS,
So i have to install SQL CE on my pda for usage
can i use file system to store records in pda with pda windows form and retrive them by my pc windows form and store them in sql server
please help me the namespaces which i have to use for file storing in pda.
chatcops007@yahoo.com
|
|
|
|
|
SQL Server CE uses a file-based database that you can store anywhere on your PDA. There are many ways of sync'ing this with a SQL Server database (like on a corporate server), though. When you install SQL Server CE, you can set up a replication schedule both on a schedule and on certain (limited) events, like sync'ing your Pocket PC.
You can download SQL Server CE and read about replication, .NET Compact Framework classes (defined in the System.Data.SqlCe namespace), and many other articles about the scenario you want from http://msdn.microsoft.com/SQL/SQLCE/default.aspx[^].
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi,
this is a good question. But unfortunately I have to say, that I don't know. I've heard about this technique but for myself I didn't used it.
In my PDA project I choosed the second option.
But I think, Mr. Heath Stewart or somebody else can help you.
Sorry
Sebastian Martens
|
|
|
|
|
You should also take a look at the Application Guidance: Data Lay[^] section of the Microsoft Patterns and Practices web site, which goes into this in great detail. Especially read the Caching Architecture Guide for .NET Framework Applications[^].
For simple updates, you could use the DataSet , but I warn that with .NET 1.x the only storage format is XML (not very compact; even using a BinaryFormatter still serializes the DataSet to XML) and has its limits, such as requiring that the whole structure is loaded into memory to manipulate it and it can be slow with more data. If you need to store more than a few dozen records, then checking out better caching strategies is a very good idea.
Besides the Patterns and Practices web site articles mentioned above, there have been a number of articles covering this and similar topics on MSDN[^] that I recommend you browse or search to find them.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hello All
I am looking for a control property which works like .enable=false; without grayscaling or highlighting the control.
- or -
how to suppress keypress and mouse events for specific controls like checkbox, listbox, radiobuttons ....
Does anybody have an idea ?
Thanks in advance
fracalifa
|
|
|
|
|
In Enter Event handler of the control, try to focus on different control. like
private void comboBox1_Enter(object sender, System.EventArgs e)
{
this.textBox1.Focus();
}
Hope this works...
|
|
|
|
|
Hello Jay
this is the way I have just realized and I have also some functions to suppress keypress events, but what are you doing when there is no free field to focus to? That's all not satisfactorily !
Thanks
Some more ideas ?
|
|
|
|
|
I also agree with you. The solution is not satisfactory. I had the fix the same problem using the above solution, that is why, I posted...
BTW, If you get some different way of achieving the same. Do post the solution.
|
|
|
|
|
Hi All
I'm having a problem stated below:
I've populated a dataset from multiple tables and then bind the datagrid with this dataset. Now when the datagrid contents are changed by the user, I want to propagate these changes in the original tables. What is the most convenient way to accomplish this? I shall be very thankful for any expert advice.
Truly yours
Rashid
|
|
|
|
|
Read the SDK documentation for the DataAdapter.Update method, which describes in rather nice detail what is required and basically how it works. You use a DataAdapter -derivative - like SqlDataAdapter - with the InsertCommand , DeleteCommand , and UpdateCommand specified (in addition to the SelectCommand , which is both required and assumed since you already have a DataSet . Based on a DataRow 's DataRowState , the record will be added, updated, or deleted.
Generally you should specify an INSERT statement followed by a SELECT statement for the InsertCommand . This is because any auto-generated fields defined on the database may be different (and most likely will) than what is in your DataSet . After inserting the row, the select will make sure your DataSet contains the right data.
If you are sending this DataSet across the wire to be updated, first call DataSet.GetChanges to get a DataSet of only the changes. This is only necessary if you send the DataSet across the wire before passing it to DataAdapter (like in a typical 3-tier design). Do not call DataSet.AcceptChanges , however, otherwise all the change-tracking information is lost. DataAdapter.Update will do this upon successful completion of the update.
Read http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemdatacommondataadapterclassupdatetopic.asp[^] for more information.
You can also click "Search comments" above and search for "DataAdapter", for example, for previous discussions about this. We have talked about it quite a bit in this forum over the years.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
My problem is that I can't restart my remoting server. This is how I
start the server:
m_ServerSinkProvider = new BinaryServerFormatterSinkProvider();
m_ServerSinkProvider.TypeFilterLevel = TypeFilterLevel.Full;
m_Props.Clear();
m_Props.Add("port", nPort);
m_Props.Add("typeFilterLevel", TypeFilterLevel.Full);
m_TcpChannel = new TcpChannel(m_Props, null, m_ServerSinkProvider);
ChannelServices.RegisterChannel(m_TcpChannel);
RemotingServices.Marshal(InstanceOfRemoteserverClass, "DataHandler");
This is what I do when I stop the server:
RemotingServices.Disconnect(InstanceOfRemoteserverClass);
ChannelServices.UnregisterChannel(m_TcpChannel);
When I try to start the server again, I do the start part again. When
I restart, I get an exception: only one usage of each socket address
(protocol/network address/port) is normally permitted. This is caused
by:
m_TcpChannel = new TcpChannel(m_Props, null, m_ServerSinkProvider);
This exception will occur only if my client has connected atleast
once.
The reason I need to create new TcpChannel every time server is
started is that the user can decide which port the server listens. So
the user can start the server with port 9000, stop the server, change
port to 9001 and start the server again. Or it can just stop and start
the server with the same port for some reason.
So how can I design the server so that it can be started and stopped
as many time as needed? Can I change the port in the created
m_TcpChannel without creating a new instance of it everytime?
Any help will be highly appreciated.
Thank you
|
|
|
|
|
At first glance, it would seem the problem is that you're not closing the first TcpChannel . When you instantiate a new one, the first TcpChannel remains active until the GC finalizes it - assuming nothing else is referencing it. This will happen when 1) your machine is idle, 2) when memory is or is nearly exhausted, or 3) when you call GC.Collect (not a good idea since this is a synchronous (i.e., blocking) call that may take a while). Be sure to call TcpChannel.StopListening .
You actually shouldn't need to re-allocate the channel, though. IF the remoting object is not listening the channel does nothing. You would have an open port, but a port that goes no where. Just something to consider.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|