How do I dynamically resize text in an edit box - user-interface

In Autohotkey, I have an edit that is a particular size. I would like to resize the text so that it displays in the visible area of the edit rather than wrapping it and having to scroll down.
Initially I was going to use StrLen("String") function, but that won't help as different characters will affect when the text wraps
String := "This string of text exceeds the visible... area"
font_size = 18
Gui, +AlwaysOnTop
Gui, Font, S%font_size%
Gui, Add, Edit, gText_Size vFr_Text X10 -Border center r2 W270, % String
Gui, Show
return
Text_Size:
;Find out if the text exceeds visible area
;if so Change font size
return

You can use the +Limit Option to limit the text to the visible space. You can add it to your code like so:
Gui, Add, Edit, gText_Size vFr_Text X10 -Border center r2 W270 +Limit, % String

Related

How to add patterns or stripes to SSRS data cells instead of a color

IN SSRS:
I can only add Solid color fills to the data cells inside a matrix.
How do I add Stripes or Patterns as background fill instead of a solid color.
Is there a particular color code like '#xxxx' for stripes?
There are certain rows in my report that need to have stripes or patterns as backgrou fill.
Thanks
I have found some methods around this:
1- You can use image gradients to fill text boxes by right-clicking the cell and selecting text box properties. You can use the Fill tab to select a small image or item that has a gradient or pattern and apply it within your cell(s)/report.
2 - Another approach is to use a combination of Font/Color/Bold/Italic/Underline and Boarder colors/weight to achieve your desired result.
3 - Apply a gradient-style scheme to your report by using one or more colors and dynamically changing the hue as you go up or down the report. That way, the top could be darker than the bottom, or vis-versa.
I hope this helps.
Numerous fonts can be used.
Open the Character Map
Select Arial in the Font drop down
Scroll to near the bottom, select the cross character
Hit the Select button a number of times, grab as many characters as the SSRS textbox may require to fill its width
Click copy
In SSRS select the textbox then Ctrl-P to paste
Experiment with font size and font color to get the desired effect
Setting padding to zero may help
Setting row CanGrow to False may help
I find there is a little gap between cells vertically but it is close to perfect for me. There is likely to be a character in Arial or another font that works even better.

Delete part of canvas and image altogether

I was wondering if there was an easy way to do this.
I have a picture
and I want to delete the highlited part
So the final image looks like
Basically, what I usually do is delete the highlited part, align the bottom part with the top one and crop the canvas, but I was wondering if there is a program that lets you do everything in one step (deleting the section of the canvas and the image altogether)
Paint.NET:
Select that area with the Rectangle Select tool, then press delete.
Select the bottom part of the image, switch to the Move Selected Pixels tool, and hold the up arrow key until it's in place. (ctrl + up arrow = 10 pixels at a time)
Now you need to crop it. Switch to the Magic Wand tool, set the Tolerance to zero, click in the newly transparent area at the bottom, then invert the selection (Edit -> Invert Selection), then crop (Image -> Crop to Selection).

Aligning text boxes

I'm have some data output text boxes (text boxes with no border and with the same background as the rest of the window) that I'm trying to align with a standard edit control + spin button, to represent a column of numbers, one of which can be edited:
I can manually align these in the Delphi / C++Builder form designer, but when I then view the form on a different version of Windows or at a different DPI, the text is no longer right-justified, presumably because of differences in the spin button spacing, borders, etc.
I can use EM_GETMARGINS to determine the width of the spin button, but how can I determine the size of the edit control's margins and borders? I've tried various combinations of EM_POSFROMCHAR, ClientToScreen, GetSystemMetrics(SM_CXBORDER), GetSystemMetrics(SM_CXEDGE), and GetThemeMargins, but so far, I can't find a combination that works and makes sense.
More details:
Environment is Delphi / C++Builder XE2.
The data output controls are TEdits with BorderStyle bsNone.
The edit + spin button is a TJvSpinEdit. From viewing its source, it uses EM_SETMARGINS to allow space for its spin button.
Use the Win32 API GetWindowRect() and GetClientRect() methods. The bordering will be the difference between the two rectangles. That will only give you the bordering, though. There could be extra spacing inside the client area.

Change white png image to specific colour

I have a white png image, which is a part of a n icon.
I would like to change it's colour to get a coloured icon.
I know it is possible with hue/saturation setting, but don't know how to achieve a specific colour output.
I am using Axialis Icon Workshop (I have Photoshop CS5 also). The colourize option along with Hue, Saturation and Brightness adjustments will assist getting any colour output. But I specifically want colour #3366CC.
Is there a solution to convert my white png image to #3366CC coloured image?
This can be easily achieved if you go to the layers panel in Photoshop and select your icon layer. If the icon has a transparent background then select the fx button from the bottom of the layers panel and select color overlay or go to the menu at the top of the Photoshop screen and select Layer > Layer Style > Color Overlay. From the options box select the color box and put in 3366cc instead of the ffffff you have.
This should give you a coloured icon as desired. If this doesn't work let me know and I'll try to help.
You can go to layer style and choose color overlay, but that wont give you the color as you exactly want it, you can go a step further and hold the control key and click on the shape or the image you want to change the color, the shape will be selected, make a new layer on top of the shape or image that you want to change the color then fill in the color with the color that you choose in the layer property and set the mode to overlay, reduce the opacity to 50%. done

How to align text to the top of the button in Matlab GUI?

I have a GUI with big buttons and wouls like to align the text in the button to the top, all I found is "horizontal alignment" property.
Thanks...
You need to access the underlying Java Swing component (I am using FINDJOBJ function):
figure('Menubar','none', 'Position',[200 200 300 200])
h = uicontrol('Style','pushbutton', 'String','click', ...
'Units','normalized', 'Position',[0.3 0.3 0.5 0.5]);
jh = findjobj(h);
jh.setVerticalAlignment( javax.swing.AbstractButton.BOTTOM );
I'm afraid I think you can't do this - text is always vertically aligned at the middle on a uicontrol. The only hacks I can think of that might achieve something like what you want are
Add extra return characters after your main text, so that the real text ends up at the top while the whole text remains centred
(REALLY horrible) Create an image with your text right at the top, and use this with the CData property of the button.

Resources