|
do printing in .net in c# lang?
I have already used crystal report viewer,but it seems can't print on non-standard papers?
Thanks.
this is my signature for forums quoted from shog*9:
I can't help but feel, somewhere deep within that withered, bitter, scheming person, there is a small child, frightened, looking a way out.
|
|
|
|
|
http://msdn.microsoft.com/msdnmag/issues/03/02/PrintinginNET/default.aspx
|
|
|
|
|
print reports in non-standard papers,I find that I must select one kind paper,but I want to print on non-standard printer papers.(I mean not print on one paper,but a pack of papers)?
Thanks.
|
|
|
|
|
iam making my console app a little bit more feature filled.. its working out fine...but my question is how can i change the color of key words (such as echo) i want any text with in these arrows(<text here="">) to be turned to the color red how can i do this within my richtext box field.... i already have keypress event args set up and i can allready tell the program what to do when the word "<echo>" is entered,ect.. but im strugling on how to do this . here is the list of all my commands. Any samples would be great.
RichTextField.Name = UserInput;
echo,cls,copyright,?,help,consolesave,consolehide,consoleshow,consoleclose
jesse M
The Code Project Is Your Friend...
|
|
|
|
|
In C#lang,how to do that?If it's a so simple and easily searchable problems,please don't blame me.Thanks.
.rpt file has a SQL stored procedure query that has 3 params,I want to pass values in program,how to do that?
|
|
|
|
|
From within your form containing the progress bar.
ProgressBarEx pbar = new ProgressBarEx();
pbar.Width = 200;
pbar.Height = 200;
pbar.Location = new Point(0, 0);
Controls.Add(pbar);
MyDUMeter: a .NET DUMeter clone
|
|
|
|
|
ALL of carlos's cool controls contain sample applications that show how to use them...
Had me stumped just a bit as well when I first started trying until I realized that his controls don't have designers (don't show up in the tool box) so you have to load them manualy in the code.
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
|
|
|
|
|
Hi, I'm new to .NET and I'm writing an application that is using the TabControl , and I'm having trouble finding a method or property that will tell me what specific TabPage was clicked when the TabControl is clicked. In the Click event for the TabControl is it possible to tell what TabPage was clicked? I can't seem to find any property or method that would give that.
Another question. Is there any type of event for the TabControl or TabPage that is similar to the Load event for a Form ? What I'm looking for is an event that would fire the first time a TabPage was clicked and then never again until the program was closed and opened.
Any help is much appreciated.
- monrobot13
|
|
|
|
|
monrobot13 wrote:
I'm having trouble finding a method or property that will tell me what specific TabPage was clicked when the TabControl is clicked. In the Click event for the TabControl is it possible to tell what TabPage was clicked? I can't seem to find any property or method that would give that.
Register the Click events for each tabpage instead all pointing to one delegate. Then in the delegate method do a cast to TabPage for the object sender parameter.
MyDUMeter: a .NET DUMeter clone
|
|
|
|
|
First, Thanks for the reply.
Second, This is the approach I would have taken but I using the webbrowser control on the tab and it's set to take up the entire size of the page. I want the webpage to load when the tab is clicked I don't want the user to have to click the actual webbrowser page for it to load.
- monrobot13
|
|
|
|
|
To determine which TabPage is currently selected, look at the TabControl.SelectedIndex property, and to catch when a user selects a different TabPage, subscribe to the TabControl.SelectedIndexChanged event - watching Click events is not the way to do it with the TabControl.
There is no Load type event for a TabPage, but there are a number of ways to do what you're looking for.
Create booleans to flag whether each tab has been "loaded"; e.g.
bool tabPage1Loaded = false;<br />
<br />
void OnSelectedIndexChanged(object s, EventArgs e)<br />
{<br />
if(tabControl.SelectedIndex == 1 && !tabPage1Loaded){<br />
tabPage1Loaded = true;<br />
}<br />
}
Or, if your tab pages are created dynamically and hard-wiring booleans would be impossible or just messy, just create a new class derived from TabPage and add a "Loaded" property to it.
Hope this helps
|
|
|
|
|
Again thanks for the reply.
This sounds like a good approach I just have a question. Is it possible to get a reference to the actual TabPage from the selected index? ie. could I just use it as the index in the tabs collection for the TabControl ?
Thanks again
- monrobot13
|
|
|
|
|
monrobot13 wrote:
. could I just use it as the index in the tabs collection for the TabControl?
Yep, sure can.
|
|
|
|
|
Sounds good.
Thanks again.
- monrobot13
|
|
|
|
|
Hi,
how to break a line of text ? The only way i found out is to use the <p></p> tag, but i guess that only works cause i use NDoc to generate Html based Help Files, what about another generator format like RTF ? Guess the <p> tag is exported as normal text, and not interpreted as line feed.
Which solution is clean ?
.:Greets from Jerry Maguire:.
|
|
|
|
|
|
seems like my html tags are eaten by html
.:Greets from Jerry Maguire:.
|
|
|
|
|
Jerry Maguire wrote:
Which solution is clean ?
There is a para tag which can be used for creating paragraphs.
If you search MSDN for 'XML documentation' you should see a section which tells you what tags are available for use.
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
hi,
I have a datagrid which has obviously rows and cols.
I am placing a usercontrol on top-of-it. now when I move that
usercontrol it should be only movable with in certain area.
to be more specific I want to know
what is the area starting from the first visible row/col
and last/bottom visible row/col so that I can compute
that area and can't let the user move beyond that control
Paresh
|
|
|
|
|
Hi,
I am trying to setup a custom baud rate of 12000 but when I use the SetCommState() I get an error message telling me to review my set. However, any custom baud rate below 10000 will be set and work properly.
What is wrong? I need to use custom baud rates above 10000!
I have attached a sample program that anyone can use to test it.
Thanks
<code>
// *********************************************************
// A program that demonstrate the custom baud rate problem *
// *********************************************************
#include <windows.h>
#include <stdio.h>
#include <lmerr.h>
#include <stdlib.h>
void DisplayErrorText(DWORD dwLastError); // show last error
// message
#define RTN_OK 0
#define RTN_USAGE 1
#define RTN_ERROR 13
int main(int argc, char *argv[])
{
DCB dcb; // structure that hold all COM parameters
HANDLE hCom; // handle for the COM port
BOOL fSuccess; // to hold fail/success results
// test if 2 parameters has been supplied in teh command line
if (argc <= 2)
{
printf ("Please enter a COM port and the new baud rate in the command line.\n\ni.e.: porta COM2 1000\n");
return (1);
}
// Open the COM port
hCom = CreateFile( argv[1], // open the COM specified on teh command line
GENERIC_READ | GENERIC_WRITE,
0, // must be opened with exclusive-access
NULL, // no security attributes
OPEN_EXISTING, // must use OPEN_EXISTING
0, // not overlapped I/O
NULL // hTemplate must be NULL for comm devices
);
// test if open COM was ok
if (hCom == INVALID_HANDLE_VALUE)
{
// Handle the error.
printf ("CreateFile failed with error %d. ", GetLastError());
DisplayErrorText(GetLastError());
return (2);
}
// Build on the current configuration, and skip setting the size
// of the input and output buffers with SetupComm.
fSuccess = GetCommState(hCom, &dcb);
// test if getting the com state was ok
if (!fSuccess)
{
// Handle the error.
printf ("GetCommState failed with error %d. ", GetLastError());
DisplayErrorText(GetLastError());
return (3);
}
// Print previous baud rate for the specified COM port
printf ("\nThe baud rate of %s was %d.\n", argv[1], dcb.BaudRate);
// Fill in DCB with supplied bps, 8 data bits, no parity, and 1 stop bit.
dcb.BaudRate = atol(argv[2]); // set the baud rate
dcb.ByteSize = 8; // data size, xmit, and rcv
dcb.Parity = NOPARITY; // no parity bit
dcb.StopBits = ONESTOPBIT; // one stop bit
// set the COM port with the new parameters
fSuccess = SetCommState(hCom, &dcb);
// test if setting COM port was ok
if (!fSuccess)
{
// Handle the error.
printf ("SetCommState failed with error %d. ", GetLastError());
DisplayErrorText(GetLastError());
return (4);
}
fSuccess = GetCommState(hCom, &dcb);
// check to see if new baud rate has been set
if (!fSuccess)
{
printf ("GetCommState failed with error %d. ", GetLastError());
DisplayErrorText(GetLastError());
return (5);
}
// Print current baud rate
printf ("\nNow it is %d.\n", dcb.BaudRate);
return (0);
}
// *******************************************************
// Simple routine to show the error messages description *
// that is really useless!!! *
// *******************************************************
void DisplayErrorText( DWORD dwLastError )
{
HMODULE hModule = NULL; // default to system source
LPSTR MessageBuffer;
DWORD dwBufferLength;
DWORD dwFormatFlags = FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_IGNORE_INSERTS |
FORMAT_MESSAGE_FROM_SYSTEM ;
//
// If dwLastError is in the network range,
// load the message source.
//
if(dwLastError >= NERR_BASE && dwLastError <= MAX_NERR) {
hModule = LoadLibraryEx(
TEXT("netmsg.dll"),
NULL,
LOAD_LIBRARY_AS_DATAFILE
);
if(hModule != NULL)
dwFormatFlags |= FORMAT_MESSAGE_FROM_HMODULE;
}
//
// Call FormatMessage() to allow for message
// text to be acquired from the system
// or from the supplied module handle.
//
if(dwBufferLength = FormatMessageA(
dwFormatFlags,
hModule, // module to get message from (NULL == system)
dwLastError,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // default language
(LPSTR) &MessageBuffer,
0,
NULL
))
{
DWORD dwBytesWritten;
//
// Output message string on stderr.
//
WriteFile(
GetStdHandle(STD_ERROR_HANDLE),
MessageBuffer,
dwBufferLength,
&dwBytesWritten,
NULL
);
//
// Free the buffer allocated by the system.
//
LocalFree(MessageBuffer);
}
//
// If we loaded a message source, unload it.
//
if(hModule != NULL)
FreeLibrary(hModule);
}
</code>
|
|
|
|
|
First of all, I think you're in the wrong forum. This is the C# forum and you have posted C++ code. Second, there are several articles on CP in which other people have done all of the hard work for you. Just use their classes and you won't have to go through the headaches these folks have already endured. To name a few articles:
Serial library for C++
By Ramon de Klein (I've personally used this one and I think it's great)
CSerialPort v1.03 - Serial Port Wrapper
By PJ Naughter(This one has a high score, so I can only assume that it has been useful to many people)
Good luck and best regards.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
I was just wondering if anyone knew how to create a command window or console as found in VS.net?
I have had a look arround and there dont seem to be any tutorials or even any references to them. If there arnt any examples does anyone have any hints or tips on creating one?
Thanks
Tim
|
|
|
|
|
You're question is a little confusing. Are you asking how to make a console application (i.e. an application with no graphical UI)? What command windows/console in VS .NET are you referring to?
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
i dont want to make a console application i want to make a windows application with a console in it (as seen in VS.net if you go... View> Other windows> Command Window. or on the keys... Ctrl+Alt+A)
I will use the console in a seperate window to my main app to perform some program specific functions and to allow users to write and run scripts of multiple operations.
Hope this helps clarify things?
|
|
|
|
|
I see. OK. Well this really depends are your exact needs. Frankly, I'm not sure how they implement the expanding and contracting thing because I've never tried it (and I know that that is not what you're concerned about), but it occurs to me that no matter how you implement your user interface (e.g. splitters, separate windows, etc.) as long as you have a way of getting input (e.g. a text box), you should be able to just read the commands whenever the enter key is pressed inside of that edit area. This probably doesn't really help you much, but I guess I'm not sure what the big mystery is. I'm probably over simplifying, so tell me what else I need to know to get to the heart of the issue.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|