|
Hi,
IIRC WebBrowser.DocumentText=string; is to HTML what RichTextBox.Rtf=string; is to RTF.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
That makes it very easy! Thanks, Luc.
|
|
|
|
|
you're welcome.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
With VB.net, is there a way to get at the individual pages in a printpreviewcontrol? I need to create bitmaps of each page but thus far I've only been able to get the last page. Draws perfectly, but I've not been able to get all the pages. I need to reproduce each page exactly as it appears in the control so I can save them as frames in a .tif file.
Any suggestions are appreciated. Doesn't have to be via the PrintPreviewControl as long as I can get the images.
|
|
|
|
|
Hi everybody
i have a user control with me. And when i drag it on to a form and trying to resize it using my mouse the controls present inside the usercontrol are not effected and so when i decrease the size at an edge the controls that are present at that edge r becoming invisible....
I read that this can be done using the anchor property.
By default the anchor property is set to left and top. and if we make it as all(left,top,right,bottom) then we can achive the resizing...
But its not working in my case..
Actually what i am asking is if i am reducing the usercontrol size all the controls present inside the user control should reduce proportionately...so that every control will be visible..
This is the problem when resizing at design time
Now coming to the runtime.
Actually, my user control contains two panels.One below the other and a button on the 1st panel. On alternate button click the second panel will be visible and invisible accordingly.. Now when i place the same user control one below the other in a form,and in the 1st user control when panel2 became invisible there will be a space between the usercontrol1 and usercontrol2 so i dont want this, thats why i want the usercontrol2 to move up when ever panel2 in the usercontrol1 is invisible, and when it is made visible again usercontrol2 should move down..
I read that this can be happened by making the docking property to true of both the usercontrols to top but even then i am not able to achieve what i need. because the size of the user control is not changing and so even if we use the dock property the usercontrol2 is not moving up...
Can any one help me sorting out this problem.....
|
|
|
|
|
honey.rpk wrote: I read that this can be done using the anchor property.
honey.rpk wrote: But its not working in my case..
Say, you have a panel containing a textbox in a form. If you anchor the textbox, it is with regards to the Panel's boundaries. And if you forget to anchor the Panel, all the effect is lost. Check if you have done something similar.
I would recommend using TableLayoutPanel to place the controls. That would really help in doing anchoring docking stuff.
You can avoid this moving up and down of panels by placing them at the same location and then toggling the visibility on button click.
|
|
|
|
|
If I interpret your recent posts correctly, you are trying to design what is generally called an 'Explorer Bar', like the left hand pane when you open MyComputer. If I am correct, take a look at Windows XP style Collapsible Panel Bar[^]. If I am wrong, please ignore this post.
There are lots of examples of this type of control, both on CP and on the 'web generally. Just search, either in CP Articles Search Bar or Google or Bing, for explorerbar.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi Henry Minute
You are correct to some extent.
I need a control of almost an explorerbar but what i need is in a explorer bar i can not add any controls to the header, i can just change the text of that. But i need a control which works like an explorer bar but with an extra feature of holding some controls of any type(eg.. Button, panel, textbox).
I think you got the point what i my aim is to do...
If not i will explain you some more detailed an clear manner... if you come back to me..
Thanks & Regards.....
|
|
|
|
|
honey.rpk wrote: But i need a control which works like an explorer bar but with an extra feature of holding some controls of any type(eg.. Button, panel, textbox).
The reason that I pointed you to the article that I did, and gave you a search term is that those controls all perform the collapsing of the panels and moving the others to remove the empty spaces. All you have to do is to use the panel control that you already have and the code for avoiding excessive empty space from the ExplorerBar and put them together.
If you have any hopes of becoming a programmer this is the sort of thing that you must learn to do.
If you cannot follow the code in the link I gave, do a search, pick one or two of the others and work through the code in them. After that you should at least have some idea about how to do it, then have a go at building your own.
I'll give you a clue: In most of them it is the Bar that holds the panels that moves the panels. There is nothing to stop you from allowing these bars to hold other controls.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
|
What problems are you having while trying to do this? I don't think many are going to just hand over complete code, but if you cite a specific area where you are having issues, and show some problematic code, then you may get more help.
Also, if you are just trying to open a file from a server then why are you using a web service? I would think you can configure things to just open the file directly. BUT, keep in mind that a file that is 1GB is size will be ridiculously slow to open over a standard Internet connection. In this case a web service MAY help if you can open the file on the server side and send the content up to the client in chunks. However if you plan to have multiple people access this file, and you need to be able to do updates and stuff, then you will more than likely have some concurrency issues.
Perhaps some more detail about what you are trying to ac hive is also a good thing.
|
|
|
|
|
My friends,
I request u to help me in sorting out a solution for a usercontrol made up of two panels.I like to implement expandable and collapsable features to usercontrol.So that the child controls or usercontrols placed below it should shift upwards and downwards along with the shift of usercontrol.
In the same usercontrol,if i want to resize the usercontrol at design time.how can i do it?
|
|
|
|
|
There are remarkable similarities between your post and this[^] one here.
Looks like a case of multiple user id of same person to me.
|
|
|
|
|
No i dont know why this is happening i dont know who is mahi@swetha...
actually i have been given a work to develop some thing similar to xpexplorerbar but with an extra option of the header holding controls... thats it i dont know about his work....
|
|
|
|
|
See my reply to honey.pk, a couple of posts above this one.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Mr.Henry,
Thanks for the reply.I viewed ur reply to honey.rpk about my posted thread.But what i need is that i want implement expandable and collapsible features without the use of dock property by which i am able to sort out issue.Also, I saw ur sent link about windows explorer bar or collapsible panel bar few days back itself.Apart from this,We were finding trouble in viewing design part of either of the bars because they are developed using earlier versions of Visual studio.
So,please help me in sorting out this problem.........
Thanks,
With regards,
Mahi@swetha.
|
|
|
|
|
When solutions and projects are built in earlier versions, your current version will convert them very easily. Just follow the wizard. If they will still not convert then use the CP search, Google or Bing to find other, more recent versions.
Stop trying to get other people to do your work for you and buckle down to doing some yourself!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Mr.Henry,
Please dont mistake me to reply u like this.Everytime,u use to reply me more or less like this "Stop trying to get other people to do your work for you and buckle down to doing some yourself!".Iam just posting the thread as iam failed in taking few measures.Bye,Here after,I wont post threads.Thanks for ur suggestion.
|
|
|
|
|
Please do continue to post here. But when you post say "Here is some code I have written. It was supposed to do this but it does that instead, can anyone see what is wrong?" and if the code gives an exception point out the line with the exception and the exact wording of the exception.
You rarely post code, or when you do you post yards of it, no one is going to read all the way through it. You just keep asking "How do I do this" and when people give you links to help you you keep coming up with reasons why you cannot use them.
The only way to learn programming is to do it. So do that, write some code, then ask questions when it goes wrong or just plain doesn't work. But only after you've tried to fix it yourself.
If you are a real beginner, then get some beginners books (there are plenty of free ones on the 'web) and work through them. After that download some source code that does approximately what you want to do and keep working through it till you understand it enough to have a go yourself.
Good Luck!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi Folks,
My project Structure like below
(Solution)Solution Name
+ ProjectName (Test)
+ Form1.cs
+ Form2.cs
+ Library Project(UI Layer)
+ Usercontrol1.cs
+ UserControl2.cs
how can i call Form1.cs from UserControl1.cs
Thanks & Regards
Nath
|
|
|
|
|
The user control should raise events that the Form (or some form manager class) can subscribe to - much the same as when you put, say, a button on a form. The button doesn't know about the form, but the form responds to the buttons' events but only the ones that it has requested to be informed about.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Using VB.net...
I'm trying to size an in-memory bitmap to fit the text from a textbox. My steps are:
1. Get the height of the font (Font.Height) in the textbox.
2. Get the number of lines in the textbox.
3. Multiply the font height by the line count
4. Size the bitmap to textbox.width and font.height multiplied by the line count for the height
5. Create a rectangle sized to the bitmap
6. Draw the text in the bitmap within the rectangle
7. Set a picturebox's image property to the bitmap (picturebox sizemode set to autosize)
This works fine IF the textbox doesn't have a scrollbar. If it's a long text file, the image is only about half as tall as it needs to be.
Here's my code (RichTextBox named "rtf"):
Private Sub tb_Draw_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tb_Draw.Click
Dim fh As Integer 'font height
Dim cw As Integer 'rtf.width
Dim ch As Integer 'rtf.text height
Dim lineCount As Integer 'rtf.lines.length
Dim bmp As Bitmap
Dim g As Graphics
fh = rtf.Font.Height
cw = rtf.Width
lineCount = rtf.Lines.Length
ch = lineCount * fh
rect = New Rectangle(0, 0, cw, ch)
bmp = New Bitmap(cw, ch, Imaging.PixelFormat.Format32bppArgb)
g = Graphics.FromImage(bmp)
g.FillRectangle(Brushes.White, rect)
g.DrawString(rtf.Text, rtf.Font, Brushes.Black, rect)
picbox.Image = bmp
End Sub
The textbox only uses a single font.
What am I doing wrong?
|
|
|
|
|
I am having trouble with the getModuleFileNameEx api call in a VB.net application. It will not return to me the filepath of the currently active window. Any idea what i am doing wrong?
nextWnd = GetForegroundWindow()
' Gets title and path of the active window
GetWindowText(nextWnd, lpString, lpString.Capacity)
GetWindowThreadProcessId(nextWnd, procID)
modTest = GetModuleFileNameEx(procID, nullWnd, lpFileName, 500)
Thanks,
John
|
|
|
|
|
I'm not sure - I don't do VB. The following works in C# though to get the path of the executing assembly's process
StringBuilder builder = new StringBuilder(500);
uint modTest = GetModuleFileNameEx(Process.GetCurrentProcess().Handle, IntPtr.Zero, builder, 500);
Console.Write(builder.ToString());
[DllImport("psapi.dll")]
static extern uint GetModuleFileNameEx(IntPtr hProcess, IntPtr hModule, [Out] StringBuilder lpFilename, int nSize);
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Ok,
After trying the code that you gave me (in a VB.net form), I get the same problem I always get:
When i output the stringbuilder object that should be holding the file path, I get 'Ÿ' followed by the title of the window. And it'll only show up for the first click of the button. So stumped.
Thank you for the help though,
~John
|
|
|
|