Change style of individual borders of a rectangle in draw.io - draw.io

I want to format a rectangle in draw.io, such that only one border (left border) is colored black, the other borders: top, right and bottom must remain "clear".
I am trying to figure out proper coding to affect only those elements, but it seems that you can affect only the entire border with the style key: imageBorder=none
as explained in shape styles for Draw.io
Is there a way to only have one border with a specific color, and the other borders blank? Code for such a trick would be very welcome.

When you type "rectangle" in the Search bar, you will see "Partial rectangle" which sounds like the one you are looking for. Also, there is a possibility to change some properties in the Format panel on the right when a shape is selected.
You can also add the following style:
verticalLabelPosition=bottom;
verticalAlign=top;
html=1;
shape=mxgraph.basic.rect;
fillColor=#ffffff;
fillColor2=none;
strokeColor=#000000;
strokeWidth=1;
size=20;
indent=5;
in the Edit style window, and then play with the extended list of properties in the Format panel.

Related

How to paint image inside of the entire QScrollArea?

Steps to reproduce using Qt Designer:
1- Add a "Grid Layout"
2- Right click in the MainWindow background and
Lay out -> Lay out in Grid
3- Add a "Scroll Area"
4- Add a "Frame"
5- Right click in the "Scroll Area" and
Lay out -> Lay out in Grid
6- Add a "Label" into the "Frame" and right click it
and Lay out -> Lay out in Grid
7- Add a "border-image" in the Label StyleSheet
Result:
Looks like its padding 10px in each side.
Would like to ask how i could make the image added into the QLabel to occupy the entire QScrollArea, filling these empty areas around the image where are marked with a X.
If possible using stylesheet.
Widget's geometry is not the problem. If your widget is inside layout, then you do not need to care about geometry at all because it is automatically calculated by the layout. You only may need to care about the geometry of the whole window, but not child widgets.
The blank space around your widget is determined by layout's contents margins. Set the contents margins for the layout - set them all to zero. See the picture. If you have multiple layers of layout, you may want to set zero margins for all of them. It depends on your usecase.
You can also set the margins in code using yourLayout->setContentsMargins(0, 0, 0, 0);.

Can we have border on all sides for a control in a dialog in a C++ MFC application?

Generally if u add any control Eg: a rich text, the left and the top portion of the control will have thick borders.But the bottom and the right side of the control do not have borders. Is there any way to add borders to all sides. The border property has only true or false option, i don't want to take off the borders but have the borders unique on all sides. Please let me know if there are any ways.
Sorry i was unable add images earlier as i didn't have enough reputations. Please note the below image where the left and top borders of the rich text box are thick but the right and the bottom part and plain. I want all sides with borders even.
Anyways?.
I’ve answered a very similar (may be duplicate) question recently. You can check “Want to show colored box around Richedit control in MFC at runtime”. That question asked for a yellow colored border. To answer your question, it requires you to derive your own class from CRichEditCtrl, override OnNcPaint, and a simple modification of the sample (OnNcPaint) code I presented in that post:
CPen pen;
COLORREF color = ::GetSysColor(COLOR_3DDKSHADOW);
pen.CreatePen(PS_SOLID, 5, color);
dc.SelectObject(pen);
dc.Rectangle(&rect);
The above would result in...
Note: You can adjust the border color by changing the parameter of ::GetSyscolor

Specific QPushButton style

How can I customize the look of a QPushButton or QToolButton to look something like elementaryos's webpage "buttons"?
All I really want is the characteristic image position and the text on it's side, maybe if i'm lucky i can also get a border like that, but i don't really need the little description below the title :)
Can i do it only with StyleSheets, or do i have to subclass QPushButton/QAbstractButton/Something like that? I already searched everywhere but didn't found that level of customization without things like painting something in a fixed place, which is exactly what i don't want.
EDIT:
I really would like a solution that would get me a customizable button, not a fixed image one, something in the tracks of
MainWindowButton(QString(title), /*opt*/QString(description), QImage(icon));
There are a number of approaches that may work.
You might first consider trying to compose a solution with a normal QPushButton with a QVBoxLayout on it. You could add three QLabels; one for the title text, one for the caption text and one for the image. Some CSS could probably be used to render the background image of the button for up and down and more CSS to style the text in the two labels and position the image on the third but you would then find that the labels don't shift down when the button is clicked.
I think the best solution involves direct painting. You could do this by sub classing a QWidget and overriding the paintEvent(). Render everything for the up state and shift everything over and down a bit for the down state.
You could achieve this without sub classing by rendering the up and down states to a QImage and styling a QPushbutton with them using CSS.
There are a number of combinations of these approaches too.
You can set the background as white with the icon in the right corner with some creative use of the border-image stylesheet property where the bottom border is as tall as the icon and the top, left and right borders are 0 pixels wide. You'll need to make a custom image that basically looks like the icon with a couple pixels width on the left and top that are white
http://doc.qt.digia.com/qq/qq20-qss.html#theboxmodel
The text you may have to do overriding paintEvent.

How to handle figure overlapping in Graphiti?

I have a big rectangle and a small rectangle made of graphiti, now when I drag small rectangle over big rectangle then I am not able to select that small rectangle instead big rectangle got selected.
In short that small rectangle doesn't has mouse event until it is on big rectangle.
So is there any way when we drag any figure1 over other figure2, then figure1 should be draggable instead of figure2.
I have remove all selectable properties and draggable properties from big rectangle ( figure2 ) but its not working.Please help me for the same as it is very important.
Thanks in advance:)
selecting overlapping figures is not implementd at the moment. This is an open issue.
Graphiti implements a simple hit test. Fist bounding box hit wins.

Custom draw CTreeCtrl: how to add font strike through?

I have implemented custom draw for an CTreeCtrl in my MFC Smart Device program. I have successfully changed the color of specific nodes of the CTreeCtrl. I am now trying to understand how to get the default font used to draw text in the control so I can add a strike-through to the font for certain nodes. How would I go about getting the default font used to draw text in the CTreeCtrl and apply a font strike-through to the font?
Use GetFont() to get the font of the control. Strike-through can't be done with ::DrawText AFAIK, but it's easy to just add a GoTo()/LineTo(). You can use GetTextExtent() to get the size of the bounding rectangle and derive the left/right of the strike through line from that.