|
HI,
i want to call a hook function to a particular window . when the window is activated then hook function must be called. If the window is disabled then we have to unhook the keyboard.
PLZ iam trying for this from longtime...........
PLZ if let me know the solution to this with the help of you..........
pradpb999@gmail.com
pradeep kumar
|
|
|
|
|
I wan to display a login window. if credentials are good then the main form will be dispalyed.
any help is greatly appreciated
|
|
|
|
|
Hi friends:
How specific in a OLDB connection the min and max size of a pool of connections ?
thanks in advance
|
|
|
|
|
Hi,
I am developing a simple windows mobile application with several Forms. all Forms have similar basic structure. e.g. with StatusBar and same menu.
what is the best way to impliment it other than creating completely different forms as required? i tried to create an abstract Form but then i cannot design it in VS.
will really appreciate.
rnv
|
|
|
|
|
Just don't make the form abstract. You should be fine from there. You will probably have to toy with private vs. protected properties to make sure you can adjust things as needed on child forms, but this isn't really a problem. Sometimes you will find it odd to work this way in your child pages, but there are ways around any oddities. I've done this playing around, but never implemented anything with that structure.
Best of luck!
Michael Flanakin
Web Log
|
|
|
|
|
thanks, but will really appreciate if you can provide an example to start with.
regards,
rnv
|
|
|
|
|
All you really need to do is create a form and set your default properties. When you create a new form, use the "Add Inherited Form" option in the context menu. That's all. When you add controls to the parent form, set the visibility to protected , instead of private . That will allow child forms to modify them.
Michael Flanakin
Web Log
|
|
|
|
|
Thanks, but...
first of all ... happy new year 2006
here is what i did.
i created a base form.
and created an new item 'inherited form' and pointed to the base form to be interited. is that what u meant?
if so then, the problem is i cannot design it in visual studio. is it so or i am doing something stupid.
regards,
rnv
|
|
|
|
|
What changes did you make to the base form? Try creating a new form and recreate your original incrementally, to see if there's something specific that breaks its designability. If your current base form is set as abstract , remove that. It doesn't have to be abstract and that could be what the problem is.
Michael Flanakin
Web Log
|
|
|
|
|
Hi there.
I am having some problems printing. I made a form with some Label controls and other stuff. The problem is when I want to print, only what fits to one page gets printed out but nothing outside of the first page. For instance, a Label controls has the coordinates 65, 1650 doesn´t get printed but is shows up on screen. I know about HasMorePages but I just don´t know how to use it. I just need to be able to print out two pages, the first one is no problem but the second one is a problem, it doesn´t get printed at all
Can someone please help me?
Thanks in advance,
FJ
|
|
|
|
|
Try this:
//Set the PrintDocument object property.
//This sets the pages to be printed
//Gets or sets the page number from which to start printing
printDocument1.PrinterSettings.FromPage = 1;
//Gets or sets the page number to which to print
printDocument1.PrinterSettings.ToPage = 2;
//This will print 2 pages from 1 to 2.
:->
|
|
|
|
|
Hi, thanks for your help.
Does this mean I don´t need to set the HasMorePages property?
FJ
|
|
|
|
|
Hi.
I just tried what you suggested but the outcome is still the same I do not know how to use the HasMorePages property. Do you have any ideas?
In the program the stuff that comes on the second page doesn´t have to appear on screen, it would be just fine to let it only be printed out after the first page which would contain what is on the screen.
Any help is appreciated.
FJ
|
|
|
|
|
Here is an simple ideea on how to use the HasMorePages property.
Declare a global variable that rembers the current page number (optional).
In your print procedure do the adecvate printing taking account of the page borders. If your drawing must go onto the next page (mening that you encountered the end of the page), set the HasMorePages to true and return from the proedure. Afther returning if the misterious procedure is setted to true the print procedure is called again with another page as an argument.
Yes, in this algorithm you must take account of the page numer (or any other relating element) in order to achive a desired result.
If you created an page number variable, before returning from the print method remember to increment the page.
Hope this helps.
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|
|
private void Document_PrintPage(object sender, PrintPageEventArgs e){
e.HasMorePages = true;
}
HTH!
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick || Fold With Us! || Pensieve || VG.Net ||
|
|
|
|
|
Hi.
I did try this but I couldn´t manage to make it work for some reason. I set the HasMorePages property to true after the printing code for the last item on my page. Then I added what I wanted on the second page and at the end of that code I set the HasMorePages property to false to stop the printing. Despite this my printer only prints out one page
What am I doing wrong?
FJ
|
|
|
|
|
Check this out:
http://www.devarticles.com/c/a/C-Sharp/Printing-Using-C-sharp/
|
|
|
|
|
Can we have a splitter between two panels. one panel's dock property is set to left and other ones set to fill. The splitter does not seem to work properly for the panels I suppose.
Any ideas on how to approach the problem would be appreciated.
Thanks,
VPMahank
|
|
|
|
|
I have run into this same issue. I resolved it by creating my own "splitter" (a very narrow panel control) and keyed off its mouse events (mousedown, mousemove, mouseup), then moved the affected panels accordingly.
Darryl Borden
Principal IT Analyst
dborden@eprod.com
|
|
|
|
|
Thanks for the idea Darryl. I will try it out.
Thanks,
VPMahank
|
|
|
|
|
I tried your suggestion. The idea works!!!. But the painting is not done neatly. I mean I have a inherited panel and I did set the styles to enable doubleBuffering. But using those panels would not paint properly when using the spiltter( I inherited splitter control from label and set the styles for this too). Please let me know if I am missing anything.
Thanks,
VPMahank.
|
|
|
|
|
Are you resizing your panels as you move your splitter? I did not do it that way.
I would allow the user to move my splitter (panel) then when they release I then resize the other panels.
I'm not sure what you did with "I inherited splitter control from label...". I just dropped a panel on my form, made it very narrow (so it looks like a splitter) and allow the user to click on it and drag it to the desired location and release it. At that point, I just resize the panels affected by the new location of the splitter.
Darryl Borden
Principal IT Analyst
dborden@eprod.com
|
|
|
|
|
You havn't described "How it doesn't work". I has used it and everything is expected.
|
|
|
|
|
Ok what I was doing was a little different. I was resizing the panel each time the splitter is moved. So the two panels were resizing each time the MouseMove of the splitter is called. The problem with this the panel resizing is not done smoothly as required.
I tried making a few changes to the code now. Relocating the splitter location in mouse move and relocating and resizing the panels in the mouseup.
Here is what I did. Please let me know if I can improve this anymore and allow a cleaner dispaly.
public class NoDockSplitter : Label
{
public NoDockSplitter()
{
// set styles to prevent flickering
SetStyle(ControlStyles.DoubleBuffer, true);
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyles();
}
protected void SetStyles()
{
this.BorderStyle = BorderStyle.None;
this.Text = "|";
this.TextAlign = ContentAlignment.MiddleCenter;
}
protected Control _leftSideControl;
protected Control _rightSideControl;
public Control LeftSideControl
{
get
{
return _leftSideControl;
}
set
{
_leftSideControl =value;
SetControlSize(_leftSideControl);
}
}
public Control RightSideControl
{
get
{
return _rightSideControl;
}
set
{
_rightSideControl =value;
SetControlSize( _rightSideControl);
}
}
protected bool _mouseDown = false;
protected bool _sizeSet = false;
protected int _leftSideControlWidth = 0;
protected int _rightSideControlWidth = 0;
protected int _rightSideControlXPos = 0;
protected int _splitterStartXPos = 0;
protected bool _widthSet = false;
protected int _diff = 0;
protected int _startXPos = 0;
protected void SetControlSize(Control c)
{
if(! _sizeSet )
{
this.Size = new Size( 4, c.Height);
_sizeSet = true;
}
}
protected override void OnMouseEnter(EventArgs e)
{
base.OnMouseEnter (e);
this.Cursor = Cursors.VSplit;
if( !_widthSet)
{
_leftSideControlWidth = _leftSideControl.Width;
_rightSideControlWidth = _rightSideControl.Width;
_rightSideControlXPos = _rightSideControl.Location.X;
_splitterStartXPos = this.Location.X;
_widthSet = true;
}
}
protected override void OnMouseLeave(EventArgs e)
{
base.OnMouseLeave (e);
this.Cursor = Cursors.Default;
}
protected override void OnMouseDown(MouseEventArgs e)
{
base.OnMouseDown (e);
_mouseDown = true;
_diff = 0;
_startXPos = e.X;
}
protected override void OnMouseMove(MouseEventArgs e)
{
base.OnMouseMove (e);
if( _mouseDown)
{
_diff = _startXPos - e.X;
this.Location = new Point(_splitterStartXPos - _diff, this.Location.Y);
this.Parent.Refresh();
}
}
protected override void OnMouseUp(MouseEventArgs e)
{
base.OnMouseUp (e);
if( _mouseDown)
{
_diff = _startXPos - e.X;
this.Location = new Point(_splitterStartXPos - _diff, this.Location.Y);
_leftSideControl.Width = _leftSideControlWidth - _diff;
_rightSideControl.Width = _rightSideControlWidth + _diff;
_rightSideControl.Location = new Point( _rightSideControlXPos - _diff, _rightSideControl.Location.Y);
this.Parent.Refresh();
}
_mouseDown = false;
}
}
|
|
|
|
|
My additional need was to have a splitter between controls that are not docked at all. So I need a control that behaves like a splitter but for undocked controls.
Thanks,
VPMahank
|
|
|
|