I have a winform, I define the Height to be 436 and the Width to be 470. I then display the mouse position in the title bar to check. What I expected to see is a value of 0 to 469 in the X direction when the mouse is over the form. What I see is that the maximum value in this axis is 459 and that the value changes even when the mouse is some distance from the form. I can bodge this to fit but it would be nice to be able to calculate the required size of the form to fit the controls. The height is not correct either. Could anyone point me to an explanation? This is created using VS 2017 on a Windows 10 PC. This is what the screen looks like as the X axis just stops changing, note the mouse position:
enter image description here
Forms have invisible borders. You can use margin instead of exact coordinates
Related
I've looked everywhere for a tutorial for this but had no luck.
What I'm trying to do is that lets say if a person has 10/100 XP I want it to show like a image progress bar.
You can make a bar for every one XP. You show them based on what they have. There aren't implemented features for progress bars.
Ill answer my 3 year old question as this post still receives views.
I'd advise using node-canvas as it's the best way to generate a buffered image to send.
Create a canvas (follow the tutorial via the README.md)
Set the width to something of your choice (ex. 500px)
Set the height to something of your choice (ex. 20px)
Calculate the percentage of the XP (ex. 10/100 would be .1 or 10%)
Fill the canvas with a height of the canvas, along with a width of the percentage (in decimal) multiplied by the width of your canvas.
Color the canvas that you filled to your choice (Should be prior to filling)
Enjoy your image generated progress bar!
I am trying to take a screenshot of a contents of a Windows Forms panel when the user clicks on the print button. I am using Graphics.CopyFromScreen with the parameter sourceX and sourceY will be the location of the panel corresponding to the parent control.
The issue is that when the user changes the Dpi or screen resolution, the X and Y coordinate for the location of the panel is different. So the screenshot image is cut off. Any advise ?
You have to work with screen coordinates, not relative coordinates.
Find Coordinates for point on screen?
I make Chart Report using SSRS
I have problem is my long series label not show whole text For Example
if label is "Personal Computer" it's show "Personal C......"
see image below
and this is whole Chart area
it's have more space between legend and series label I want to use this space to show whole text like this
How to fix this problem ?
Thank you.
Kindly Add the Legend on Right side of the Bar chart and Check
You need to fix the Chart Area height so that it is approximately half the height of the chart. This then allows sufficient space for the x axis labels.
You also nee to set the minimum and maximum font sizes for the x-axis.
I suggest between 6 and 8 pt.
Try setting the label rotation to 90 degrees instead of 45 also make sure the x axis interval is set to 1 and not auto.
[ Also have a look at this article ]
(http://www.douglane.net/fit-chart-labels-in-ssrs/)
I come from a WinForms background, so WPF is foreign to me. I am experimenting with it and trying to make a simple Hello World! application, except that the application displays different at runtime than how it is in the designer.
What I mean by that is I have a 'Hello!', and in the designer the location of the button is 12, 12, and and the Window is sized so that is the right/bottom edge of the button is 12, 12 pixels from the right/bottom edges of the window (so there is uniform 12 pixels around the button). When I run the application the button is still 12, 12 pixels from the top & left edges, but is 27, 27 pixels from the right/bottom edges of the Window. I have verified that the button dimensions are correct (I took a screenshot and measured the button in Adobe Photoshop and verified that the button width & height in the XAML code was the same as what was displaying on the screen). The Window is what is growing bigger.
I also verified it was not the canvas getting bigger by explicitly setting the width & height, changing the background color, and setting horizontal/vertical alignment to left/top. So when I ran it again, the canvas stayed the same size, but the Window still had an extra 15 pixels on the right/bottom.
I have tried Googling & searching here for this problem, but can't find an explanation as to why runtime is different from the designer.
I should note I am using Visual 2010, and I am using a simple for the layout.
Anyway, thanks for any clues as to why I am getting 15 extra pixels.
(Note I'd post a screenshot, but as a new user I'm not allowed).
You can use a tool like Snoop to diagnose this. It should allow you to inspect the entire visual tree of your application, and determine which UIElement is responsible for the extra pixels.
I'm working on a Windows Form in VB.NET 2005 and I would like to have some buttons with images (I'm talking about the plain, vanilla System.Windows.Forms.Button). I have everything set up the way I want it but the images are displaying too low on the button, such that the bottom of the icon is almost right on the bottom of the button and there is a lot of space above the image.
Here is a screenshot:
Button Screenshot http://www.freeimagehosting.net/uploads/b28a5c63b8.jpg
See how the corner of the icon is brushing up against the bottom of the button?
My button is 23 pixels high and the image is a 16 x 16 icon (converted to a bitmap so that it can be assigned to the button's Image property).
I've tried setting the button's Margin.All property to 0, and verified that the Padding.All property is 0. I've also tried changing the button's ImageAlign to TopLeft, MiddleLeft, and BottomLeft, but none of those settings seem to have any affect.
Does anyone know how I can position the image to be of equal distance from the top and bottom edges of the button? I can resize the button or the image if necessary but they are at my preferred size and I would like to keep them that way if possible.
I just encountered a similar problem, which I was able to solve by thinking really hard. (Ain't those situations great?)
The explanation
First it's important to understand that ImageAlign does NOT mean where on the button do you want the image. It means what point (pixel) on the image should be used for positioning. So if you pick "TopLeft", then the top-left-most pixel of the image will be vertically CENTERED on the button.
The problem comes in when you have a button with a centered image, whose ImageAlign is set vertically to "center", and whose dimensions are of an even number of pixels. Your image is 16x16 pixels- 16 is an even number. The middle pixel would theoretically be somewhere between pixel 8 and pixel 9. Since there is no pixel 8.5, VB rounds down to 8, thereby using pixel 8 as your positioning pixel. This the root cause of your unwanted upper margin.
Your button has an odd pixel height (23px) which means it has a true center pixel- pixel 12. VB tries to position the image's center pixel (8) on top of the button's center pixel (12). This puts 8 of the image's pixels BELOW center, and 7 pixels ABOVE center. To even things out, a 1-pixel margin appears above the image.
The solution
Pad the image with 1 extra row of pixels on the bottom. The image now has a height that's odd (17 px), giving the image a true center pixel which can line up perfectly with the button's center pixel.
That's how I solved the problem for myself. However, a simpler possible solution just occurred to me. You could probably achieve the same result by assigning the image a bottom margin of 1px. I have not tested this solution but it seems theoretically equivalent to the first solution.
Additional note: Two objects of EVEN dimensions should theoretically be able to center-align perfectly. But strangely enough, the alignment problem occurs even if the button AND the image BOTH have even dimensions. (Apparently the compiler is not consistent in the way it determines the center pixel of one control vs another.) Nonetheless, in this case, the same solution applies.
Typically, we'll set the following properties (for an image on the right, for example):
ImageAlign: MiddleRight
TextAlign: MiddleLeft
You'll want to align both the text and image in a similar fashion. Outside of that, make sure that you are setting the Image property, not the BackgroundImage property and make sure you are doing the icon to plain bitmap conversion properly. Have you tried a plain bitmap file?
Just a question: are you positive that the bitmap contains no information on the top of the note image? I have had that happen to me more than once where a crop looked right in Photoshop and came out incorrect in the live code... :)
If that were the case your code may be perfect ;)