custom-draw

Java custom drawing with paintComponent() and paint()

☆樱花仙子☆ 提交于 2021-02-05 10:39:53
问题 I come from an Objective-C background and I have been developing on the iOS and Mac OS platform for a number of years now. I love the concept of custom drawing and therefore I would like to replicate what had been done by me on the aforementioned platform. In iOS I would call -drawRect() to draw a custom view and then, I could go ahead and add other visual components on top of that drawing. I know that there are equivalents in java swing and awt called paint() and paintComponent() . However,

Java custom drawing with paintComponent() and paint()

非 Y 不嫁゛ 提交于 2021-02-05 10:39:08
问题 I come from an Objective-C background and I have been developing on the iOS and Mac OS platform for a number of years now. I love the concept of custom drawing and therefore I would like to replicate what had been done by me on the aforementioned platform. In iOS I would call -drawRect() to draw a custom view and then, I could go ahead and add other visual components on top of that drawing. I know that there are equivalents in java swing and awt called paint() and paintComponent() . However,

Treeview node with transparent text background instead of default white

浪子不回头ぞ 提交于 2019-12-23 09:48:15
问题 I am using custom draw to try and create transparent tree view ( for now I am testing when Visual Styles are enabled ). My CDDS_PREPAINT handler works fine, tree has parent's background bitmap drawn properly. I tried to add CDDS_ITEMPREPAINT handler where I use SetBkColor( ((LPNMCUSTOMDRAW)lParam)->hdc, TRANSPARENT ); and return CDRF_NEWFONT , but that failed. Node is drawn with default white background. How can I make item's text background transparent? Thank you. Best regards. Below is the

How to draw the static part of the combobox

只愿长相守 提交于 2019-12-12 04:43:54
问题 I have a custom drawn combobox with style CBS_DROPDOWNLIST and CBS_OWNERDRAWVARIABLE I can draw the items of the dropdownlist ok but whe user select an item it is drawn in the combobox static part [the part of combo that stay visible after selecting item and show the selection], I want to give it a custom text like in the following image But I can't determine it I found a code like this if(DrawItemStruct.CtlType == ODT_COMBOBOX)//the static part of the combo DrawComboText(pDC, DrawItemStruct

Draw over controls in Delphi form

跟風遠走 提交于 2019-11-30 15:57:41
How can I draw something on the Forms canvas and over controls on the Form? I try the following: procedure TForm1.FormPaint(Sender: TObject); var x,y: Integer; begin x := Mouse.CursorPos.X - 10; y := Mouse.CursorPos.Y - 10; x := ScreentoClient(point(x,y)).X - 10; y := ScreenToClient(point(x,y)).Y - 10; Canvas.Brush.Color := clRed; Canvas.FillRect(rect(x, y, x + 10, y + 10)); Invalidate; end; The rectangle is drawn before other controls are drawn, so it is hidden behind the controls (this is expected behavior according to the Delphi Docs). My questions is how can I draw over controls? Do not

Draw over controls in Delphi form

不羁岁月 提交于 2019-11-30 15:48:37
问题 How can I draw something on the Forms canvas and over controls on the Form? I try the following: procedure TForm1.FormPaint(Sender: TObject); var x,y: Integer; begin x := Mouse.CursorPos.X - 10; y := Mouse.CursorPos.Y - 10; x := ScreentoClient(point(x,y)).X - 10; y := ScreenToClient(point(x,y)).Y - 10; Canvas.Brush.Color := clRed; Canvas.FillRect(rect(x, y, x + 10, y + 10)); Invalidate; end; The rectangle is drawn before other controls are drawn, so it is hidden behind the controls (this is

Add graphical bar to a StringGrid col

不打扰是莪最后的温柔 提交于 2019-11-29 10:39:47
Using Delphi 2010 and a TStringGrid component, I currently display five filds from a database query. Here is a simplied example of what i am doing //set up the grid procedure TGriddata.FormCreate(Sender: TObject); begin grdMain.Rows[0].commatext:='"One","Two","Three","Four","Five"'; grdMain.ColWidths[0]:= 50; grdMain.ColWidths[1]:= 175; grdMain.ColWidths[2]:= 175; grdMain.ColWidths[3]:= 100; grdMain.ColWidths[4]:= 300; end; //display the data in the grid //note, I am not showing my creation, execution, or destroy of the query procedure TGriddata.load; begin ... grdMain.Cells[0,row]:=

Win32: How to custom draw an Edit control?

筅森魡賤 提交于 2019-11-28 12:03:19
i need to implement the functionality of EM_SETCUEBANNER , where a text hint appears inside an Edit control: The catch is that i cannot use version 6 of the Common Controls, which is what is required to get the Microsoft supplied implementation of a cue banner. i've looked into simply changing the text of the edit control, and the font format to Dark Gray Italic Text but it will throw Change events ( component wrapper provided by higher component library ) that i can't find a way to avoid. So i was instead going to custom draw the text, drawing the Cue Banner text when the control is unfocused

Add graphical bar to a StringGrid col

故事扮演 提交于 2019-11-28 03:50:01
问题 Using Delphi 2010 and a TStringGrid component, I currently display five filds from a database query. Here is a simplied example of what i am doing //set up the grid procedure TGriddata.FormCreate(Sender: TObject); begin grdMain.Rows[0].commatext:='"One","Two","Three","Four","Five"'; grdMain.ColWidths[0]:= 50; grdMain.ColWidths[1]:= 175; grdMain.ColWidths[2]:= 175; grdMain.ColWidths[3]:= 100; grdMain.ColWidths[4]:= 300; end; //display the data in the grid //note, I am not showing my creation,

Win32: How to custom draw an Edit control?

南笙酒味 提交于 2019-11-27 06:50:18
问题 i need to implement the functionality of EM_SETCUEBANNER, where a text hint appears inside an Edit control: The catch is that i cannot use version 6 of the Common Controls, which is what is required to get the Microsoft supplied implementation of a cue banner. i've looked into simply changing the text of the edit control, and the font format to Dark Gray Italic Text but it will throw Change events (component wrapper provided by higher component library) that i can't find a way to avoid. So i