I have a web browser in my win form
I'm filling it's content with some text for each time(text size in each loop almost the same size).
my web browser size is fixed
i want to aromatically fix my content text to browser content
(for example if my content text size is more than the web browser content with some algorithm fix it to content and do not show scroll)
exactly some algorithm that fix Css for each content size to web browser size
is it possible?(may be some thing like change text size for best fix or ...)
all you really need to do it wrap your text inside some DIV tag, and this will auto encapsulate the text in your DIV to fit the window.
I'm assuming you do not want the horizontal scroll bar, is that correct? Because you haven't specified, I'm just guessing. If it is the vertical scroll bar you do not want, then let me know.
Otherwise, if you're text input is being placed in many different areas, and you really need more global or generalized control over this, you can alter the WIDTH attribute in your BODY tag to ensure it is exactly, or a few pixels smaller than the width of your WebBrowser control.
So if your WB control width is 600, you would place this in your BODY tag of the HTML page you have loaded (i'm assuming you have access to the HTML page, if not, once again, let me know).
<BODY WIDTH="590">
Let me know how you go, and if I've totally missed or misunderstood your question, please let me know and add the details necessary so that we can understand what you need.
Cheers.
Related
if control's height over one paper size, control move next page...
I want to fix them where I positioning.
if they height over current page, cut over parts and showing next page cutted parts.
like this
does it can?
If you're dynamically building the report from code you can certainly do that.
For a report being built dynamically, you'll need to track the approximate sizes of the page as well as the individual control heights.
If the control would take up more space than the available space on the page, you can enter a page break.
You have complete control on the output if you use GDI+ to generate the report view.
Hope this helps.
What I want is change the font size in a text view to fit all of content onto the page while being as large as possible. The text in it is also changing in length so just testing won't work. I also don't want it to have to scroll, but it is a multiline text view. This is in C# and I can't list anything I've tried because I am unsure as to where I should start.
My program has several Label controls that are updated to have different text every so often. I have a few icons that I want to reference within the text. I figured that instead of just displaying "(E)" in the Label, there should be a way to replace that with the corresponding image that I have that looks like: . I figure that I need to override the Label.Paint event, but I'm not too sure how to do that properly. Every occurrence of "(E)" needs to be replaced with the image inline.
Example
Look for the (E) icon on the top. → Look for the icon on the top.
This is not a trivial exercise.
You'd have to provide a property on your derived label class to attach the image(s) to the text.
Embed some sort of token(s) in the text to represent the image(s).
In the OnPaint you have to parse the text for the token(s)
Do a graphics.MeasureString() for each bit of text between the tokens. And then render it with graphics.DrawString() move to the right by the width of the text, render the image based on the token using one of the many graphics.DrawImage() overrides - move to the right by the width of the image and repeat.
I was wondering what is the best way to print entire content of scrollable control. I was trying to print a control in several ways, however all the time I was only able to draw visible content of control. So far I tried to use
PrintForm // there is nothing I can do with this because it requires a form not a control
I was also trying to use controlName.DrawToBitmap() method however this function captures only the visible area of control.
What is the best way to draw this kind of controls ?? I would like to avoid scrolling control's content in order to capture all control's element.
I would suggest that you create an invisible to the end-user form (for examlpe, position it at (-10000, -10000) and this form should have the size enough to display the ScrollableControl without scrollbars. This way you will be able to workaround this problem.
I have a .NET windows form page and a WebBrowser component inside. I load a page inside the web browser using the Navigate method as in:
webBrowser1.Navigate("http://www.stackoverflow.com");
The pages length is longer than the browsers height, so the vertical scroll bar appears. Now I want to move the scrollbar down to a specific position.
More specifically I want to search for a specific peace of text inside the page, and scroll to that position.
This behavior is implemented in the built-in "Find" function of the browser, but I can't figure out how to call the Find function from within my code, without the Find window appearing.
Although I don't want the Find window to appear, if the text matches are highlighted it is welcome.
You could do it using anchors.
webBrowser1.Navigate("http://www.stackoverflow.com#myAnchor");
and in your html define this:
<a id="myAnchor" />
This is in itself not very flexible, but if you consistently add anchor tags to key structural parts of the html, you can always jump to the section, block, or div that you want.