如何建立 幾何畫筆

2021-08-10 11:08:30 字數 1763 閱讀 1137

建立幾何畫筆時出現「需要的資源無法得到」警告對話方塊。

原因: 建立幾何畫筆時候總是出現「需要的資源無法得到」的警告資訊,發現原因是,設定了ps_userstyle,  並且沒有設定cpen( intnpenstyle, intnwidth, const logbrush*plogbrush, intnstylecount= 0, const dword*lpstyle= null );

的後兩個引數。 或者, 沒有設定ps_userstyle, 而設定了上述函式的後兩個引數。

建立方形畫筆的乙個示例:

[cpp]view plain

copy

print

?dword penflags=ps_geometric | ps_endcap_square | ps_join_bevel;  

logbrush lb;  

lb.lbstyle=bs_solid;  

lb.lbcolor=rgb(100, 200, 200);  

lb.lbhatch=hs_vertical;  

cpen tmppen(penflags, 20, &lb);  

dword penflags=ps_geometric | ps_endcap_square | ps_join_bevel;

logbrush lb;

lb.lbstyle=bs_solid;

lb.lbcolor=rgb(100, 200, 200);

lb.lbhatch=hs_vertical;

cpen tmppen(penflags, 20, &lb);

方形畫筆與圓形畫筆的不同:

[cpp]view plain

copy

print

?// 設定邏輯畫刷

logbrush logbrush;  

logbrush.lbstyle = bs_solid;  

logbrush.lbcolor = rgb(10, 20, 100);  

logbrush.lbhatch = hs_cross;  

int x1 = 100, y = 100, x2 = 400;      

int i = 0;  

// 使用方形畫筆繪製各種樣式的直線

for (i = 0; i 

x1 = 500, x2 = 800;  

// 使用圓形畫筆建立各種樣式的直線

for (i = 0; i 

// 設定邏輯畫刷

logbrush logbrush;

logbrush.lbstyle = bs_solid;

logbrush.lbcolor = rgb(10, 20, 100);

logbrush.lbhatch = hs_cross;

int x1 = 100, y = 100, x2 = 400;

int i = 0;

// 使用方形畫筆繪製各種樣式的直線

for (i = 0; i < 5; ++i)

x1 = 500, x2 = 800;

// 使用圓形畫筆建立各種樣式的直線

for (i = 0; i < 5; ++i)

執行結果:

如何改變Python畫筆顏色

前面我們了解到了python如何用畫筆畫直線,我發的演示圖大家看到了,不是黑就是白,不美觀。於是我今天就要教大家如何改變畫筆顏色。首先按照昨天的步驟匯入turtle import turtle t turtle.turtle 這時我們應該告訴python加顏色,以免它不知道 滑稽 t.color 顏...

c 從畫刷建立畫筆

using system using system.collections.generic using system.componentmodel using system.data using system.drawing using system.text using system.window...

建立畫筆的三個方法

最簡單的方法是構造乙個cpen物件並把定義畫筆所用的引數都傳送給該物件 cpen pen ps solid,1,rgb 255,0,0 第二種方法是構造乙個沒有初始化的cpen物件並呼叫cpen createpen cpen pen pen.createpen ps solid,1,rgb 255,...