|
Great! Happy to help
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
I have a custom control and am painting a custom border, how do i paint this outside of the bounds of the control from within the control itself. It's just a custom panel so its a straight rectangle.
|
|
|
|
|
It's possible to do, but you shouldn't do that. The entire control is supposed to go inside the bounds of the control, including any border.
The Graphics object that you get in the Paint event is clipped to the bounds of the control or the part of the control that needs redrawing. If you draw outside this clipping, you risk drawing on top of other windows.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
yes but because the control contains other controls the border appears under them, or how do i draw over the top of all controls in the control remaining inside the bounds.
|
|
|
|
|
Override the OnPaint method so that you can do your drawing after you call the OnPaint method of the base class.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
Did that. Still not working. I can't seem to just draw a rectangle straight over the top of everything in my control, even if i paint it after on paint. How do i make things i paint out of the control's bounds visible?
|
|
|
|
|
Hi, have a look at the ControlPaint class, it allows you to paint anywhere on the screen!
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Thankyou this was very useful. Now...you wouldn't happen to know the best way to change the client area would you?.
I need it to behave similar to a form in the sense that we can't place a control on or under the title bar but we can put it anywhere else on the form. I need to just redefine the client area location and width. Howe can i achieve this?
|
|
|
|
|
Hi,
The ANZAC wrote: I need to just redefine the client area location and width.
Well you can set a new ClientSize, but I guess it just resizes the entire Form.
I have never tried to create a different Form layout. If I were to need such thing
I would try this:
- create MyForm class inheriting from Form;
- probably select a very simple BorderStyle (maybe None);
- organize the painting of the non-client area (border, title bar, close box, whatever);
- override some properties such as ClientSize, ClientRectangle, ... (and maybe a whole lot
more);
- and hope the majority of properties and methods can remain unchanged.
I do not plan to try this on XP. And I hope I will never need to do it on Vista,
although I am pretty sure I will not like transparant title bars...
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
well it's a panel not a form, problem is the clientsize is readonly and not overridable (i don't think) only overloadable. I wouldn't need to do this if i could just figure out how to paint outside my controls bounds.
|
|
|
|
|
As useful as this was it still doesn't let me draw outside the bounds of my control, it just cuts it off.
|
|
|
|
|
I once tried ControlPaint.DrawReversibleLine and dropped it since it ignored
all windowing, so when applied to a window that was partly covered by something else
it was painting over that something else, what I did not want at the time.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Well i can't get it to paint outside my control, then again i am caling it from within my contro, don't know if this should make a difference, but i certainly can't draw anywhere on the screen.
|
|
|
|
|
There seem to be two kinds of drawing methods in ControlPaint:
- the ones working on the screen, using screen coordinates, ignoring all windows, just
painting everywhere;
- the ones needing a Graphics; now a Graphics always has clipping built-in, that's one of
its features (did you ever care about a DrawString exceeding the width of a Control?).
As another reply already told you, you (theoretically) cannot make a Control's OnPaint
paint outside the Control, i.e. you must set the Control's Size large enough so it contains
all the areas where you want it to paint something (that's how non-rectangular Forms
basically work, as far as I can tell from reading some articles, I am not really in to this).
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
|
Hello
I develop an aplication where i need to use the crystalreport for displaying the data.
The data i want to display in the crystal report is on the data set, this data set is created and filled in runtime.
How i can tell the crystal report to take the data from this dataset
Any hint or example wil gratly appreciated
Thanks in advance
Assaf
Assaf
|
|
|
|
|
This code will help you:
CrystalReport.DataSource = Dataset.Tables("TableName")
and you are done !
Hope it helps !
AliAmjad(MCP)
First make it Run THEN make it Run Fast!
|
|
|
|
|
hi dears,
how can i make a switch with serial ports, that mean when i connect two pins (for example pin 2 with pin 3) , program run a code
|
|
|
|
|
Ok,
If i understand you correctly on this, you're trying to switch something, say a LED or a device using the PC serial port. Nice plan but unfortunately the serial port doesn’t work like that!
The serial port is a communications device and simply used to send ASCII data to and from the PC via some software. The good thing is there is plenty of help on the serial port to help you achieve this. Microsoft have thankfully included a class from the serial port in VS 2005 see http://msdn2.microsoft.com/en-us/library/system.io.ports.serialport.aspx[^]
Now the serial port, well in a very simple cut down way is capable of doing anything you want, however you will need to implement additional electronics to achieve this.
When data is sent to the serial port, depending how its configured by baud rate etc, the signal is in a eight bit stream hence its name, this simply means any data sent to the port would look like a train of 1's and 0's. If you send the character 'A' the code would simply translate this to the ASCII value '65' which is '1000001' is binary
This is simpler to understand if you write a comms application between two computers.
The electronics would have to be a microcontroller of some description, PIC16F84 is good for beginners. The serial port could be coupled together with a MAX232 IC inteface directly and connected to the PIC16F84. This would be a very simple circult and probably thousands of web links to it. The Microcontroller can be programmed to respond to anything to demand, turn on a led or a relay etc.
http://www.boondog.com/tutorials/pic16F84/pic16f84.html[^]
Have Fun!
|
|
|
|
|
Hi,
a serial port has two data lines (one input, one output) that carry the data bits in a
serial fashion; it also has some control lines, some of them are inputs, other outputs.
Look for names such as DTR, DCD, RING, RTS, ...
1. If what you need is the app controlling some output:
Once you opened the serial port, you can control the state of those control pins that are outputs.
Warning: the voltages on those pins COULD be anywhere between plus and minus 15V with
respect to the ground pin (GND); and should switch at least between plus and minus 5V.
Also the load you are allowed to connect is limited (don't know the numbers by heart).
So you could connect an LED (with appropriate series resistor, to limit current to
say 15 milliamps) between a control output and GND, and turn it on/off by setting the
corresponding property. If you need to control a higher current you will need either
a relay or some electronics.
2. If what you need is the app responding to some input:
once you opened the serial port, your app can observe (or get PinChanged events) from any of
those control pins that are inputs.
Warning: the voltages you apply to those input pins MUST be between plus and minus
15V (with respect to GND) in order to not damage the hardware, and outside minus and plus
3V to be unambiguous.
For more info on serial ports, there are a couple of articles on CP, such as this one.[^]
-- modified at 20:57 Saturday 10th November, 2007
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Can someone help me on how can I make a program in visual basic 6 that manipulates the disk quota of a particular drive? or perhaps, get the total size of a subdirectory?
|
|
|
|
|
Hello all!
If an object has a member, who's name was not known but only stored in a string, how could I access that member?
Thanks in advance,
Fahad Sadah
New freeware site underway!
|
|
|
|
|
What you exactly mean by this question??? How come an object has a member who has no name ! and if it is then what you think intelliSense is for? and didn't understand yet what you exactly trying to ask.
AliAmjad(MCP)
First make it Run THEN make it Run Fast!
|
|
|
|
|
AliAmjad wrote: How come an object has a member who has no name !
He didn't say the object's member had no name. He said the name was stored in a string.
|
|
|
|
|
Thanks for correcting me man ! but can you please explain it a bit "object has a member, who's name was not known but only stored in a string" I still don't get it.
AliAmjad(MCP)
First make it Run THEN make it Run Fast!
|
|
|
|